Closed ckmk14 closed 3 years ago
What you are seeing here is that a single packet is parsed on they each side of the connection (HEL
going to the one way, ACK
coming back). This is because in your grammar a Packet
parses a single message.
To instead parse all messages going back and forth over a TCP connection you need to adjust your grammar to accept multiple messages, e.g.,
# opcua.spicy
module OPCUA;
type Packet = unit {
payload: bytes &size=3;
on %done { print self; }
};
public type Packets = unit {
packets: Packet[] &eod;
};
# opcua.evt
protocol analyzer spicy::OPCUA over TCP:
parse with OPCUA::Packets,
port 4840/tcp;
See e.g., the HTTP analyzer in zeek/spicy-analyzers for an example of how other TCP analyzers do this.
Damn how stupid ... thanks a ton! I was developing the grammar using single opcua chunks for each opcu service type via spicy-driver. Therefore, I missed the (very important :D) fact about streams...
Hi all,
have created an OPC UA (over TCP) spicy grammar and now tried to integrate it into zeek. Unfortunately, the integration does not work. I have a dummy grammar and some pcaps to illustrate the problems:
opcua.spicy:
opcua.evt:
These are the commands for compiling and testing (t1.pcapng compressed as zip: t1 compressed.zip):
spicyz -o opcua.hlto opcua.spicy opcua.evt
zeek -B dpd -Cr t1.pcapng opcua.hlto Spicy::enable_print=T
This is the output from the last command
It looks like every OPC UA message after the acknowledge message is not parsed. The debug view shows that it is probably not working because zeek is not forwarding the data (cat debug.log | grep OPCUA):
Unfortunaly, with another pcap it looks like zeek is forwarding the data but spicy is not parsing them Second PCAP and Debug.log.zip
Can anyone help me here?
Thanks, Markus