Skip to content

Commit 0fb4403

Browse files
committed
fix for an issue where whitewashing doesn't work (issue #168)
1 parent fe6e345 commit 0fb4403

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

lib/exploitation/exploiter.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,22 @@ def whitelist_wash(hosts, whitelist_file):
1616
"""
1717
remove IPs from hosts list that do not appear in WHITELIST_FILE
1818
"""
19-
whitelist_hosts = [x.strip() for x in open(whitelist_file).readlines() if x.strip()]
20-
lib.output.info('Found {} entries in whitelist.txt, scrubbing'.format(str(len(whitelist_hosts))))
21-
washed_hosts = []
22-
# return supplied hosts if whitelist file is empty
23-
if len(whitelist_hosts) == 0:
24-
return hosts
25-
else:
26-
for host in hosts:
27-
if host.strip() in whitelist_hosts:
28-
washed_hosts.append(host)
19+
try:
20+
whitelist_hosts = [x.strip() for x in open(whitelist_file).readlines() if x.strip()]
21+
lib.output.info('Found {} entries in whitelist.txt, scrubbing'.format(str(len(whitelist_hosts))))
22+
washed_hosts = []
23+
# return supplied hosts if whitelist file is empty
24+
if len(whitelist_hosts) == 0:
25+
return hosts
26+
else:
27+
for host in hosts:
28+
if host.strip() in whitelist_hosts:
29+
washed_hosts.append(host)
2930

30-
return washed_hosts
31+
return washed_hosts
32+
except Exception:
33+
lib.output.warning("unable to whitewash host list, does the file exist?")
34+
return hosts
3135

3236

3337
class AutoSploitExploiter(object):

0 commit comments

Comments
 (0)