mirror of https://github.com/dirtbags/netarch.git
Another TCP Resequencer fix
This commit is contained in:
parent
61da8aeb8b
commit
d8f1c6f989
10
__init__.py
10
__init__.py
|
@ -213,9 +213,15 @@ def pp(value, bits=16):
|
||||||
##
|
##
|
||||||
## Codecs
|
## Codecs
|
||||||
##
|
##
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
from __init__ import BitVector
|
import string
|
||||||
|
|
||||||
|
b64alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
|
||||||
|
|
||||||
|
def from_b64(s, alphabet, codec='base64'):
|
||||||
|
tr = string.maketrans(alphabet, b64alpha)
|
||||||
|
t = s.translate(tr)
|
||||||
|
return t.decode(codec)
|
||||||
|
|
||||||
class Esab64Codec(codecs.Codec):
|
class Esab64Codec(codecs.Codec):
|
||||||
"""Little-endian version of base64."""
|
"""Little-endian version of base64."""
|
||||||
|
|
10
ip.py
10
ip.py
|
@ -276,7 +276,8 @@ class TCP_Resequence:
|
||||||
del pending[key]
|
del pending[key]
|
||||||
if frame.flags & (FIN | RST):
|
if frame.flags & (FIN | RST):
|
||||||
seq += 1
|
seq += 1
|
||||||
self.closed[idx] = True
|
if frame.flags & (FIN | ACK) == FIN | ACK:
|
||||||
|
self.closed[xdi] = True
|
||||||
if self.closed == [True, True]:
|
if self.closed == [True, True]:
|
||||||
self.handle = self.handle_drop
|
self.handle = self.handle_drop
|
||||||
if seq != pkt.ack:
|
if seq != pkt.ack:
|
||||||
|
@ -288,8 +289,15 @@ class TCP_Resequence:
|
||||||
def handle_drop(self, pkt):
|
def handle_drop(self, pkt):
|
||||||
"""Warn about any unhandled packets"""
|
"""Warn about any unhandled packets"""
|
||||||
|
|
||||||
|
if pkt.flags & SYN:
|
||||||
|
# Re-using ports!
|
||||||
|
self.__init__()
|
||||||
|
return self.handle(pkt)
|
||||||
|
|
||||||
if pkt.payload:
|
if pkt.payload:
|
||||||
warnings.warn('Spurious frame after shutdown: %r %d' % (pkt, pkt.flags))
|
warnings.warn('Spurious frame after shutdown: %r %d' % (pkt, pkt.flags))
|
||||||
|
hexdump(pkt.payload)
|
||||||
|
merf
|
||||||
|
|
||||||
|
|
||||||
class Dispatch:
|
class Dispatch:
|
||||||
|
|
Loading…
Reference in New Issue