Skip to content

Commit

Permalink
sniffer: adapt parsing script
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Sep 26, 2018
1 parent 9204feb commit 3ef810f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sniffer/tools/sniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def generate_pcap(port, out):
while True:
line = port.readline().rstrip()

pkt_header = re.match(r">? *rftest-rx --- len 0x(\w\w).*",
pkt_header = re.match(r">? *rftest-rx --- len (\w+).*",
line.decode(errors="ignore"))
if pkt_header:
now = time()
Expand All @@ -98,10 +98,10 @@ def generate_pcap(port, out):
sys.stderr.write("RX: %i\r" % count)
continue

pkt_data = re.match(r"(0x\w\w )+", line.decode(errors="ignore"))
pkt_data = re.match(r"(\w\w )+", line.decode(errors="ignore"))
if pkt_data:
for part in line.decode(errors="ignore").split(' '):
byte = re.match(r"0x(\w\w)", part)
byte = re.match(r"(\w\w)", part)
if byte:
out.write(pack('<B', int(byte.group(1), 16)))
out.flush()
Expand Down

0 comments on commit 3ef810f

Please sign in to comment.