[Bro] Access pcap filename in script land

Valerio valerio.click at gmx.com
Mon Mar 28 09:20:52 PDT 2016


Hi,

thanks for your feedback. However I think I am missing something.
In fact, if I run:

bro -r pcap_file_name.pcap arg1=test

I get the following error

error in <params>, line 1: unknown identifier test, at or near "test"

Please notice that, as I described in my previous mail:

"I have a custom main.bro script in
scripts/base/protocols/proto1/main.bro to which I would like to pass
arguments from command line"

in the main.bro I defined arg1 as const arg1=""&redef within the
export{} block and having define module Prot1;

Even if I run

bro -r pcap_file_name.pcap Prot1::arg1=test

I get the following error
error in <params>, line 1: unknown identifier test, at or near "test"

the same with:
bro -r 28122015-whatsapp_iphone_traffic.pcap 'Wa::arg1=test'

best regards,
Valerio


On 28/03/2016 16:07, Azoff, Justin S wrote:
> 
>> On Mar 28, 2016, at 10:01 AM, Valerio <valerio.click at gmx.com> wrote:
>>
>> If I run bro -r pcap_file_name.pcap 'arg1="test"' I get the following error:
>>
>> error in <params>, line 1: "redef" used but not previously defined (arg1)
>>
>> regards,
>> Valerio
> 
> That's because you did not define arg1... Also, 'arg1="test"' does not work. arg1=test works. 'arg1=test' would work. "arg1=test" would work, 'arg1="test"' does not work.
> 
> $ cat t.bro
> const arg1 ="x" &redef ;
> 
> event bro_init() {
>     print arg1;
> }
> $ bro t.bro
> x
> $ bro t.bro arg1=test
> test
> $ bro t.bro 'arg1=test two'
> test two
> 


More information about the Bro mailing list