Remove unused `get_ip_for_connection()` in `infection_monkey/network/info.py`

This commit is contained in:
Shreya 2021-05-04 17:17:51 +05:30
parent b7535dccb0
commit 6cc22afd9b
1 changed files with 0 additions and 19 deletions

View File

@ -157,22 +157,3 @@ def get_interfaces_ranges():
# limit subnet scans to class C only # limit subnet scans to class C only
res.append(CidrRange(cidr_range="%s/%s" % (address_str, netmask_str))) res.append(CidrRange(cidr_range="%s/%s" % (address_str, netmask_str)))
return res return res
if is_windows_os():
def get_ip_for_connection(target_ip):
return None
else:
def get_ip_for_connection(target_ip):
try:
query_str = "ip route get %s" % target_ip
resp = check_output(query_str.split())
substr = resp.split()
src = substr[substr.index("src") + 1]
return src
except Exception:
return None