#!/usr/bin/env python3
import os
import threading
file=open('/root/Desktop/out.txt','a')
def ping_test(ip):
"this is a ping test!"
data=os.system("ping -c1 -i0.1 %s 1>/dev/null 2>/dev/null" %ip)
if data == 1:
file.write("the ip %s is up\n" %ip)
file.flush()
else:
file.write("the ip %s is down\n" %ip)
file.flush()
networkid=input("please input a ip e.g:x.x.x.:")
for i in range(1,255):
ip=networkid+str(i)
t=threading.Thread(target=ping_test,args=(ip,))
t.start()