Am I on the right path
Wed Aug 25 19:31:27 CEST 2004
I was just wondering if this code makes sense to anyone. And if I am
writing it correctly, the program seems to keep crashing. I was also
wondering if anyone had any pointers.
The program is supposed to randomly choose an ip address and try and make a
conection on port 80
Cheers to anyone who helps
# GENERATE AND TRY AND CONNECT TO RANDOM IP ADDRESS
import socket, struct, random
RAND = random.random()
PORT = 80
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# These two functions aren't mine
"convert decimal dotted quad string to long integer"
"convert long int to dotted quad string"
# I Think I understand them
HOST = dottedQuadToNum("18.104.22.168")
RAND = random.randrange(HOST)
HOST = numToDottedQuad(RAND)
print "connected to " + HOST + " on",
print "could not connect to " + HOST + " on",
More information about the Python-list