mirror of https://github.com/dirtbags/netarch.git
make dumbdecode a little less dumb and a little more helpful
This commit is contained in:
parent
ad8d412f73
commit
6cf9614b97
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue