make dumbdecode a little less dumb and a little more helpful

This commit is contained in:
Neale Pickett 2019-01-28 17:15:42 +00:00
parent ad8d412f73
commit 6cf9614b97
1 changed files with 8 additions and 1 deletions

View File

@ -4,10 +4,17 @@ import sys
from netarch import ip
from netarch import *
class DumbPacket(ip.Packet):
def parse(self, data):
self.payload = data
class DumbSession(ip.Session):
Packet = DumbPacket
s = None
reseq = ip.Dispatch(*sys.argv[1:])
for h, d in reseq:
srv, first, chunk = d
if not s:
s = ip.Session(first)
s = DumbSession(first)
s.handle(srv, first, chunk, reseq.last)