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

Method load

scapy/libs/extcap.py:185–213  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

183 super(_ExtcapInterfaceProvider, self).__init__(*args, **kwargs)
184
185 def load(self) -> Dict[str, NetworkInterface]:
186 data: Dict[str, NetworkInterface] = {}
187 try:
188 interfaces = _extcap_call(
189 self.cmdprog,
190 ["--extcap-interfaces"],
191 {"interface": ["value", "display"]},
192 )["interface"]
193 except OSError as ex:
194 warning(
195 "extcap %s failed to load: %s",
196 self.name,
197 str(ex).strip().split("\n")[-1]
198 )
199 return {}
200 for netw_name, name in interfaces:
201 _index = re.search(r".*(\d+)", name)
202 if _index:
203 index = int(_index.group(1)) + 100
204 else:
205 index = 100
206 if_data = {
207 "name": name,
208 "network_name": netw_name,
209 "description": name,
210 "index": index,
211 }
212 data[netw_name] = _ExtcapNetworkInterface(self, if_data)
213 return data
214
215 def _l2listen(self, _: Any) -> Type[SuperSocket]:
216 return functools.partial(_ExtcapSocket, cmdprog=self.cmdprog) # type: ignore

Callers

nothing calls this directly

Calls 4

warningFunction · 0.90
_extcap_callFunction · 0.85
searchMethod · 0.45

Tested by

no test coverage detected