MCPcopy Index your code
hub / github.com/secdev/scapy / IPSession

Class IPSession

scapy/sessions.py:66–84  ·  view source on GitHub ↗

Defragment IP packets 'on-the-flow'. Usage: >>> sniff(session=IPSession)

Source from the content-addressed store, hash-verified

64
65
66class IPSession(DefaultSession):
67 """Defragment IP packets 'on-the-flow'.
68
69 Usage:
70 >>> sniff(session=IPSession)
71 """
72
73 def __init__(self, *args, **kwargs):
74 # type: (*Any, **Any) -> None
75 DefaultSession.__init__(self, *args, **kwargs)
76 self.fragments = defaultdict(list) # type: DefaultDict[Tuple[Any, ...], List[Packet]] # noqa: E501
77
78 def process(self, packet: Packet) -> Optional[Packet]:
79 from scapy.layers.inet import IP, _defrag_ip_pkt
80 if not packet:
81 return None
82 if IP not in packet:
83 return packet
84 return _defrag_ip_pkt(packet, self.fragments)[1] # type: ignore
85
86
87class StringBuffer(object):

Callers 2

parse_argsMethod · 0.90
parse_argsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected