Python 實(shí)現(xiàn)敏感目錄掃描的示例代碼
01 實(shí)現(xiàn)背景
1、PHPdict.txt,一個文本文件,包含可能的敏感目錄后綴
2、HackRequests模塊,安全測試人員專用的類Requests模塊
02 實(shí)現(xiàn)目標(biāo)
利用HackRequests模塊,配合敏感目錄字典PHPdict.txt,實(shí)現(xiàn)一個簡單的敏感目錄掃描Python文件
03 注意事項(xiàng)
1、輸入URL時要輸全:如 https://www.baidu.com/、 https://www.csdn.net/
2、為防止網(wǎng)站可能存在的簡單反爬機(jī)制,我們簡單添加headers信息,嘗試?yán)@過反爬
04 實(shí)現(xiàn)代碼
import HackRequestsdef HR(url): h = HackRequests.hackRequests() header = { 'Connection': 'keep-alive', 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0' } try: u = h.http(url=url,headers=header) if u.status_code == 200: print('%s is success!' %url) else: print('%s is failed! %d' %(url,u.status_code)) except: passwith open('C:UsersDellDesktopPythonPHPdict.txt','r') as file: lines = file.readlines() urls = [] url_begin = input(’請輸入你要掃描的網(wǎng)站:’) for line in lines: url = f’{url_begin}{line}’ urls.append(url)for url in urls: print(url) HR(url)
05 實(shí)現(xiàn)效果
總結(jié)
到此這篇關(guān)于Python 實(shí)現(xiàn)敏感目錄掃描的示例代碼的文章就介紹到這了,更多相關(guān)python 敏感目錄掃描內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. 解決Android Studio 格式化 Format代碼快捷鍵問題2. php解決注冊并發(fā)問題并提高QPS3. 完美解決vue 中多個echarts圖表自適應(yīng)的問題4. JavaEE SpringMyBatis是什么? 它和Hibernate的區(qū)別及如何配置MyBatis5. Springboot 全局日期格式化處理的實(shí)現(xiàn)6. Java使用Tesseract-Ocr識別數(shù)字7. SpringBoot+TestNG單元測試的實(shí)現(xiàn)8. vue實(shí)現(xiàn)web在線聊天功能9. 在Chrome DevTools中調(diào)試JavaScript的實(shí)現(xiàn)10. Python使用urlretrieve實(shí)現(xiàn)直接遠(yuǎn)程下載圖片的示例代碼
