MCPcopy Create free account
hub / github.com/secdev/scapy / load_extcap

Function load_extcap

scapy/libs/extcap.py:234–258  ·  view source on GitHub ↗

Load extcap folder from wireshark and populate Scapy's providers. Additional interfaces should appear in conf.ifaces.

()

Source from the content-addressed store, hash-verified

232
233
234def load_extcap() -> None:
235 """
236 Load extcap folder from wireshark and populate Scapy's providers.
237
238 Additional interfaces should appear in conf.ifaces.
239 """
240 if WINDOWS:
241 pattern = re.compile(r"^[^.]+(?:\.bat|\.exe)?$")
242 else:
243 pattern = re.compile(r"^[^.]+(?:\.sh)?$")
244 for fld in conf.prog.extcap_folders:
245 root = pathlib.Path(fld)
246 for _cmdprog in root.glob("*"):
247 if not _cmdprog.is_file() or not pattern.match(_cmdprog.name):
248 continue
249 cmdprog = str((root / _cmdprog).absolute())
250 # success
251 provname = pathlib.Path(cmdprog).name.rsplit(".", 1)[0]
252
253 class _prov(_ExtcapInterfaceProvider):
254 name = provname
255
256 conf.ifaces.register_provider(
257 functools.partial(_prov, cmdprog=cmdprog) # type: ignore
258 )

Callers

nothing calls this directly

Calls 1

register_providerMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…