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

Method load

scapy/arch/libpcap.py:465–495  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

463 libpcap = True
464
465 def load(self):
466 # type: () -> Dict[str, NetworkInterface]
467 if not conf.use_pcap or WINDOWS:
468 return {}
469 if not conf.cache_pcapiflist:
470 load_winpcapy()
471 data = {}
472 i = 0
473 for ifname, dat in conf.cache_pcapiflist.items():
474 description, ips, flags, mac, itype = dat
475 i += 1
476 if LINUX or BSD or SOLARIS and not mac:
477 from scapy.arch.unix import get_if_raw_hwaddr
478 try:
479 itype, _mac = get_if_raw_hwaddr(ifname)
480 mac = str2mac(_mac)
481 except Exception:
482 # There are at least 3 different possible exceptions
483 mac = "00:00:00:00:00:00"
484 if_data = {
485 'name': ifname,
486 'description': description or ifname,
487 'network_name': ifname,
488 'index': i,
489 'mac': mac,
490 'type': itype,
491 'ips': ips,
492 'flags': flags
493 }
494 data[ifname] = NetworkInterface(self, if_data)
495 return data
496
497 def reload(self):
498 # type: () -> Dict[str, NetworkInterface]

Callers 2

reloadMethod · 0.95
parse_config_fileFunction · 0.45

Calls 5

load_winpcapyFunction · 0.90
get_if_raw_hwaddrFunction · 0.90
str2macFunction · 0.90
NetworkInterfaceClass · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected