###### tags: `dirsearch`
# Dirsearch 基本使用
### 基本必須參數(快速)
```bash=
# 單純只掃網站根目錄
# 例如 http://example.com/home/page,只掃 http://example.com/
dirsearch -u "http://example.com/"
```
### 常用參數
```bash=
# 使用情境通常發生在,某些登入後的頁面或部分資源才可以存取,不加cookie就存取不到
# 當然也有些網站即使沒登入,但是沒cookie一樣存取不到
--cookie "SESSION_ID=xxx;abc=xxx;"
# POST data
# 也可注入json,看網站怎送請求,--data "{'a':1,'b':2}" 或者 --data '{"a":1,"b":2}'
--data "a=1&b=2"
# 使用情境通常是不加的話,可能會被後端或者防火牆攔截等等
# 如果在header中已經指定User-Agent,就別加--random-agent參數
--header "User-Agent: Mozilla/5.0 (Windows NT ..."
# 指定URI前綴,例如dirsearch會掃admin.php
# 有時候前面可能會有相關單位的縮寫
# 像是 xxx_admin.php,那就可以用這個參數
--prefix "xxx_"
# 如果你有多種前綴想測試,則可以用這個
--prefixes aa,bb,cc
# 指定URI後綴,例如dirsearch會掃admin.php
# 有些人改完一些東西怕會需要改回來所以留著不刪
# 像是 admin.php.bak 或者 admin.php_bak,那就可以用這個參數
--suffix ".bak"
# 如果你有多種後綴想測試,則可以用這個
--suffixes aa,bb,cc
# 類似 --suffixes php,aspx,html ,但-e會幫你自動帶入字典檔的%EXT%
-e php,aspx,html
# 暴力遞規,例如掃出/test後,會進去/test接著掃
-r
# 當你使用了-r遞歸掃描目錄但是想避開你感覺沒啥用的目錄(例如js,img,css),則可使用此參數
--exclude-subdirs js/,img/,css/
# 指定自己的字典檔,不指定就使用預設的 dirsearch/db/dicc.txt
-w word_list.txt
```
### 排除誤判
```bash=
# 排除響應顯示?B/KB/MB大小的資料
# 使用情境通常發生在WAF攔截但卻給你 HTTP code 200 OK,導致工具以為有料
--exclude-size 2KB
# 排除顯示HTTP code為200的響應
# 跟--exclude-size類似,只是一個是用http code來排除,可以多個
-x 200,404
# 僅顯示HTTP code為200的響應
-i 200,404
# 如果有固定某個頁面內容回應是想排除的,可使用此參數
--exclude-text "not found"
# 如果存取某個不存在的路徑就會導向,可使用此參數排除,例如aspx會有
# [12:58:14] 302 - 206B - /.ashx -> https://<garget>/ErrorPage.aspx?aspxerrorpath=/.ashx
# 就可以使用如下參數排除
# --exclude-redirect "ErrorPage.aspx?aspxerrorpath="
--exclude-redirect
```
### 掃描意外中斷狀況
```bash=
# 設定線程,預設是25,使用情境通常是掃太快網站會掛掉或者會被WAF攔截
--threads 10
```
### <font style="background-color:#CD0000;color:white;">Unexpected SSL error</font> 問題
```
# 可參考此篇 https://github.com/maurosoria/dirsearch/issues/1444
# 解決辦法簡單說,就是在有burpsuite的環境下,在burpsuite代理設定新增一個新的代理port,然後設定選代理所有網卡(這樣vm也可以吃到)
--proxy http://127.0.0.1:9999
```