import subprocess
import os
import time
def ping(host):
rc=subprocess.call('ping -c2 %s &> /dev/null' % host,shell=True)
if rc == 0:
print('%s:up'% host)
else:
print('%s:down'% host)
if __name__ == '__main__':
ips=['176.130.10.%s' % i for i in range(1,255)]
for i in ips:
pid=os.fork()
if pid==0:
ping(i)
exit(0)
python并发扫描存活主机
猜你喜欢
转载自blog.csdn.net/cron_zzx/article/details/88989370
今日推荐
周排行