netarch

Network Archaeology library for Python
git clone https://git.woozle.org/neale/netarch.git

commit
6cf9614
parent
ad8d412
author
Neale Pickett
date
2019-01-28 10:15:42 -0700 MST
make dumbdecode a little less dumb and a little more helpful
1 files changed,  +8, -1
M dumbdecode.py
+8, -1
 1@@ -4,10 +4,17 @@ import sys
 2 from netarch import ip
 3 from netarch import *
 4 
 5+class DumbPacket(ip.Packet):
 6+    def parse(self, data):
 7+        self.payload = data
 8+
 9+class DumbSession(ip.Session):
10+    Packet = DumbPacket
11+
12 s = None
13 reseq = ip.Dispatch(*sys.argv[1:])
14 for h, d in reseq:
15     srv, first, chunk = d
16     if not s:
17-        s = ip.Session(first)
18+        s = DumbSession(first)
19     s.handle(srv, first, chunk, reseq.last)