bak文件
writeup:打开靶机,显示flag在index.php中,在网站url后加上index.php,下载了bak文件,再在hrl后加上.bak 查看网站源代码,得到flag
vim缓存
vim交换文件名
使用vim会创建临时缓存文件,关闭vim缓存文件删除,当vim异常退出,未处理缓存文件,导致可以通过缓存文件恢复原始文件内容
例:第一次产生的交换文件名为.index.php.swp
再次意外退出后,将会产生名为.index.php.swo的交换文件
第三次产生的交换文件为.index.php.swn
做题工具:dirsearch
介绍
dirsearch是一个基于python的命令行工具,用于暴力扫描页面结构,包括网页中的目录和文件。
dirsearch下载地址: GitHub - maurosoria/dirsearch: Web path scanner
运行环境:必须安装python3.7或更高版本
一、Dirsearch是什么?
Dirsearch是一个用于探测WEB服务器下的敏感文件/目录的命令行工具。
二、安装和使用
1.安装
1.1选择以下安装选项之一:
使用 git 安装:(推荐git clone https://github.com/maurosoria/dirsearch.git --depth 1)
使用 ZIP 文件安装:在此处下载
使用 Docker 安装:(更多信息可以在这里找到docker build -t "dirsearch:v0.4.3" .)
使用 PyPi 安装:或pip3 install dirsearchpip install dirsearch
使用 Kali Linux 安装:(已弃用)sudo apt-get install dirsearch
1.2下载zip包,解压后进入控制台,输入下面命令进行安装依赖:
pip3 install -r requirements.txt //安装依赖
python dirsearch.py -h //查看帮助
帮助信息的简单翻译:
-h, --help 显示此帮助消息并退出
Mandatory:
-u URL, --url=URL URL目标
-L URLLIST, --url-list=URLLIST URL列表目标
-e EXTENSIONS, --extensions=EXTENSIONS 以逗号分隔的扩展列表(示例:php、asp)
-E, --extensions-list 使用公共扩展的预定义列表Dictionary Settings:
-w WORDLIST, --wordlist=WORDLIST 自定义单词表(用逗号分隔)
-l, --lowercase
-f, --force-extensions 强制扩展每个单词表条目(如DirBuster)常规设置:
-s DELAY, --delay=DELAY 请求之间的延迟(浮点数)
-r, --recursive 递归暴力
-R RECURSIVE_LEVEL_MAX, --recursive-level-max=RECURSIVE_LEVEL_MAX 最大递归级别(子目录)(默认值:1[仅限根目录+1目录])
--suppress-empty, --suppress-empty
--scan-subdir=SCANSUBDIRS, --scan-subdirs=SCANSUBDIRS 扫描给定-u |--url的子目录(分开逗号)
--exclude-subdir=EXCLUDESUBDIRS, --exclude-subdirs=EXCLUDESUBDIRS 在递归过程中排除下列子目录扫描(用逗号分隔)
-t THREADSCOUNT, --threads=THREADSCOUNT 线程数
-x EXCLUDESTATUSCODES, --exclude-status=EXCLUDESTATUSCODES 排除状态代码,用逗号分隔(例如:301,500个)
--exclude-texts=EXCLUDETEXTS 用逗号分隔的文本排除响应(示例: "Not found", "Error")
--exclude-regexps=EXCLUDEREGEXPS 按regexp排除响应,用逗号分隔(示例:"Not foun[a-z]{1}", "^Error$")
-c COOKIE, --cookie=COOKIE
--ua=USERAGENT, --user-agent=USERAGENT 用户代理
-F, --follow-redirects --遵循重定向
-H HEADERS, --header=HEADERS 页眉,--页眉=页眉
要添加的标题 (example: --header "Referer:example.com" --header "User-Agent: IE")
--random-agents, --random-user-agents 随机代理,--随机用户代理连接设置:
--timeout=TIMEOUT 连接超时
--ip=IP 将名称解析为
2.使用方法
命令总结:
python3 dirsearch.py -e php,txt,zip -u https://target //简单的查看网址目录和文件
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt //使用文件拓展名为php,txt,zip的字典扫描目标url
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --recursive -R 2python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --recursive -R 4 --scan-subdirs=/,/wp-content/,/wp-admin/
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --exclude-texts=This,AndThat
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt -H "User-Agent: IE"
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt -t 20
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --random-agents
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --json-report=reports/target.json
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --simple-report=reports/target-paths.txt
python3 dirsearch.py -e php,txt,zip -u https://target -w db/dicc.txt --plain-text-report=reports/target-paths-and-status.js
个人常用命令:
python dirsearch.py -u http://xxxx //日常使用
python dirsearch.py -u http://xxxx -r //递归扫描,不过容易被检测
python dirsearch.py -u http://xxxx -r -t 30 //线程控制请求速率
python dirsearch.py -u http://xxxx -r -t 30 --proxy 127.0.0.1:8080 //使用代理
writeup:
点开url查看页面信息:flag在index.php源码中
在控制台进入dirsearch目录,运行
python dirsearch.py -u http://xxxx -r
找到/.index.php.swp,在url后输入/.index.php.swp,下载了swp文件,用记事本打开得到flag
另外一种比较正规的方法:
将该index.php.swp文件拖入linux中,使用vim编辑器打开
从Windows传入Linux需要更改文件名
使用命令行输入:vim -r index.php
输入后回车
再按回车,拿到flag
.DS_Store
.DS_Store 是 Mac OS 保存文件夹的自定义属性的隐藏文件。通过.DS_Store可以知道这个目录里面所有文件的清单,目的在于存贮目录的自定义属性,例如文件的图标位置或者是背景色的选择。相当于 Windows 下的 desktop.ini。
writeup:打开靶机
dirsearch扫描
命令:python3 dirsearch.py -u http://challenge-12f64832b0708f0c.sandbox.ctfhub.com:10080/ -e *
接着,在url后面加入/.DS_Store
保存文件
下载完成后,将文件拖入Linux中,在Linux的命令行中输入cat DS_Store
将其中的信息25d475e0519a15fba2f72804f57a9544.txt加入到url后,即可得到flag