Nmap Development mailing list archives
Re: Detecting/parsing a hex string
From: "Josef 'Jupp' Schugt" <jupp () gmx de>
Date: Thu, 09 Oct 2008 10:51:30 +0200
On Wed, 08 Oct 2008 13:25:03 +0200, Ron <ron () skullsecurity net> wrote:
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)?
Only to note that: detection if a string *is* an ascii representation of a hex string is impossible. You can only detect if it looks *like* one:
'bad'.to_i(16) # -> 2989 'dead'.to_i(16) # -> 57005 Depending on context 'bad' and 'dead' may be words or hexadecimal numbers. Josef 'Jupp' Schugt -- Blog: http://penpen.goodaddress.eu/ PGP key (id 6CC6574F): http://wwwkeys.de.pgp.net/ Jabber - http://www.jabber.org/ - contact information on request _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- Re: Detecting/parsing a hex string, (continued)
- 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 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)