Skip to content

Commit

Permalink
Merge pull request #1 from TnekRex/wire-it-up
Browse files Browse the repository at this point in the history
Wire it up: Enable iterative testing of the parser
  • Loading branch information
Kardbord authored May 12, 2024
2 parents 8cef9b4 + 9f15a35 commit 801a622
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
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.

0 comments on commit 801a622

Please sign in to comment.