其他分享
首页 > 其他分享> > ping

ping

作者:互联网

import os,threading

ip=input('请输入要检测的ip:').strip().split('.')[0:3]
ip='.'.join(ip)

def detect(i):
    address=ip+'.%s'%i
    res=os.popen('ping -n 2 %s '%address)
    res=''.join(res)
    if res.find('TTL=') != -1:
        print(address)


for i in range(1,255):
    threading.Thread(target=detect,args=(i,)).start()

标签:detect,join,ip,ping,res,address
来源: https://www.cnblogs.com/wangend/p/16685018.html