Frame::ipid needs to be 2 bytes; Session::open_out should care about binary

This commit is contained in:
pi-rho 2013-02-01 17:18:54 -06:00
parent 48b398a45f
commit 112d3cc880
1 changed files with 4 additions and 4 deletions

View File

@ -195,7 +195,7 @@ class TCP_Recreate(object):
if cli: if cli:
sip, sport = self.src sip, sport = self.src
dip, dport = self.dst dip, dport = self.dst
ipid = self.sid ipid = (self.sid & 0xffff)
self.sid += 1 self.sid += 1
seq = self.sseq seq = self.sseq
self.sseq += len(payload) self.sseq += len(payload)
@ -205,7 +205,7 @@ class TCP_Recreate(object):
else: else:
sip, sport = self.dst sip, sport = self.dst
dip, dport = self.src dip, dport = self.src
ipid = self.did ipid = (self.did & 0xffff)
self.did += 1 self.did += 1
seq = self.dseq seq = self.dseq
self.dseq += len(payload) self.dseq += len(payload)
@ -749,7 +749,7 @@ class Session(object):
return return
def open_out(self, fn): def open_out(self, fn, text=True):
frame = self.firstframe frame = self.firstframe
fn = '%d-%s~%d-%s~%d---%s' % (frame.time, fn = '%d-%s~%d-%s~%d---%s' % (frame.time,
frame.src_addr, frame.sport, frame.src_addr, frame.sport,
@ -758,7 +758,7 @@ class Session(object):
fullfn = os.path.join(self.basename, fn) fullfn = os.path.join(self.basename, fn)
fullfn2 = os.path.join(self.basename2, fn) fullfn2 = os.path.join(self.basename2, fn)
print ' writing %s' % (fn,) print ' writing %s' % (fn,)
fd = file(fullfn, 'w') fd = file(fullfn, 'w' if text else 'wb')
try: try:
os.unlink(fullfn2) os.unlink(fullfn2)
except OSError: except OSError: