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

Method show

scapy/interfaces.py:331–361  ·  view source on GitHub ↗

Print list of available network interfaces in human readable form :param print_result: print the results if True, else return it :param hidden: if True, also displays invalid interfaces

(self, print_result=True, hidden=False, **kwargs)

Source from the content-addressed store, hash-verified

329 self.data[ifname] = NetworkInterface(InterfaceProvider(), data)
330
331 def show(self, print_result=True, hidden=False, **kwargs):
332 # type: (bool, bool, **Any) -> Optional[str]
333 """
334 Print list of available network interfaces in human readable form
335
336 :param print_result: print the results if True, else return it
337 :param hidden: if True, also displays invalid interfaces
338 """
339 res = defaultdict(list)
340 for iface_name in sorted(self.data):
341 dev = self.data[iface_name]
342 if not hidden and not dev.is_valid():
343 continue
344 prov = dev.provider
345 res[(prov.headers, prov.header_sort)].append(
346 (prov.name,) + prov._format(dev, **kwargs)
347 )
348 output = ""
349 for key in res:
350 hdrs, sortBy = key
351 output += pretty_list(
352 res[key],
353 [("Source",) + hdrs],
354 sortBy=sortBy
355 ) + "\n"
356 output = output[:-1]
357 if print_result:
358 print(output)
359 return None
360 else:
361 return output
362
363 def __repr__(self):
364 # type: () -> str

Callers 2

__repr__Method · 0.95
show_interfacesFunction · 0.45

Calls 4

pretty_listFunction · 0.90
is_validMethod · 0.80
appendMethod · 0.45
_formatMethod · 0.45

Tested by

no test coverage detected