[Bro] working with Broccoli

Siwek, Jonathan Luke jsiwek at illinois.edu
Wed Mar 6 14:31:59 PST 2013


> import broccoli
> 
> dns_answer = broccoli.record_type("answer_type", "query", "qtype", "qclass", "TTL")
> 
> @broccoli.event(broccoli.addr, broccoli.addr, broccoli.time, dns_answer, broccoli.string)
> def dns_via_api(orig_h, resp_h, start_time, ans, reply):
> print reply
> 
> bc = broccoli.Connection("127.0.0.1:47763", connect=False)
> bc.subscribe("dns_via_api", dns_via_api)
> bc.connect()
> 
> while True:
> bc.processInput()
> time.sleep(1)

Try removing the bc.subscribe() call.  I think it's only for use with non-decorated event callbacks, but you've already got the @broccoli.event decoration there.

    Jon



More information about the Bro mailing list