最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python實(shí)現(xiàn)掃描ip地址的小程序

 更新時(shí)間:2019年04月16日 10:41:01   作者:Fresh-eyes  
本文通過(guò)實(shí)例代碼給大家介紹了python實(shí)現(xiàn)掃描ip地址的小程序,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧

python實(shí)現(xiàn)掃描ip地址的小程序,具體代碼如下所示:

import os,time
import sys
start_Time=int(time.time())
ip_True = open('ip_True.txt','w+')
ip_False = open('ip_False.txt','w+')
IPhost = []
IPbegin = (input(u'請(qǐng)輸入起始查詢IP: '))
IPend = input(u'請(qǐng)輸入終止查詢IP: ')
IP1 = IPbegin.split('.')[0]
IP2 = IPbegin.split('.')[1]
IP3 = IPbegin.split('.')[2]
IP4 = IPbegin.split('.')[-1]
IPend_last = IPend.split('.')[-1]
count_True,count_False = 0,0
for i in range(int(IP4)-1,int(IPend_last)):
  ip = str(IP1+'.'+IP2+'.'+IP3+'.'+IP4)
  int_IP4 = int(IP4)
  int_IP4 += 1
  IP4 = str(int_IP4)
  return1=os.system('ping -n 1 -w 1 %s'%ip)
  if return1:
    print('ping %s is fail'%ip)
    ip_False.write(ip+'\n')
    count_False += 1
  else:
    print('ping %s is ok'%ip)
    ip_True.write(ip+'\n')
    count_True += 1
ip_True.close()
ip_False.close()
end_Time = int(time.time())
print("time(秒):",end_Time - start_Time,"s")
print("ping通的ip數(shù):",count_True,"  ping不通的ip數(shù):",count_False)

總結(jié)

以上所述是小編給大家介紹的python實(shí)現(xiàn)掃描ip地址的小程序,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

最新評(píng)論

香港| 鄂尔多斯市| 开江县| 乐平市| 翼城县| 祁连县| 剑阁县| 启东市| 昭平县| 汽车| 芜湖县| 洪江市| 阿图什市| 乐陵市| 河池市| 天柱县| 定安县| 永宁县| 定日县| 长沙市| 九龙坡区| 中西区| 临泽县| 北碚区| 八宿县| 营山县| 阜阳市| 通州市| 民勤县| 鲁山县| 东乌珠穆沁旗| 安西县| 深圳市| 临汾市| 绵阳市| 颍上县| 清苑县| 获嘉县| 绵阳市| 松阳县| 宜兰市|