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

Method __init__

scapy/supersocket.py:325–355  ·  view source on GitHub ↗
(self,
                     type=ETH_P_IP,  # type: int
                     filter=None,  # type: Optional[str]
                     iface=None,  # type: Optional[_GlobInterfaceType]
                     promisc=None,  # type: Optional[bool]
                     nofilter=0  # type: int
                     )

Source from the content-addressed store, hash-verified

323 desc = "Layer 3 using Raw sockets (PF_INET/SOCK_RAW)"
324
325 def __init__(self,
326 type=ETH_P_IP, # type: int
327 filter=None, # type: Optional[str]
328 iface=None, # type: Optional[_GlobInterfaceType]
329 promisc=None, # type: Optional[bool]
330 nofilter=0 # type: int
331 ):
332 # type: (...) -> None
333 self.outs = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW) # noqa: E501
334 self.outs.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1)
335 self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type)) # noqa: E501
336 if iface is not None:
337 iface = network_name(iface)
338 self.iface = iface
339 self.ins.bind((iface, type))
340 else:
341 self.iface = "any"
342 try:
343 # Receive Auxiliary Data (VLAN tags)
344 self.ins.setsockopt(SOL_PACKET, PACKET_AUXDATA, 1)
345 self.ins.setsockopt(
346 socket.SOL_SOCKET,
347 SO_TIMESTAMPNS,
348 1
349 )
350 self.auxdata_available = True
351 except OSError:
352 # Note: Auxiliary Data is only supported since
353 # Linux 2.6.21
354 msg = "Your Linux Kernel does not support Auxiliary Data!"
355 log_runtime.info(msg)
356
357 def recv(self, x=MTU, **kwargs):
358 # type: (int, **Any) -> Optional[Packet]

Callers

nothing calls this directly

Calls 2

network_nameFunction · 0.90
bindMethod · 0.45

Tested by

no test coverage detected