How I would like this program to function:
I would like this app to be able to randomly select from a series of IP Addresses then attempt to make a connection to one then disconnect and attempt to make a connection to another one
But I want it to use random time outs so as not to be detected while probing I have written the code so it will randomly select from a list of ips and make a connection.
I can figure the random timeouts out part I am sure
but I am having troubles looping through connections it connects once then fails to connect again to another ip
My Code is as Follows
Anyhelp would be appreciated
Code: Select all
import socket, random
PORT = 80
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Test Sites
num = ("www.hotscripts.com", "www.ninjutsu.com", "www.canada.ca", "www.intel.com", "www.mytelus.com",
"www.bravo.com", "www.winjutsu.com", "www.microsoft.com", "www.mukashikaigan.com", "www.engrooved.ca"
)
# loop through
for address in range(10):
rand = random.choice(num)
sock.connect((rand, PORT))
print "connected to", rand
sock.close()
Please let me know if this is not the right web site to post this kind of question