MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _parse_ifconfig

Function _parse_ifconfig

pager_lib/getmac/getmac.py:913–924  ·  view source on GitHub ↗
(iface, command_output)

Source from the content-addressed store, hash-verified

911
912
913def _parse_ifconfig(iface, command_output):
914 # type: (str, str) -> Optional[str]
915 if not iface or not command_output:
916 return None
917
918 # Sanity check on input e.g. if user does "eth0:" as argument
919 iface = iface.strip(":")
920
921 # "(?:^|\s)": prevent an input of "h0" from matching on "eth0"
922 search_re = r"(?:^|\s)" + iface + IFCONFIG_REGEX
923
924 return _search(search_re, command_output, flags=re.DOTALL)
925
926
927class IfconfigWithIfaceArg(Method):

Callers 2

getMethod · 0.85
getMethod · 0.85

Calls 1

_searchFunction · 0.85

Tested by

no test coverage detected