zeek / zeek-netcontrol

Connectors for the Zeek NetControl framework
https://www.bro.org
Other
19 stars 12 forks source link

deprecated bro.event usage! #3

Closed alshaboti closed 5 years ago

alshaboti commented 5 years ago

I installed zeek as instructed then set PYTHONPATH but I am getting deprecated bro.event usage, use zeek.Event instead:.

root@2bfc71849201:/zeek-netcontrol/test# python simple-client.py 
DEBUG:netcontrol.api:Set up listener for 127.0.0.1:9977 (bro/event/netcontrol-example)
DEBUG:netcontrol.api:Waiting for broker message...
DEBUG:netcontrol.api:Handling broker status message...
INFO:netcontrol.api:Incoming connection established
DEBUG:netcontrol.api:Waiting for broker message...
DEBUG:netcontrol.api:Handling broker message...
File "simple-client.py", line 14: deprecated bro.event usage, use zeek.Event instead:
    response = ep.getNextCommand()
Traceback (most recent call last):
  File "simple-client.py", line 14, in <module>
    response = ep.getNextCommand()
  File "/zeek-netcontrol/netcontrol/api.py", line 141, in getNextCommand
    return self.handleBrokerMessage(msg)
  File "/zeek-netcontrol/netcontrol/api.py", line 153, in handleBrokerMessage
    ev = broker.bro.Event(event)
  File "/usr/local/bro/lib/broctl/broker/bro.py", line 26, in __new__
    return super(Event, cls).__new__(cls, *args, **kwargs)
TypeError: pybind11_object.__new__(Event) is not safe, use object.__new__()

Zeek-netcontrol is tested in this dockerfile

FROM ubuntu:16.04 
RUN apt update

RUN apt install cmake make gcc g++ flex bison libpcap-dev libssl-dev python-dev swig zlib1g-dev -y
RUN apt install git python-pip -y && pip install pyyaml
RUN git clone --recursive https://github.com/zeek/zeek && cd zeek && ./configure && make && make install
# install zeek-netcontrol
RUN git clone https://github.com/zeek/zeek-netcontrol.git
ENV PATH=/usr/local/bro/bin:$PATH
ENV PYTHONPATH=$PYTHONPATH:/usr/local/bro/lib/broctl:/zeek-netcontrol

#install gNMI client
RUN apt install curl -y
RUN curl -O https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
RUN mkdir /root/go
RUN tar -C /root/go -xzf go1.12.5.linux-amd64.tar.gz
ENV PATH=$PATH:/root/go/go/bin:/root/go/bin
ENV GOPATH=/root/go

RUN go get github.com/google/gnxi/gnmi_capabilities \
    && go install github.com/google/gnxi/gnmi_capabilities \
    && go get github.com/google/gnxi/gnmi_set \
   && go get github.com/google/gnxi/gnmi_get

COPY ./ /pegler/

ENV AUTH="-ca /pegler/tls_cert_key/client/ca.crt -cert /pegler/tls_cert_key/client/client.crt -key /pegler/tls_cert_key/client/client.key -target_name faucet.localhost -target_addr=192.168.100.3:10161"
alshaboti commented 5 years ago

As shown int he error, I replaced broker.bro by broker.zeek in netcontrol/api.py file and it works fine now.