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

Method send

scapy/arch/libpcap.py:647–678  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

645 return r
646
647 def send(self, x):
648 # type: (Packet) -> int
649 # Select the file descriptor to send the packet on.
650 iff = x.route()[0]
651 if iff is None:
652 iff = network_name(conf.iface)
653 type_x = type(x)
654 if iff not in self.send_socks:
655 self.send_socks[iff] = L3pcapSocket(
656 iface=iff,
657 type=self.type,
658 filter=self.filter,
659 promisc=self.promisc,
660 monitor=self.monitor,
661 )
662 sock = self.send_socks[iff]
663 fd = sock.pcap_fd
664 if sock.lvl == 3:
665 if not issubclass(sock.LL, type_x):
666 warning("Incompatible L3 types detected using %s instead of %s !",
667 type_x, sock.LL)
668 sock.LL = type_x
669 if sock.lvl == 2:
670 sx = bytes(sock.LL() / x)
671 else:
672 sx = bytes(x)
673 # Now send.
674 try:
675 x.sent_time = time.time()
676 except AttributeError:
677 pass
678 return fd.send(sx)
679
680 @staticmethod
681 def select(sockets, remain=None):

Callers

nothing calls this directly

Calls 5

network_nameFunction · 0.90
warningFunction · 0.90
L3pcapSocketClass · 0.85
routeMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected