Nmap Development mailing list archives
Re: Detecting/parsing a hex string
From: "Patrick Donnelly" <batrick.donnelly () gmail com>
Date: Wed, 8 Oct 2008 11:41:36 -0600
On Wed, Oct 8, 2008 at 5:25 AM, Ron <ron () skullsecurity net> wrote:
Hi all, I need to detect whether or not a string is an ascii representation of a hex string (eg, "12ab3d1a3badabeea1...."), and, if it is, to convert it to a binary string. Is there an easy way to do that (maybe with bin.pack/bin.unpack)? Thanks, Ron
a = "414243" if string.find(a, "^%x+$") then a = string.gsub(a, "%x%x", function(a) return string.char(tonumber(a, 16)) end) --> a = "ABC" end -- -Patrick Donnelly "One of the lessons of history is that nothing is often a good thing to do and always a clever thing to say." -Will Durant _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Detecting/parsing a hex string Ron (Oct 08)
- Re: Detecting/parsing a hex string Brandon Enright (Oct 08)
- Re: Detecting/parsing a hex string Brandon Enright (Oct 08)
- Re: Detecting/parsing a hex string Patrick Donnelly (Oct 08)
- Re: Detecting/parsing a hex string David Fifield (Oct 08)
- Re: Detecting/parsing a hex string David Fifield (Oct 08)
- Re: Detecting/parsing a hex string Patrick Donnelly (Oct 08)
- Re: Detecting/parsing a hex string David Fifield (Oct 08)
- Re: Detecting/parsing a hex string David Fifield (Oct 08)
- Re: Detecting/parsing a hex string Brandon Enright (Oct 08)
- Re: Detecting/parsing a hex string Ron (Oct 08)
- Re: Detecting/parsing a hex string David Fifield (Oct 08)
- Re: Detecting/parsing a hex string Ron (Oct 08)
- Re: Detecting/parsing a hex string Brandon Enright (Oct 08)
- Re: Detecting/parsing a hex string Ron (Oct 08)
- Re: Detecting/parsing a hex string Fyodor (Oct 23)
- Re: Detecting/parsing a hex string David Fifield (Oct 08)