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

Function fingerprint_mtu

scapy/modules/p0f.py:677–698  ·  view source on GitHub ↗

Fingerprints the MTU based on the maximum segment size specified in TCP options. If a match was found, returns the label. If not returns None

(pkt)

Source from the content-addressed store, hash-verified

675
676
677def fingerprint_mtu(pkt):
678 """
679 Fingerprints the MTU based on the maximum segment size specified
680 in TCP options.
681 If a match was found, returns the label. If not returns None
682 """
683 pkt = validate_packet(pkt)
684 mss = 0
685 for name, value in pkt.payload.options:
686 if name == "MSS":
687 mss = value
688
689 if not mss:
690 return None
691
692 mtu = (mss + MIN_TCP4) if pkt.version == 4 else (mss + MIN_TCP6)
693
694 if not p0fdb.get_base():
695 warning("p0f base empty.")
696 return None
697
698 return p0fdb.mtu_find_match(mtu)
699
700
701def p0f(pkt):

Callers

nothing calls this directly

Calls 4

warningFunction · 0.90
validate_packetFunction · 0.85
mtu_find_matchMethod · 0.80
get_baseMethod · 0.45

Tested by

no test coverage detected