[Bro] define a variable name based on string in bro

william de ping bill.de.ping at gmail.com
Mon Apr 17 23:54:35 PDT 2017


Hi all,

I am trying to auto generate a variable name dynamically.
For example, I want to create a test_i variable were i is a digit, that var
will be used as the name of a set :

event bro_init()
{
 for (i in set(1,3,5,7))
  {
  local fmt("test_%s",i): set[string] = {"one","two","three"};
  }
}

event bro_done()
{
  for (i in set(1,3,5,7))
  {
  print "one" in fmt("test_%s",i);
  }
}

The above does not work, so is there any command in bro language that could
transform a string into a variable ?

Thanks
B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/bro/attachments/20170418/2aaa650a/attachment.html 


More information about the Bro mailing list