Added compatibility with Nmap-like comments in target files.
Nmap allows comments after the IP / hostname using #. Added the ability to detect and strip out these comments instead of failing. Closes #101
This commit is contained in:
parent
62db07d099
commit
f629f1ca18
|
@ -1535,7 +1535,11 @@ async def main():
|
||||||
lines = f.read()
|
lines = f.read()
|
||||||
for line in lines.splitlines():
|
for line in lines.splitlines():
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.startswith('#') or len(line) == 0: continue
|
if line.startswith('#'): continue
|
||||||
|
match = re.match('([^#]+)#', line)
|
||||||
|
if match:
|
||||||
|
line = match.group(1).strip()
|
||||||
|
if len(line) == 0: continue
|
||||||
if line not in raw_targets:
|
if line not in raw_targets:
|
||||||
raw_targets.append(line)
|
raw_targets.append(line)
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|
Loading…
Reference in New Issue