Python3 – 編寫web目錄掃描工具
- 2020 年 3 月 10 日
- 筆記
溫馨提示:請勿用於非授權測試,人在做天在看
聲明:本腳本程式完全學習交流共享,請遵守《中華人民共和國網路安全法》,請勿使用非授權測試,如作他用所承受的法律責任一概與作者無關。

實現工具所需的庫執行緒,argparse,請求,sys,隊列程式碼編寫和測試插入linux系統(彩色字體輸出可能只支援linux系統)
用了多執行緒和軸向優化掃描速度 用了argparse命令參數解析包優化用戶體驗? 主要功能為獲取請求請求響應後返回的HTTP狀態碼判斷是否為200,302,403,500等
實現功能主要程式碼為
#這裡使用head請求,只獲取報頭 resp = requests.head(urls) #判斷返回的http狀態碼,並輸出 if resp.status_code == 200 : sys.stdout.write('r' + '[*]-----%stt'%urls + "------------"+ GREEN+"200" + none + "n") elif resp.status_code == 403 : sys.stdout.write('r' + '[*]-----%stt'%urls + "------------"+ YELLOW+"403" + none + "n") elif resp.status_code == 302 : sys.stdout.write('r' + '[*]-----%stt'%urls + "------------"+ cyan+"302" + none + "n") elif resp.status_code ==500 : sys.stdout.write('r' + '[*]-----%stt'%urls + "------------"+ red +"500" + none + "n")
用法為 -t執行緒數(至少5)-w字典(必須)-u(必須)
./dirscan.py -h usage: dirscan.py [-h] [-t THREAD_NUM] [-u URLS] [-w WORDLISTS] optional arguments: -h, --help show this help message and exit -t THREAD_NUM thread options -u URLS url options -w WORDLISTS wordlists options 例子: ./dirscan.py -w /usr/share/wordlists/wfuzz/general/common.txt -u xxxxxx xxxxxx.com -t 5

項目地址:http://www.khan.org.cn/index.php/2020/01/29/web目錄掃描/
手握日月摘星辰,安全路上永不止步。
– Khan攻防安全實驗室