今天要介绍的工具是BIRDDIRB,是一个网页内容扫描器,它根据字典档一个个向目标网页发出请求,并分析回传的结果,藉以确认网页资料夹或物件存在。而DIRB有预设定义好的一些字典档,也可以不使用预设,改用自己定义的字典档来做扫描。
首先先直接执行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.
-b : Use path as is.
-c <cookie_string> : Set a cookie for the HTTP request.
-E <certificate> : path to the client certificate.
-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 <millisecs> : Add a milliseconds 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)
这边先使用预设的字典档来体验一下效果,可以用Day2建立的靶机来试试看,不过如果有在Day14因为建立wordpress网站的话,建议可以先还原靶机的原始网页设置
# 以下指令皆在靶机上执行
# 关闭apache2
sudo /etc/init.d/apache2 stop
# Day14把wordpress资料夹指向了/var/www,所以可以直接删除此软连结
sudo rm /var/www
# 复原原本备份
sudo mv /var/www.bak /var/www
# 重启apache2
sudo /etc/init.d/apache2 start
接着就可以用dirb
来对靶机做扫描罗
dirb http://192.168.1.86
这边执行的一开始就表明了使用预设的字典档/usr/share/dirb/wordlists/common.txt
,这个字典档里含有4612个关键字
START_TIME: Fri Oct 1 10:14:15 2021
URL_BASE: http://192.168.1.86/
WORDLIST_FILES: /usr/share/dirb/wordlists/common.txt
-----------------
GENERATED WORDS: 4612
这边节录一下/usr/share/dirb/wordlists/common.txt
的部分内容,来了解一下格式,每一行都是一个关键字,利用这些关键字去组合并扫描,来确认目标网站存在哪些路径。
php
php.ini
php_uploads
php168
php3
phpadmin
phpads
phpadsnew
这边节录一些扫描结果,只能说靶机不愧是靶机,就是故意要被扫到,路径中充满许多常见的关键字,所以才会如此容易命中。
+ http://192.168.1.86/cgi-bin/ (CODE:403|SIZE:293)
==> DIRECTORY: http://192.168.1.86/dav/
+ http://192.168.1.86/index (CODE:200|SIZE:891)
+ http://192.168.1.86/index.php (CODE:200|SIZE:891)
+ http://192.168.1.86/phpinfo (CODE:200|SIZE:48059)
+ http://192.168.1.86/phpinfo.php (CODE:200|SIZE:48071)
==> DIRECTORY: http://192.168.1.86/phpMyAdmin/
+ http://192.168.1.86/server-status (CODE:403|SIZE:298)
==> DIRECTORY: http://192.168.1.86/test/
==> DIRECTORY: http://192.168.1.86/twiki/
---- Entering directory: http://192.168.1.86/dav/ ----
(!) WARNING: Directory IS LISTABLE. No need to scan it.
(Use mode '-w' if you want to scan it anyway)
了解用法後,可以尝试定义自己的字典档,如果想确认自订的关键字是否已经存在於预设的字典内,那麽可以去/usr/share/dirb/wordlists/
这个路径下看看预设的字典档有哪些,这些字典档也可以拿来直接用
dirb http://192.168.1.86 /usr/share/dirb/wordlists/vulns/apache.txt
html2dic
可以从html的文件产生可用的字典档
# 用 wget 下载 index.html页面
wget http://example.com
# 产生字典档并输出到档案
html2dic index.html > my_dic.txt
其实dirb
不是一个攻击用的工具,它也不是直接侦测漏洞,只是提供一个辅助的手段或是进行前置的准备动作,之後再用其他工具来使用这些资讯来达到最後的目的。
<<: 自动化 End-End 测试 Nightwatch.js 之踩雷笔记:开启新视窗
>>: 连续 30 天 玩玩看 ProtoPie - Day 16
因为考虑到才第三篇就开始飙车直接上 Flask 会不会太快,加上这系列有一小部分原因(大约50%?)...
浏览了超过 50 篇文章,直到找到这篇影音教学,真的是非常符合目前的需求~! 观看影片後也能轻松上手...
Flutter_WebRTC 本篇需搭配後疫情时代的WebRTC微学习 Day28服用 用docke...
今天来练习雷电云的特效 参考来源,六指渊:https://www.sixvfx.com/lightn...
What is MVC? 先招唤 wiki 大大出来解释一下 MVC 是甚麽: MVC模式(Mode...