salawank

regex_ip.py

Aug 5th, 2013
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python -tt
  2.  
  3. import re
  4.  
  5. f = open('data.txt', 'r')
  6.  
  7. ip_raw = re.findall(r'(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)', f.read())
  8.  
  9. ip = '\n'.join(set(ip_raw))
  10. print ip
RAW Paste Data