[Bro] BinPAC and hexadecimal representation

Emmanuel TORQUATO Emmanuel.TORQUATO at monext.net
Thu Feb 5 08:09:23 PST 2015


Thanks Jon,

In fact I would like to have as result a string which is not a hexa convertion to ASCII put just a string that shows the data as an Hex representation
For example, if in binPac we have parsed data to a bytestring object, I would like to just put the hex value to string representation not an ASCII convertion.
For example a 4 bytes data like this 03 af 3c 4c parsed as bytestring in bin pac would be converted to a string like this "\0x03\0xaf\0x3c\0x4c" 


Regards,

Emmanuel.
-----Message d'origine-----
De : Siwek, Jon [mailto:jsiwek at illinois.edu] 
Envoyé : jeudi 5 février 2015 16:16
À : Emmanuel TORQUATO
Cc : bro at bro.org
Objet : Re: [Bro] BinPAC and hexadecimal representation


> On Feb 5, 2015, at 5:06 AM, Emmanuel TORQUATO <Emmanuel.TORQUATO at monext.net> wrote:
> 
> By reading some BinPac code I found the function “bytestring_to_val” to decode a stream as ASCII and I wonder if such a function exists for hexadecimal representation like will do ascii.hexlify() as example in python.

Not sure exactly what you need, but the get_escaped_string() function in Bro’s src/util.cc may help or give you ideas about how to write what you need.

- Jon



More information about the Bro mailing list