First Script Problem

Ed Hotchkiss edhotchkiss at gmail.com
Fri Sep 16 15:19:02 EDT 2005


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 
     

# 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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050916/6d4b0403/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: IP.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20050916/6d4b0403/attachment.ksh>


More information about the Python-list mailing list