python线程检测网段脚本!
生活随笔
收集整理的這篇文章主要介紹了
python线程检测网段脚本!
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#!/usr/bin/python
#coding:utf-8
import subprocess? //調用shell命令的一個模塊
import threading? //導入線程模塊
def myping(ip):
??? s=subprocess.call('ping -c2 -i0.1 -W1 %s &>/dev/null' %ip,shell=True)
??? if s==0:
?????? print "%s is up" %ip
?? else:
?????? print "%s is down" %ip
net=['176.130.3.%d' %i for i in range(1,255)]
for i in net:
t=threading.Thread(target=myping,args=[i])
t.start()
?
轉載于:https://www.cnblogs.com/yunsshcy/p/8632912.html
總結
以上是生活随笔為你收集整理的python线程检测网段脚本!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Vue组件基础知识总结
- 下一篇: hibernate一对多关联映射