-
-
Save fo0nikens/6cb0bf5832116e3a7206a6c2ff068162 to your computer and use it in GitHub Desktop.
Little Python script to dump IP addresses from a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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