Am I on the right path

Batista, Facundo FBatista at uniFON.com.ar
Wed Aug 25 14:12:57 EDT 2004


[ADE]

#- The program is supposed to randomly choose an ip address and 
#- try and make a
#- conection on port 80

You can generate random IP like this, also:

>>> import random
>>> '.'.join([str(random.randint(0,255)) for x in range(4)])
'168.240.211.252'
>>> '.'.join([str(random.randint(0,255)) for x in range(4)])
'161.236.51.72'
>>> '.'.join([str(random.randint(0,255)) for x in range(4)])
'160.93.77.108'
>>> '.'.join([str(random.randint(0,255)) for x in range(4)])
'4.109.242.174'
>>> '.'.join([str(random.randint(0,255)) for x in range(4)])
'227.21.50.119'

.	Facundo



More information about the Python-list mailing list