Little Python script to dump IP addresses from a file
#!/usr/bin/python3 | |
import sys, re | |
f = open(sys.argv[1],'r') | |
text = f.read() | |
ips = [] | |
regex = re.findall(r'\b(?:\d{1,3}\.){3}\d{1,3}\b',text) | |
if regex is not None: | |
for match in regex: | |
if match not in ips: | |
ips.append(match) | |
print(match) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment