Skip to content

Instantly share code, notes, and snippets.

@geekgonecrazy
Created October 9, 2012 19:48
Show Gist options
  • Save geekgonecrazy/3861005 to your computer and use it in GitHub Desktop.
Save geekgonecrazy/3861005 to your computer and use it in GitHub Desktop.
IP extract
#!/usr/bin/python
###################################
#Author: Aaron Ogle #
#Function: Extract ips from list.#
###################################
import sys
if len(sys.argv) > 1:
try:
file_ips = open(sys.argv[1], "r")
except IOError:
print "File not found"
else:
for line in file_ips:
ip = line.split(':')
print ip[0]
else:
print "No file path specified. \nUsage: python ipextract.py filename"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment