ping script

Drew Fisher fisherar at colorado.edu
Mon Oct 4 17:05:34 EDT 1999


Sean wrote:
> 
> I am a newbie to python. Any ideas on how to create a script to ping a class
> c block and maybe resolve the names to DNS.
> 
>                     Thanks

What if you were to try this?  I'm kinda new to Python myself, so please
excuse any errors :)
import os
import socket

BASEIP = '100.100.100.'
for i in range (255):
	FULLIP = BASEIP + str(i)
	if (os.system ('ping ' + FULLIP) == 0):
		socket.gethostbyaddr (FULLIP)




More information about the Python-list mailing list