Getting the Output From system()

Say I wanted a bro script to call out to an external program, and I wanted to get the output from the external program into my bro script.

This thread shows that I can call an external program with system():
http://mailman.icsi.berkeley.edu/pipermail/bro/2004-August/001555.html

Based on the old bro wiki, it looks like the output from that command gets redirected to stderr:
http://www-old.bro-ids.org/wiki/index.php/Reference_Manual:Predefined_Variables_and_Functions#system.28s:_string.29:_int

Is there anything like system() that returns the output of an external command?

-Chris

I hate that I'm even pointing this out on the mailing list, but here it goes…

You can do it with the input framework and system command together. I have a minimal example that I wrote for the SecurityOnion guys for their Bro installation. This script runs the hostname command and collects the output.

  https://github.com/sethhall/bro-securityonion/blob/master/hostname.bro

Have fun. :slight_smile:

  .Seth