色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

python 實現的IP 存活掃描腳本

瀏覽:3日期:2022-07-02 15:34:11
下載地址

ActiveOrNot

用于處理 oneforall 等子域名掃描工具的結果去重 + 主機存活掃描

參數

-f --file 指定存放ip或子域名的文件,默認 ip.txt-t --thread 設置線程數,默認 50python3 ActiveOrNot.py -f ip.txt -t 12具體代碼 ActiveOrNot.py

from threading import Threadfrom queue import Queueimport requestsfrom time import timeimport argparseheaders = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'}def ping(url, new_ip): url = url.strip() if (not url.startswith(’http://’)) and (not url.startswith(’https://’)): url = ’http://’ + url try: req = requests.get(url, headers=headers, timeout=2) new_ip.put(url + ’ -- ’ + str(req.status_code)) print('%s 存活' % url) except: print('%s 不存活' % url)def new_list(file): with open(file, ’r’) as f: new_ip = [] ip_list = f.readlines() for ip in ip_list: ip = ip.strip().replace(’http://’, ’’).replace(’https://’, ’’) if ip: if not (ip in new_ip): new_ip.append(ip) return new_ipdef main(file, th): begin_time = time() new_ip = Queue() ip_list = new_list(file) j = 0 length = len(ip_list) while j < length: threads = [] for i in range(th): t = Thread(target=ping, args=(ip_list[j], new_ip)) t.start() threads.append(t) j += 1 if j == length: break for thread in threads: thread.join() with open(’NewIP.txt’, ’a+’) as nf: while not new_ip.empty(): nf.write(new_ip.get()+’n’) end_time = time() run_time = end_time - begin_time print('總共耗時 %s 秒'% run_time)if __name__ == ’__main__’: parser = argparse.ArgumentParser(description=’url active scan’) parser.add_argument('-f', '--file', help='指定文件', default=’ip.txt’) parser.add_argument('-t', '--thread', help='設置線程', default=50) args = parser.parse_args() file = args.file th = args.thread main(file, th)

以上就是python 實現的IP 存活掃描腳本的詳細內容,更多關于python ip存活掃描的資料請關注好吧啦網其它相關文章!

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 爱呦视频在线播放网址 | 国产精品视频永久免费播放 | 亚洲一区二区三区免费看 | 色综合a怡红院怡红院首页 色综合精品久久久久久久 色综合九九 | 最新国产三级久久 | 国产日韩一区二区三区在线播放 | 最刺激黄a大片免费网站 | 日韩亚洲成a人片在线观看 日韩亚洲精品不卡在线 | 亚洲精品成人久久 | 99久久99热精品免费观看国产 | 国产性大片黄在线观看在线放 | 国产精品成人免费视频不卡 | 在线国产网站 | 日本美女黄色一级片 | 美国的毛片免费的 | 国产精品一在线观看 | 国产成人精品曰本亚洲 | 中国一级性生活片 | 九九精品视频一区在线 | 手机黄色网址 | 久久久免费视频观看 | 亚洲视频在线播放 | 日韩国产精品欧美一区二区 | 日本高清视频www夜色资源 | 亚洲免费播放 | 成人免费观看网欧美片 | 日韩中文字幕在线观看视频 | 欧美兽皇video | 天堂一区二区在线观看 | 在线观看视频中文字幕 | 高清欧美一级在线观看 | 男女在线视频 | 精品久久国产老人久久综合 | 成人久久18免费网站游戏 | 男女视频免费在线观看 | a免费网站 | 国产精品永久免费自在线观看 | 日韩一区二区三区在线视频 | 久草5| 欧美国产日韩在线 | 久久手机免费视频 |