[Bro] conditional loading

Dk Jack dnj0496 at gmail.com
Mon Nov 30 18:43:49 PST 2015


the directives don't seem to have file test operators. I tried to do the
following...

local c = "test -f filters.bro";
local cmd = Exec::Command($cmd=c);

when (local res = Exec::run(cmd))
{
  @if (res$exit_code == 0)
  {
    @load filters.bro;
  }
}


However, I am getting parsing errors...

---------------------------------------------------------------
referencing a local name in @if (res)
invalid expression in @if (res$exit_code == 0)
---------------------------------------------------------------

Dnj


On Mon, Nov 30, 2015 at 4:41 PM, anthony kasza <anthony.kasza at gmail.com>
wrote:

> See here:
> https://www.bro.org/sphinx/script-reference/directives.html
>
> -AK
> On Nov 30, 2015 4:36 PM, "Dk Jack" <dnj0496 at gmail.com> wrote:
>
>> Hi,
>> Is it possible to perform conditional loading of bro script files ?
>> In my local.bro file, I'd like to do something like this:
>>
>> if file 'filters.bro' exists
>> {
>> @load filters.bro
>> }
>>
>> The file filters.bro may or may not exist because it's getting generated
>> from an external program.
>> Thanks for your help in advance.
>>
>> Dnj
>>
>> _______________________________________________
>> Bro mailing list
>> bro at bro-ids.org
>> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/bro
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20151130/01645876/attachment.html 


More information about the Bro mailing list