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

Function sr1flood

scapy/sendrecv.py:991–1027  ·  view source on GitHub ↗

Flood and receive packets at layer 3 and return only the first answer This determines the interface (or L2 source to use) based on the routing table: conf.route / conf.route6 :param prn: function applied to packets received :param verbose: set verbosity level :param nofil

(x,  # type: _PacketIterable
             promisc=None,  # type: Optional[bool]
             filter=None,  # type: Optional[str]
             nofilter=0,  # type: int
             *args,  # type: Any
             **kargs  # type: Any
             )

Source from the content-addressed store, hash-verified

989
990@conf.commands.register
991def sr1flood(x, # type: _PacketIterable
992 promisc=None, # type: Optional[bool]
993 filter=None, # type: Optional[str]
994 nofilter=0, # type: int
995 *args, # type: Any
996 **kargs # type: Any
997 ):
998 # type: (...) -> Optional[Packet]
999 """Flood and receive packets at layer 3 and return only the first answer
1000
1001 This determines the interface (or L2 source to use) based on the routing
1002 table: conf.route / conf.route6
1003
1004 :param prn: function applied to packets received
1005 :param verbose: set verbosity level
1006 :param nofilter: put 1 to avoid use of BPF filters
1007 :param filter: provide a BPF filter
1008 :param iface: listen answers only on the given interface
1009 """
1010 if "iface" in kargs:
1011 # Warn that it isn't used.
1012 warnings.warn(
1013 "'iface' has no effect on L3 I/O sr1flood(). For multicast/link-local "
1014 "see https://scapy.readthedocs.io/en/latest/usage.html#multicast",
1015 SyntaxWarning,
1016 )
1017 del kargs["iface"]
1018 iface, ipv6 = _interface_selection(x)
1019 s = iface.l3socket(ipv6)(
1020 promisc=promisc, filter=filter,
1021 nofilter=nofilter, iface=iface,
1022 )
1023 ans, _ = sndrcvflood(s, x, *args, **kargs)
1024 s.close()
1025 if len(ans) > 0:
1026 return cast(Packet, ans[0][1])
1027 return None
1028
1029
1030@conf.commands.register

Callers

nothing calls this directly

Calls 4

_interface_selectionFunction · 0.85
sndrcvfloodFunction · 0.85
l3socketMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected