This script should just be writing every possibly IP (yea, there are billions i know blah blah) to a txt file. Instead of just writing the IP, it continues and the number goes past 4 groups. IE: The possible IP keeps getting 3 characters longer every time. And at the end of the last loops do I somehow have to set my mySet to NULL? Any ideas here?
--
edward hotchkiss
--
edward hotchkiss
# Script to Evaluate every possible IP Address Combo, then write it to a text file
# 9/15/05
# ipFileLocation = r"G:\Python\myCode\IPList.txt"
ipFileLocation = "IPList.txt"
ipFile = open(ipFileLocation, 'w')
def findIPs():
for num in range(256):
mySet = "%03.d" % num
for num in range(256):
mySet = mySet + "." + "%03.d" % num
for num in range(256):
mySet = mySet + "." + "%03.d" % num
for num in range(256):
mySet = mySet + "." + "%03.d" % num
ipFile.write(mySet+"\n")
findIPs()
ipFile.close()
# Script to Evaluate every possible IP Address Combo, then write it to a text file # 9/15/05
# ipFileLocation = r"G:\Python\myCode\IPList.txt" ipFileLocation = "IPList.txt" ipFile = open(ipFileLocation, 'w') def findIPs(): for num in range(256): mySet = "%03.d" % num for num in range(256): mySet = mySet + "." + "%03.d" % num for num in range(256): mySet = mySet + "." + "%03.d" % num for num in range(256): mySet = mySet + "." + "%03.d" % num ipFile.write(mySet+"\n") findIPs() ipFile.close()
-- http://mail.python.org/mailman/listinfo/python-list