[Bro-Dev] How to Print string in Bro
seth at icir.org
Wed Aug 10 22:41:32 PDT 2011
On Aug 11, 2011, at 1:28 AM, Hui Lin wrote:
> I am writing a bro event handler with one argument as "string" type. The string is actually treated as a byte stream but not ended with '\0' in Bro.
> I am wondering is there any way to print the hexadecimal value of each byte in this string (including how to index each byte within the string). I know that %s can print string, but it prints out the ASCII code, which sometimes is hard to decode.
You have a couple of choices with this right now.
local test_string = "this is\x00a test";
=> 0000 74 68 69 73 20 69 73 00 61 20 74 65 73 74 this is. a test^J
Would either of those work for you?
International Computer Science Institute
(Bro) because everyone has a network
More information about the bro-dev