import subprocess
def ping(hostname):
output = subprocess.Popen(["ping.exe", hostname, "-n", "1"], stdout = subprocess.PIPE).communicate()[0]
txt = output.decode('ascii')
return txt
for i in range(140, 200):
hostname = "10.1.10." + str(i)
output = ping(hostname)
print(hostname, 'unreachable'
not in output)
沒有留言:
張貼留言