[Bro] Share vector

Mike Dopheide dopheide at gmail.com
Thu Oct 19 19:19:39 PDT 2017


So, have you tried it?  :)  Two things to consider:  1) event &priority and
2) If you're running Bro in standalone vs cluster mode.

Correcting a couple syntax issues and adding a priority:

Script1:
module S1;

export {
       global vec: vector of string;
}

event bro_init() &priority=1 {
      vec[0] = "hello";
}

Script2:
module S2;

event bro_init()
{
    print S1::vec;
}

$ /usr/local/bro/bin/bro -i en0 script1.bro script2.bro
listening on en0

[hello]

It gets more complicated if you're running in a cluster.

-Dop


On Thu, Oct 19, 2017 at 11:14 AM, Rober Fernández <roberixion at gmail.com>
wrote:

> Hi
>
> I would like to do something like this
>
> script 1 :
>
> module S1;
>
> export {
> global vec: vector of string;
> };
>
> event bro_init() {
> vec[0] = "hello"
> }
>
>
> And script2 can print vec
> -------
> script 2 :
>
> module S2;
>
> event bro_init()
> {
> print S1::vec
> }
>
> Output:
> ["hello"]
>
> 2017-10-19 18:03 GMT+02:00 william de ping <bill.de.ping at gmail.com>:
>
>> Hi
>>
>> I guess you can put that vector in one script, and call it from the
>> second script using the first script module name :
>>
>> script 1 :
>>
>> module S1;
>>
>> export {
>> global vec: vector of string;
>> };
>>
>>
>> -------
>> script 2 :
>>
>> module S2;
>>
>> event bro_init()
>> {
>> S1::vec[0]="hello";
>> }
>>
>>
>>
>> On Wed, Oct 18, 2017 at 1:23 PM, Rober Fernández <roberixion at gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I would like to access to the same vector and modificate it in two
>>> different scripts, How can I do this?
>>>
>>> Regards
>>>
>>> _______________________________________________
>>> Bro mailing list
>>> bro at bro-ids.org
>>> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/bro
>>>
>>
>>
>
> _______________________________________________
> 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/20171019/a21409d1/attachment.html 


More information about the Bro mailing list