1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-02 11:36:22 +01:00

fix route parsing on macOS 10.13 and lower

This commit is contained in:
Tim W 2021-03-19 20:03:27 +00:00
parent a612d32da4
commit adb7ee62af

View File

@ -1839,6 +1839,7 @@ def stdapi_net_config_get_routes_via_osx_netstat():
routes = []
state = None
has_refs = None
for line in output.split('\n'):
line = line.strip()
if state is None:
@ -1850,10 +1851,15 @@ def stdapi_net_config_get_routes_via_osx_netstat():
words = line.split()
if len(words) < 4:
state = None
has_refs = None
continue
if words[0].lower() == 'destination':
if len(words) > 5 and words[3].lower() == 'refs':
has_refs = True
continue
destination, gateway, flags, iface = words[:4]
if has_refs:
iface = words[5]
if state == socket.AF_INET:
all_nets = '0.0.0.0/0'
bits = 32