spicy script help for packer analyser #3220
-
Hi,
I am able to register the plugin and can see in zeek -NN but not able to do 1 & 2. It is printing nothing for the pcap, just getting packet_filter.log with an entry of default bpf filter IP or not IP.
Can you please tell where I am doing mistakes. Below are my spicy scripts spicy parser script
spicy event
zeek spicy script
Zeek script
PCAP file: https://github.com/ITI/ICS-Security-Tools/blob/master/pcaps/IEC61850/GOOSE/GOOSE.pcap |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
This issue has been mentioned on Zeek. There might be relevant details there: https://community.zeek.org/t/need-a-sample-spicy-script-to-detect-iec-61850/7095/3 |
Beta Was this translation helpful? Give feedback.
-
There are a number of issues here. In if ( ! PacketAnalyzer::try_register_packet_analyzer_by_name("Ethernet", 0x88ba,
"spicy_GOOSE") )
if ( ! PacketAnalyzer::try_register_packet_analyzer_by_name("Ethernet",
0x88ba, "spicy::GOOSE") )
print "cannot register GOOSE Spicy analyzer"; This registers your GOOSE analyzer for tag You should change these lines to if ( ! PacketAnalyzer::try_register_packet_analyzer_by_name("Ethernet", 0x88b8,
"spicy_GOOSE") )
print "cannot register GOOSE Spicy analyzer"; In on zeek_spicy_goose::GOOSEPacket::%done {
zeek::confirm_protocol();
}
on zeek_spicy_goose::GOOSEPacket::%error {
zeek::reject_protocol("error while parsing GOOSE record");
} You here call With both these changes your analyzer produces a #separator \x09
#set_separator ,
#empty_field (empty)
#unset_field -
#path goose
#open 2023-08-07-11-19-04
#fields ts appid pkt_len
#types time count count
1216135243.118812 0 256
1216135253.159260 0 256
1216135263.198794 0 256
1216135270.951499 0 256
1216135270.963584 0 256
1216135270.986981 0 256
1216135271.077396 0 256
1216135271.583138 0 256
#close 2023-08-07-11-19-04 Spicy/Zeek come with a number of tools to allow debugging such issues, see e.g., the section on Spicy Zeek analyzer debugging in the Spicy docs. In this case, using |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot @bbannier . I have fixed these issues by using "zkg create --features spicy-packet-analyzer --packagedir goose", it worked fine. So, now packets are detecting as goose. Now I need help in parsing the protcol or writing the parser. So, if anyone from zeek team can guide me slightly or give me a starting point for this protocol would be very much appreciated. I want to know how to parse such protocols where there are subsequent message passing for PDUs and we need to assemble them ( maybe ) to extract proper information. MMS is a connection-oriented protocol whereas GOOSE is not. GOOSE PCAP |
Beta Was this translation helpful? Give feedback.
-
@biswajitutil, the Spicy documentation is exactly the guide you are looking for, it e.g., has a walk-through for creating a sample analyzer. If you run into concrete issues, feel free to e.g., open a new |
Beta Was this translation helpful? Give feedback.
There are a number of issues here.
In
main.zeek
:This registers your GOOSE analyzer for tag
0x88ba
. Looking at your PCAP, this is not the correct tag for GOOSE which should be0x88b8
instead.You should change these lines to
In
zeek_goose.spicy
: