Skip to content

Instantly share code, notes, and snippets.

@fo0nikens
Forked from hakluke/grepips.py
Created January 4, 2020 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fo0nikens/6cb0bf5832116e3a7206a6c2ff068162 to your computer and use it in GitHub Desktop.
Save fo0nikens/6cb0bf5832116e3a7206a6c2ff068162 to your computer and use it in GitHub Desktop.
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