Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire it up: Enable iterative testing of the parser #1

Merged
merged 4 commits into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions analyzer/protobuf.spicy
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
module protobuf;

import zeek;

public type Packet = unit {
payload: Message;

on %done {
# Feed into Zeek's next-layer packet analysis.

# KBK HERE - Comment out so we can build
#zeek::forward_packet(self.payload);
print self;
}
};

# message := (tag value)*
# A message is encoded as a sequence of zero or more pairs of tags and values.

#
# KBK - This should parse a sequence of zero or more TagAndValue pairs until end-of-data.
#
type Message = unit {
message: TagAndValue[] &eod; # <==== KBK HERE
message: bytes &eod;
#message: TagAndValue[] &eod;
};

type TagAndValue = unit { # <==== KBK HERE
type TagAndValue = unit {
tag: Tag;
value: Value;
};
Expand Down
9 changes: 9 additions & 0 deletions test-data/protobuf_udp_addressbook.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

B
JasonéJason@example.com"
87561234"
13588886666*¡‹—ü
:
LilyêLily@example.com"
62858875"
18822228888
Binary file added testing/Traces/protobuf_tcp_addressbook.pcapng
Binary file not shown.
Binary file added testing/Traces/protobuf_udp_addressbook.pcapng
Binary file not shown.
Loading