[Bro] is that possible to use a global variable defined in other policy script?

Hui Lin (Hugo) hlin33 at illinois.edu
Fri Jan 13 20:20:56 PST 2012


Thanks.

At first, I am thinking about using in this way. However, then I found that
Seth's way is probably more convenient in Bro.

I think I am starting to get the concept of "redef" and "load" now.

Best,

Hui

On Fri, Jan 13, 2012 at 9:27 PM, Aashish SHARMA <init.conf at gmail.com> wrote:

>
> On Jan 13, 2012, at 6:23 PM, Seth Hall wrote:
>
> >
> > On Jan 13, 2012, at 5:42 PM, Hui Lin (Hugo) wrote:
> >
> >> I am wondering whether it is possible to use a global variable that is
> defined in other policy script?
> >
> > That's basically the definition of a global.  It's just a runtime
> modifiable variable that can exist outside of a particular scope.  You just
> need to make sure that the script that defines the variable is loaded prior
> to the script that uses it.  Bro's parser will tell you if the variable
> isn't available yet which would mean you probably loaded the scripts in the
> wrong order.
> >
> >> I found that in some scripts, "export" are used. Does this achieve
> similar function?
> >
> > The export keyword is only to making variables and types available
> outside of a module's namespace.  If variables are defined within a module
> but not in the export section then you will only have access to those from
> code within that module.
> >
>
> If you want to access table drop_info from drop.bro into http.bro you can
> say:
>
> DROP::drop_info += { …..
>
>
> basically create a "module"
>
> example hui.bro:
>
> Module hui
>
> export {
>
>        global a_var;
> };
>
>
> file: a.bro
>
> hui::a_var = abc
>
>
>
> Hope this helps.
> Aashish
>
>
>


-- 
Hui Lin
Research Assistant
DEPEND Research Group, ECE Department
University of Illinois at Urbana-Champaign
hlin33 at illinois.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20120113/9e9d057f/attachment.html 


More information about the Bro mailing list