Dirb 개요

  • Dirb 웹 사이트에 존재하는 경로(패스)를 찾아내주는 Fuzzing 툴이다.
  • 사전 파일(Dictionary File)을 이용해 경로를 체크하고 결과를 알려준다.
  • 빠르고 사용법도 간단한다.
  • 칼리 리눅스라면 기본적으로 설치되어 있다.

install

아마존 리눅스에 직접 소스 코드를 컴파일하는 방법으로 설치했다.

wget https://github.com/v0re/dirb/archive/refs/heads/master.zip
unzip master.zip
cd dirb-master
sudo yum install libcurl-devel openssl-devel
./configure
sudo make
sudo make install 
# wordlists 는 왜인지 카피가 되지 않아서 수동으로 카피했다. 
sudo mkdir /usr/share/dirb
sudo cp -R wordlists/ /usr/share/dirb

실행 테스트

하단 EXAMPLES 부분에 사용예가 나와있다. 이 패턴만 사용해도 충분할 것 같다.

$ dirb

-----------------
DIRB v2.22
By The Dark Raver
-----------------

./dirb <url_base> [<wordlist_file(s)>] [options]

========================= NOTES =========================
 <url_base> : Base URL to scan. (Use -resume for session resuming)
 <wordlist_file(s)> : List of wordfiles. (wordfile1,wordfile2,wordfile3...)

======================== HOTKEYS ========================
 'n' -> Go to next directory.
 'q' -> Stop scan. (Saving state for resume)
 'r' -> Remaining scan stats.

======================== OPTIONS ========================
 -a <agent_string> : Specify your custom USER_AGENT.
 -c <cookie_string> : Set a cookie for the HTTP request.
 -f : Fine tunning of NOT_FOUND (404) detection.
 -H <header_string> : Add a custom header to the HTTP request.
 -i : Use case-insensitive search.
 -l : Print "Location" header when found.
 -N <nf_code>: Ignore responses with this HTTP code.
 -o <output_file> : Save output to disk.
 -p <proxy[:port]> : Use this proxy. (Default port is 1080)
 -P <proxy_username:proxy_password> : Proxy Authentication.
 -r : Don't search recursively.
 -R : Interactive recursion. (Asks for each directory)
 -S : Silent Mode. Don't show tested words. (For dumb terminals)
 -t : Don't force an ending '/' on URLs.
 -u <username:password> : HTTP Authentication.
 -v : Show also NOT_FOUND pages.
 -w : Don't stop on WARNING messages.
 -X <extensions> / -x <exts_file> : Append each word with this extensions.
 -z <milisecs> : Add a miliseconds delay to not cause excessive Flood.

======================== EXAMPLES =======================
 ./dirb http://url/directory/ (Simple Test)
 ./dirb http://url/ -X .html (Test files with '.html' extension)
 ./dirb http://url/ /usr/share/dirb/wordlists/vulns/apache.txt (Test with apache.txt wordlist)
 ./dirb https://secure_url/ (Simple Test with SSL)

샘플 커맨드

심플 테스트

테스트하고 싶은 URL 또는 경로까지 포함해서 dirb를 실행한다.

 ./dirb http://url/path/

특정 확장자를 테스트

예를 들어 .html 확장자를 가진 파일 경로를 테스트하고 싶으면 X 옵션을 줘서 다음과 같이 실행한다.

./dirb http://url/ -X .html 

특정 단어 파일로 실행하기

아무 것도 지정하지 않을 경우, 기본적으로 /usr/share/dirb/wordlists/common.txt 가 사용된다. 특정 단어 파일을 사용하고 싶으면 다음과 같이 두번째 파라메터로 단어 파일 경로를 지정한다.

 ./dirb http://url/ /usr/share/dirb/wordlists/vulns/apache.txt

참고

  • https://github.com/v0re/dirb