最新国产好看的视频,伊人天堂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)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

相關(guān)文章

最新評(píng)論

富蕴县| 灌云县| 宝兴县| 乾安县| 南平市| 德钦县| 图们市| 岗巴县| 达州市| 右玉县| 蒙城县| 永城市| 堆龙德庆县| 罗江县| 镇坪县| 土默特左旗| 乌拉特后旗| 京山县| 昭平县| 星子县| 渝中区| 白河县| 马关县| 平泉县| 普兰县| 德庆县| 集贤县| 溧阳市| 吉木乃县| 常州市| 武川县| 弥勒县| 平江县| 方山县| 富源县| 虞城县| 青海省| 神农架林区| 宁南县| 晋州市| 长泰县|