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

Function validate_packet

scapy/modules/p0f.py:604–613  ·  view source on GitHub ↗

Validate that the packet is an IPv4/IPv6 and TCP packet. If the packet is valid, a copy is returned. If not, TypeError is raised.

(pkt)

Source from the content-addressed store, hash-verified

602
603
604def validate_packet(pkt):
605 """
606 Validate that the packet is an IPv4/IPv6 and TCP packet.
607 If the packet is valid, a copy is returned. If not, TypeError is raised.
608 """
609 pkt = pkt.copy()
610 valid = pkt.haslayer(TCP) and (pkt.haslayer(IP) or pkt.haslayer(IPv6))
611 if not valid:
612 raise TypeError("Not a TCP/IP packet")
613 return pkt
614
615
616def detect_win_multi(ts):

Callers 3

packet2p0fFunction · 0.85
fingerprint_mtuFunction · 0.85
p0f_impersonateFunction · 0.85

Calls 2

copyMethod · 0.45
haslayerMethod · 0.45

Tested by

no test coverage detected