進階 Web 路徑暴力破解器
dirsearch正在由 @maurosoria 和 @shelld3v 積極開發
最好訪問我們的 Discord 伺服器與團隊溝通
需求:python 3.9或更高版本
選擇以下安裝選項之一:
git clone https://github.com/maurosoria/dirsearch.git --depth 1
(建議)docker build -t "dirsearch:v0.4.3" .
(更多資訊可以在這裡找到)pip3 install dirsearch
或pip install dirsearch
sudo apt-get install dirsearch
(已棄用) 概括:
%EXT%
關鍵字替換為-e標誌中的擴展。%EXT%
單字清單(如 SecLists), -f | --force-extensions開關需要將擴展名附加到單字清單中的每個單字以及/
。wordlist1.txt,wordlist2.txt
。範例:
index.%EXT%
傳遞asp和aspx作為副檔名將產生以下字典:
index
index.asp
index.aspx
admin
使用-f / --force-extensions標誌將php和html作為擴展傳遞將產生以下字典:
admin
admin.php
admin.html
admin/
login.html
使用-O / --overwrite-extensions標誌將jsp和jspa作為擴展傳遞將產生以下字典:
login.html
login.jsp
login.jspa
Usage: dirsearch.py [-u|--url] target [-e|--extensions] extensions [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
Mandatory:
-u URL, --url=URL Target URL(s), can use multiple flags
-l PATH, --urls-file=PATH
URL list file
--stdin Read URL(s) from STDIN
--cidr=CIDR Target CIDR
--raw=PATH Load raw HTTP request from file (use '--scheme' flag
to set the scheme)
--nmap-report=PATH Load targets from nmap report (Ensure the inclusion of
the -sV flag during nmap scan for comprehensive
results)
-s SESSION_FILE, --session=SESSION_FILE
Session file
--config=PATH Path to configuration file (Default:
'DIRSEARCH_CONFIG' environment variable, otherwise
'config.ini')
Dictionary Settings:
-w WORDLISTS, --wordlists=WORDLISTS
Wordlist files or directories contain wordlists
(separated by commas)
-e EXTENSIONS, --extensions=EXTENSIONS
Extension list separated by commas (e.g. php,asp)
-f, --force-extensions
Add extensions to the end of every wordlist entry. By
default dirsearch only replaces the %EXT% keyword with
extensions
-O, --overwrite-extensions
Overwrite other extensions in the wordlist with your
extensions (selected via `-e`)
--exclude-extensions=EXTENSIONS
Exclude extension list separated by commas (e.g.
asp,jsp)
--remove-extensions
Remove extensions in all paths (e.g. admin.php ->
admin)
--prefixes=PREFIXES
Add custom prefixes to all wordlist entries (separated
by commas)
--suffixes=SUFFIXES
Add custom suffixes to all wordlist entries, ignore
directories (separated by commas)
-U, --uppercase Uppercase wordlist
-L, --lowercase Lowercase wordlist
-C, --capital Capital wordlist
General Settings:
-t THREADS, --threads=THREADS
Number of threads
--async Enable asynchronous mode
-r, --recursive Brute-force recursively
--deep-recursive Perform recursive scan on every directory depth (e.g.
api/users -> api/)
--force-recursive Do recursive brute-force for every found path, not
only directories
-R DEPTH, --max-recursion-depth=DEPTH
Maximum recursion depth
--recursion-status=CODES
Valid status codes to perform recursive scan, support
ranges (separated by commas)
--subdirs=SUBDIRS Scan sub-directories of the given URL[s] (separated by
commas)
--exclude-subdirs=SUBDIRS
Exclude the following subdirectories during recursive
scan (separated by commas)
-i CODES, --include-status=CODES
Include status codes, separated by commas, support
ranges (e.g. 200,300-399)
-x CODES, --exclude-status=CODES
Exclude status codes, separated by commas, support
ranges (e.g. 301,500-599)
--exclude-sizes=SIZES
Exclude responses by sizes, separated by commas (e.g.
0B,4KB)
--exclude-text=TEXTS
Exclude responses by text, can use multiple flags
--exclude-regex=REGEX
Exclude responses by regular expression
--exclude-redirect=STRING
Exclude responses if this regex (or text) matches
redirect URL (e.g. '/index.html')
--exclude-response=PATH
Exclude responses similar to response of this page,
path as input (e.g. 404.html)
--skip-on-status=CODES
Skip target whenever hit one of these status codes,
separated by commas, support ranges
--min-response-size=LENGTH
Minimum response length
--max-response-size=LENGTH
Maximum response length
--max-time=SECONDS Maximum runtime for the scan
--exit-on-error Exit whenever an error occurs
Request Settings:
-m METHOD, --http-method=METHOD
HTTP method (default: GET)
-d DATA, --data=DATA
HTTP request data
--data-file=PATH File contains HTTP request data
-H HEADERS, --header=HEADERS
HTTP request header, can use multiple flags
--headers-file=PATH
File contains HTTP request headers
-F, --follow-redirects
Follow HTTP redirects
--random-agent Choose a random User-Agent for each request
--auth=CREDENTIAL Authentication credential (e.g. user:password or
bearer token)
--auth-type=TYPE Authentication type (basic, digest, bearer, ntlm, jwt)
--cert-file=PATH File contains client-side certificate
--key-file=PATH File contains client-side certificate private key
(unencrypted)
--user-agent=USER_AGENT
--cookie=COOKIE
Connection Settings:
--timeout=TIMEOUT Connection timeout
--delay=DELAY Delay between requests
-p PROXY, --proxy=PROXY
Proxy URL (HTTP/SOCKS), can use multiple flags
--proxies-file=PATH
File contains proxy servers
--proxy-auth=CREDENTIAL
Proxy authentication credential
--replay-proxy=PROXY
Proxy to replay with found paths
--tor Use Tor network as proxy
--scheme=SCHEME Scheme for raw request or if there is no scheme in the
URL (Default: auto-detect)
--max-rate=RATE Max requests per second
--retries=RETRIES Number of retries for failed requests
--ip=IP Server IP address
--interface=NETWORK_INTERFACE
Network interface to use
Advanced Settings:
--crawl Crawl for new paths in responses
View Settings:
--full-url Full URLs in the output (enabled automatically in
quiet mode)
--redirects-history
Show redirects history
--no-color No colored output
-q, --quiet-mode Quiet mode
Output Settings:
-o PATH/URL, --output=PATH/URL
Output file or MySQL/PostgreSQL URL (Format:
scheme://[username:password@]host[:port]/database-
name)
--format=FORMAT Report format (Available: simple, plain, json, xml,
md, csv, html, sqlite, mysql, postgresql)
--log=PATH Log file
預設情況下,dirsearch 目錄中的config.ini
用作設定文件,但您可以透過--config
標誌或DIRSEARCH_CONFIG
環境變數選擇另一個檔案。
# If you want to edit dirsearch default configurations, you can
# edit values in this file. Everything after `#` is a comment
# and won't be applied
[general]
threads = 25
async = False
recursive = False
deep-recursive = False
force-recursive = False
recursion-status = 200-399,401,403
max-recursion-depth = 0
exclude-subdirs = %%ff/,. ; /,..;/,;/,./,../,%%2e/,%%2e%%2e/
random-user-agents = False
max-time = 0
exit-on-error = False
# subdirs = /,api/
# include-status = 200-299,401
# exclude-status = 400,500-999
# exclude-sizes = 0b,123gb
# exclude-text = "Not found"
# exclude-regex = "^403$"
# exclude-redirect = "*/error.html"
# exclude-response = 404.html
# skip-on-status = 429,999
[dictionary]
default-extensions = php,aspx,jsp,html,js
force-extensions = False
overwrite-extensions = False
lowercase = False
uppercase = False
capitalization = False
# exclude-extensions = old,log
# prefixes = .,admin
# suffixes = ~,.bak
# wordlists = /path/to/wordlist1.txt,/path/to/wordlist2.txt
[request]
http-method = get
follow-redirects = False
# headers-file = /path/to/headers.txt
# user-agent = MyUserAgent
# cookie = SESSIONID=123
[connection]
timeout = 7.5
delay = 0
max-rate = 0
max-retries = 1
# # By disabling `scheme` variable, dirsearch will automatically identify the URI scheme
# scheme = http
# proxy = localhost:8080
# proxy-file = /path/to/proxies.txt
# replay-proxy = localhost:8000
[advanced]
crawl = False
[view]
full-url = False
quiet-mode = False
color = True
show-redirects-history = False
[output]
# # Support: plain, simple, json, xml, md, csv, html, sqlite
report-format = plain
autosave-report = True
autosave-report-folder = reports/
# log-file = /path/to/dirsearch.log
# log-file-size = 50000000
有關如何使用 dirsearch 的一些範例 - 這些是最常見的參數。如果您需要全部,只需使用-h參數。
python3 dirsearch.py -u https://target
python3 dirsearch.py -e php,html,js -u https://target
python3 dirsearch.py -e php,html,js -u https://target -w /path/to/wordlist
dirsearch 可讓您使用 CTRL+C 暫停掃描進度,從這裡您可以儲存進度(並稍後繼續)、跳過目前目標或跳過目前子目錄。
admin/
,它將暴力破解admin/*
( *
是暴力破解的地方)。若要啟用此功能,請使用-r (或--recursive )標誌 python3 dirsearch.py -e php,html,js -u https://target -r
python3 dirsearch.py -e php,html,js -u https://target -r --max-recursion-depth 3 --recursion-status 200-399
還有 2 個選項: --force-recursive和--deep-recursive
/
結尾的路徑a/b/c
=> add a/
, a/b/
)如果您不想遞歸地暴力破解某些子目錄,請使用--exclude-subdirs
python3 dirsearch.py -e php,html,js -u https://target -r --exclude-subdirs image/,media/,css/
線程號( -t | --threads )反映了分離的暴力破解過程的數量。因此執行緒數越大,dirsearch 運行得越快。預設情況下,執行緒數為 25,但如果您想加快進度,可以增加它。
儘管如此,速度仍然在很大程度上取決於伺服器的回應時間。作為警告,我們建議您不要讓線程數太大,因為它可能會導致 DoS(拒絕服務)。
python3 dirsearch.py -e php,htm,js,bak,zip,tgz,txt -u https://target -t 20
你可以透過--async
切換到非同步模式,讓 dirsearch 使用協程而不是執行緒來處理並發請求。
理論上,非同步模式可以提供更好的效能和更低的 CPU 使用率,因為它不需要在不同的執行緒上下文之間切換。此外,按 CTRL+C 將立即暫停進度,無需等待執行緒掛起。
python3 dirsearch.py -e php -u https://target --prefixes .,admin,_
單字表:
tools
使用前綴產生:
tools
.tools
admintools
_tools
python3 dirsearch.py -e php -u https://target --suffixes ~
單字表:
index.php
internal
產生後綴:
index.php
internal
index.php~
internal~
在db/
資料夾內,有幾個「黑名單檔案」。如果這些文件中的路徑具有與文件名中提到的相同狀態,則將從掃描結果中過濾掉這些路徑。
範例:如果您將admin.php
新增至db/403_blacklist.txt
中,則每當您執行掃描時admin.php
傳回 403,它就會從結果中過濾掉。
使用-i | --include-status和-x | --exclude-status選擇允許和不允許的回應狀態代碼
對於更進階的過濾器: --exclude-sizes 、 --exclude-texts 、 --exclude-regexps 、 --exclude-redirects和--exclude-response
python3 dirsearch.py -e php,html,js -u https://target --exclude-sizes 1B,243KB
python3 dirsearch.py -e php,html,js -u https://target --exclude-texts "403 Forbidden"
python3 dirsearch.py -e php,html,js -u https://target --exclude-regexps "^Error$"
python3 dirsearch.py -e php,html,js -u https://target --exclude-redirects "https://(.*).okta.com/*"
python3 dirsearch.py -e php,html,js -u https://target --exclude-response /error.html
dirsearch 允許您從文件匯入原始請求。內容看起來像這樣:
GET /admin HTTP/1.1
Host: admin.example.com
Cache-Control: max-age=0
Accept: */*
由於 dirsearch 無法知道 URI 方案是什麼,因此您需要使用--scheme
標誌來設定它。預設情況下,dirsearch 會自動偵測該方案。
支援的單字列表格式:大寫、小寫、大寫
admin
index.html
ADMIN
INDEX.HTML
Admin
Index.html
使用-X | --exclude-extensions帶有擴展名列表將刪除單字列表中包含給定擴展名的所有路徑
python3 dirsearch.py -u https://target -X jsp
單字表:
admin.php
test.jsp
後:
admin.php
python3 dirsearch.py -e php,html,js -u https://target --subdirs /,admin/,folder/
dirsearch 支援 SOCKS 和 HTTP 代理,有兩個選項:代理伺服器或代理伺服器清單。
python3 dirsearch.py -e php,html,js -u https://target --proxy 127.0.0.1:8080
python3 dirsearch.py -e php,html,js -u https://target --proxy socks5://10.10.0.1:8080
python3 dirsearch.py -e php,html,js -u https://target --proxylist proxyservers.txt
支援的報表格式: simple , plain , json , xml , md , csv , html , sqlite , mysql , postgresql
python3 dirsearch.py -e php -l URLs.txt --format plain -o report.txt
python3 dirsearch.py -e php -u https://target --format html -o target.json
cat urls.txt | python3 dirsearch.py --stdin
python3 dirsearch.py -u https://target --max-time 360
python3 dirsearch.py -u https://target --auth admin:pass --auth-type basic
python3 dirsearch.py -u https://target --header-list rate-limit-bypasses.txt
還有更多有待發現,請親自嘗試!
安裝 Docker
curl -fsSL https://get.docker.com | bash
要使用 docker,你需要超級使用者權限
創建圖像
docker build -t " dirsearch:v0.4.3 " .
dirsearch是鏡像名稱, v0.4.3是版本
用於使用
docker run -it --rm " dirsearch:v0.4.3 " -u target -e php,html,js,zip
--proxy-list
隨機化代理--suffixes ~
和--prefixes .
--remove-extensions
和--suffixes /
!--cidr
、 -F
、 -q
的組合將減少大部分噪音 + 漏報--skip-on-status 429
將協助您在返回 429 時跳過目標HEAD
HTTP 方法而不是GET
--timeout 3 --retries 1
我們得到了世界各地許多人的幫助來改進這個工具。非常感謝迄今為止為我們提供幫助的所有人!請參閱 CONTRIBUTORS.md 以了解他們是誰。
版權所有 (C) Mauro Soria ([email protected])
許可證:GNU 通用公共許可證,版本 2