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

Function resolve_iface

scapy/interfaces.py:419–437  ·  view source on GitHub ↗

Resolve an interface name into the interface

(dev, retry=True)

Source from the content-addressed store, hash-verified

417
418
419def resolve_iface(dev, retry=True):
420 # type: (_GlobInterfaceType, bool) -> NetworkInterface
421 """
422 Resolve an interface name into the interface
423 """
424 if isinstance(dev, NetworkInterface):
425 return dev
426 try:
427 return conf.ifaces.dev_from_name(dev)
428 except ValueError:
429 try:
430 return conf.ifaces.dev_from_networkname(dev)
431 except ValueError:
432 pass
433 if not retry:
434 raise ValueError("Interface '%s' not found !" % dev)
435 # Nothing found yet. Reload to detect if it was added recently
436 conf.ifaces.reload()
437 return resolve_iface(dev, retry=False)
438
439
440def network_name(dev):

Callers 15

_iface_changerFunction · 0.90
__repr__Method · 0.90
ScopedIPFunction · 0.90
_sendFunction · 0.90
_interface_selectionFunction · 0.90
srpFunction · 0.90
srpfloodFunction · 0.90
srp1floodFunction · 0.90
_runMethod · 0.90
_init_socketFunction · 0.90
__repr__Method · 0.90
get_if_hwaddrFunction · 0.90

Calls 3

dev_from_nameMethod · 0.80
dev_from_networknameMethod · 0.80
reloadMethod · 0.45

Tested by

no test coverage detected