import argparse
import requests
from concurrent.futures import threadpoolexecutor
from multiprocessing import cpu_count
from fake_useragent import useragent
from threading import lock
def read_file():
""" 讀取撞庫檔案 """
with open(file=args.scan_dict, mode='r', encoding='utf-8') as f:
return f.readlines()
def write_file(content):
""" 將撞庫成功的url寫入到檔案中 """
lock = lock()
lock.acquire()
with open(file=args.scan_output, mode='a', encoding='utf-8') as f:
f.write(content)
lock.release()
def send_msg(line):
""" 整理url並傳送請求 """
# 開啟執行緒池,讀取任務列表
# 任務列表:撞庫檔案
t = threadpoolexecutor(args.thread_num)
for i in read_file():
t.submit(send_msg, i)
ifname== 'main':
parse = argparse.argumentparser()
parse.add_argument('--site', dest='scan_site', help='要掃瞄的伺服器', type=str)
parse.add_argument('--dict', dest='scan_dict', help="撞庫檔案", default='webdict.txt', type=str)
parse.add_argument('--output', dest='scan_output', help="儲存撞庫成功的路徑", default='./output.txt', type=str)
parse.add_argument('--thread', dest='thread_num', help='設定執行緒數量', default=cpu_count() * 5, type=int)
args = parse.parse_args()
run()
"""
d:\dazhu\python.toos\note>python "09 web目錄掃瞄.py" --site www.7k7k.com
"""
Python 掃瞄目錄
def scandir file list,proc parent path,md5 list,err list for root,dirs,files in os.walk proc parent path for file name in files file path os.path.join...
web敏感目錄掃瞄器 python編寫
之前寫了乙個埠掃瞄器 但是還有很多的模組沒有做好,因為只是tcp全掃瞄的,如果是遇到了防火牆就沒有辦法了,而且就算掃出了存在的埠也會在對方伺服器上留下大量的痕跡,所以後面有空我會把它優化和擴充功能 coding utf 8 import requests from threading import ...
Python 簡易的目錄掃瞄工具
思路如下 1.讀取字典檔案,拼接url 2.http get請求url 3.判斷狀態碼,輸出存在目錄 相關 import requests 匯入request模組,request模組是用來發起http請求 import requests url變數設定需要掃瞄的url url with後面接的物件返...