Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/0x727/ShuiZe_0x727
信息收集自动化工具
https://github.com/0x727/ShuiZe_0x727
Last synced: 3 months ago
JSON representation
信息收集自动化工具
- Host: GitHub
- URL: https://github.com/0x727/ShuiZe_0x727
- Owner: 0x727
- Created: 2021-07-28T11:34:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T09:24:54.000Z (8 months ago)
- Last Synced: 2024-11-19T14:02:10.848Z (3 months ago)
- Language: Python
- Size: 57.7 MB
- Stars: 3,782
- Watchers: 45
- Forks: 572
- Open Issues: 156
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-hacking-lists - 0x727/ShuiZe_0x727 - 信息收集自动化工具 (Python)
- StarryDivineSky - 0x727/ShuiZe_0x727 - 信息收集自动化工具 只需要输入根域名即可全方位收集相关资产,并检测漏洞。 (扫描器、资产收集、子域名 / 网络服务_其他)
README
# 水泽-信息收集自动化工具
[](https://github.com/0x727/ShuiZe_0x727/releases)
郑重声明:文中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途以及盈利等目的,否则后果自行承担。
## 0x01 介绍
作者:[Ske](https://github.com/SkewwG)
团队:[0x727](https://github.com/0x727),未来一段时间将陆续开源工具,地址:https://github.com/0x727
定位:协助红队人员快速的信息收集,测绘目标资产,寻找薄弱点
语言:python3开发
功能:一条龙服务,只需要输入根域名即可全方位收集相关资产,并检测漏洞。也可以输入多个域名、C段IP等,具体案例见下文。
调用:脚本借用了ksubdomain爆破子域名和theHarvester收集邮箱,感谢ksubdomain和theHarvester作者
## 0x02 安装
为了避免踩坑,建议安装在如下环境中
* 当前用户对该目录有写权限,不然扫描结果无法生成。root权限即可
* Python环境必须是3.7以上,因为使用了异步。建议VPS环境是ubuntu20,默认是python3.8。安装模块的时候切记不要走豆瓣的源
* 在配置文件iniFile/config.ini里加入api(fofa、shodan、github、virustotal)```
chmod 777 build.sh
./build.sh
```
`python3 ShuiZe.py -h`

### docker运行ShuiZe
较多人反馈安装的时候会出现各种报错,新增通过docker运行ShuiZe
通过下面的命令安装docker,然后拉取python3.8的容器,再git clone水泽后,运行docker_build.sh即可。
```
apt install docker.io
docker pull yankovg/python3.8.2-ubuntu18.04
docker run -itd yankovg/python3.8.2-ubuntu18.04 bash
docker exec -it docker的ID /bin/bash
apt-get update
apt install git --fix-missing
apt install vim
rm /usr/bin/python3
ln -s /usr/local/bin/python3.8 /usr/bin/python3
python3 -m pip install --upgrade pip
git clone https://github.com/0x727/ShuiZe_0x727.git
chmod 777 docker_build.sh
./docker_build.sh
```也可参考 [@1itt1eB0y](https://github.com/1itt1eB0y) 提供的Dockerfile和docker-compose.yml构建镜像并运行
链接:https://github.com/1itt1eB0y/MyCollection/tree/master/docker/shuize
**请自行评估安全性**
**脚本自带Linux版本的Nuclei和ksubdomain,如果是windows或者mac,需要自行更换版本。**
## 0x03 效果展示
备案反查顶级域名

不是泛解析,调用ksubdomain爆破子域名

theHarvest获取邮箱


第三方数据接口 -> 获取子域名

github -> 从github获取子域名,并把查询结果保存到txt,并匹配关键字获取敏感信息

百度和必应爬虫

证书

子域名友链

解析子域名A记录,检测是否CDN和整理C段的IP


网络空间搜索引擎:Fofa和Shodan

IP反查域名

存活探测

漏洞检测

扫描结果保存在excel文件里

excel的内容如下
备案反查顶级域名


邮箱

Github敏感信息

爬虫

证书

子域名A记录和CDN

动态链接和后台地址

网络空间搜索引擎

ip反查域名

存活网站标题

指纹和漏洞

相关域名和C段

## 0x04 POC编写
POC的模板文件例子:`Plugins/Vul/Web/__template__.py`
只需要在run_detect方法里调用POC的利用方法即可。
## 0x05 使用方法
| 语法 | 功能 |
| :------------------------------------------------------- | :-------------------------------------------- |
| python3 ShuiZe.py -d domain.com | 收集单一的根域名资产 |
| python3 ShuiZe.py --domainFile domain.txt | 批量跑根域名列表 |
| python3 ShuiZe.py -c 192.168.1.0,192.168.2.0,192.168.3.0 | 收集C段资产 |
| python3 ShuiZe.py -f url.txt | 对url里的网站漏洞检测 |
| python3 ShuiZe.py --fofaTitle XXX大学 | 从fofa里收集标题为XXX大学的资产,然后漏洞检测 |
| python3 ShuiZe.py -d domain.com --justInfoGather 1 | 仅信息收集,不检测漏洞 |
| python3 ShuiZe.py -d domain.com --ksubdomain 0 | 不调用ksubdomain爆破子域名 |## 0x06 实现原理
* 备案反查顶级域名 -> 获取目标域名相关的其他根域名 -> 接口:http://icp.chinaz.com
* 判断是否是泛解析
* 泛解析-> 不爆破子域名
* 不是泛解析 -> 调用ksubdomain爆破子域名(脚本里我用的是linux版本的ksubdomain,文件地址:./Plugins/infoGather/subdomain/ksubdomain/ksubdomain_linux,如果是其他系统请自行替换)
* 调用theHarvester -> 获取子域名和邮箱列表
* 第三方数据接口 -> 获取子域名
* virustotal -> https://www.virustotal.com -> 需要api
* ce.baidu.com -> http://ce.baidu.com
* url.fht.im -> https://url.fht.im/
* qianxun -> https://www.dnsscan.cn/
* sublist3r -> https://api.sublist3r.com
* crt.sh -> https://crt.sh
* certspotter -> https://api.certspotter.com
* bufferover -> http://dns.bufferover.run
* threatcrowd -> https://threatcrowd.org
* hackertarget -> https://api.hackertarget.com
* chaziyu -> https://chaziyu.com/hbu.cn/
* rapiddns -> https://rapiddns.io
* sitedossier -> http://www.sitedossier.com
* ximcx -> http://sbd.ximcx.cn
* github -> 从github获取子域名,并把查询结果保存到txt-获取敏感信息
* 敏感信息关键字匹配,可在iniFile/config.ini自定义关键字内容,内置如下关键字('jdbc:', 'password', 'username', 'database', 'smtp', 'vpn', 'pwd', 'passwd', 'connect')
* 百度和必应爬虫 -> 获取目标后台等地址('inurl:admin', 'inurl:login', 'inurl:system', 'inurl:register', 'inurl:upload', '后台', '系统', '登录')
* 证书 -> 获取目标关联域名
* 子域名友链 -> 获取未爆破出的子域名,未被收录的深层域名
整理上面所有的子域名
* 对所有子域名判断是否是CDN并解析出A记录
* 统计每个c段出现IP的个数
* 调用网络空间搜索引擎
* fofa -> 需要API
* shodan -> 需要API* 前面获得的ip反查域名得到相关资产的子域名,整理出所有的子域名和IP

* 整理所有资产探测漏洞
* Web -> 存活探测
* 获取标题
* 自动跑后台路径(['admin', 'login', 'system', 'manager', 'admin.jsp', 'login.jsp', 'admin.php', 'login.php','admin.aspx', 'login.aspx', 'admin.asp', 'login.asp'])
* 如果URL是IP则查询IP的归属地
* 漏洞检测 -> Plugins/Vul/Web


* 非Web服务 --> 未授权和弱口令

其他功能

结果展示:

完整流程图:

## 0x07 新增功能
2021.7.31 增加了Censys接口,需要在iniFile/config.ini的[censys api]中填入API。 功能是获取域名的所有解析IP记录,一是为了Host碰撞,二是更加准确的得到C段IP
需要censys的api,免费的账户一个月只有250次查询,所以后期需要注意,用完了要更新api
2021.7.31 增加了Host碰撞访问内网系统漏洞,感谢 **横戈安全团队-小洲** 提交的建议

2021.8.1 修复了CDN判断的bug,感谢 **leveryd 师傅** 提交的bug。
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/3
2021.8.3 修复了chinazApi接口请求超时太长的bug,设置默认时间10秒,感谢 **k0njac 师傅**提交的bug。
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/11
2021.8.13 增加了获取Github敏感信息地址的作者邮箱,帮助判断是否是目标员工的项目
2021.8.17 更新了ksubdomain版本,自动选择网卡,不需要重新手动输入网卡
ksubdomain项目地址:https://github.com/knownsec/ksubdomain

2021.9.1 增加了从fofa中爬去socks代理功能,后续可以手动配合proxychains进行漏洞探测,防止因为被封IP导致漏报。
感谢 **安恒水滴实验室-1amfine2333师傅** 提供的思路。

2021.9.2 增加了Confluence指纹识别,漏洞利用地址:https://github.com/h3v0x/CVE-2021-26084_Confluence
2021.9.4 增加了某查接口,对目标的整个架构分析,涵盖【对外投资、控股公司、分支机构、联系方式、邮箱】等信息。
感谢 **pykiller师傅** 提交的建议,同时参考了 **吐司师傅gubeiya** 的脚本
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/25

2021.9.26 增加了夸克的api接口,-d -c --fofaTitle中都会调用
限定了每次最大查询数量1000条,不然一个月5w条数据也用不了多少次
在config.ini配置文件的quake_nums值
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/33


2021.11.30 增加了奇安信hunter的api接口,-d -c --fofaTitle中都会调用
限定了每次最大查询数量200条,不然一天的几千条数据也用不了多少次
在config.ini配置文件的qianxin_nums值
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/48


2022.1.17 修复了certspotter接口获取子域名过滤不严谨的问题
感谢 **union-cmd师傅** 提交的建议
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/57
2022.3.21 更新了fofa api的域名
2022.3.21 更新了域名备案反查的问题
2022.3.23 增加了securitytrails接口获取子域名,该接口很强大,建议在config.ini里添加你的api keys
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/48
注册地址: https://docs.securitytrails.com/

感谢 **郭师傅** 提交的建议
2022.3.23 修复了爱企查无法获取数据的问题
感谢 **横戈安全团队-chhyx(逗逗)** 的技术支持
2022.4.13 修复了奇安信测绘语法使用错误的问题
issues地址:https://github.com/0x727/ShuiZe_0x727/issues/74
感谢 **cwkiller** 反馈的问题
2022.4.16 增加了调用Nuclei检测漏洞
nuclei的参数在iniFile/config.ini配置,默认为`nuclei_config = -rl 300 -c 50 -timeout 5 -stats -silent -severity critical,high` 根据需求自行修改

2022.7.5 Nuclei默认参数配置增加-as
issues地址: https://github.com/0x727/ShuiZe_0x727/issues/104
-as 参数,先使用 wappalyzer 进行指纹识别,在进行扫描。
感谢 **anquanbiji** 反馈的建议
2022.8.12 ShuiZe增加Dockerfile安装方式
issues地址: https://github.com/0x727/ShuiZe_0x727/issues/99
感谢 [@1itt1eB0y](https://github.com/1itt1eB0y) 提供的脚本。**安全性自行评估**
2022.8.12 修复了大量反馈aiqicha脚本报错的问题,初步排查是被封IP的原因。
2022.8.12 修复了quakeApi没有title导致报错的情况
issues地址: https://github.com/0x727/ShuiZe_0x727/issues/120
感谢 **Zimba5880** 反馈的建议
2022.8.20 增加了快代理配置,漏洞检测时会使用快代理的代理池,这样可以避免当前IP被封后导致后续的扫描出现遗漏。
购买快代理的隧道代理,地址:https://www.kuaidaili.com/cart?t=tps_c
根据自己的需求选择包年包月或者按量付费,更换IP的频率。这里注意并发请求数的,并发数量越高,在配置文件里iniFile/config.ini的thread_num就可以设置的更高。
假设并发数为5,那么thread_num不要设置超过10,具体的值自己测试。

购买后查看host、port、username、password,然后填入到配置文件里


默认关闭快代理代理池功能,如果要开启,把switch设置为on,使用快代理代理池时会先验证是否配置正确

2022.8.27 集成了ObserverWard扫描指纹
项目地址:https://github.com/0x727/ObserverWard
指纹地址:https://github.com/0x727/FingerprintHub

## 0x08 反馈
ShuiZe(水泽) 是一个免费且开源的项目,我们欢迎任何人为其开发和进步贡献力量。
* 在使用过程中出现任何问题,可以通过 issues 来反馈。
* Bug 的修复可以直接提交 Pull Request 到 dev 分支。
* 如果是增加新的功能特性,请先创建一个 issue 并做简单描述以及大致的实现方法,提议被采纳后,就可以创建一个实现新特性的 Pull Request。
* 欢迎对说明文档做出改善,帮助更多的人使用 ShuiZe。
* 贡献代码请提交 PR 至 dev 分支,master 分支仅用于发布稳定可用版本。*提醒:和项目相关的问题最好在 issues 中反馈,这样方便其他有类似问题的人可以快速查找解决方法,并且也避免了我们重复回答一些问题。*
## Stargazers over time
[](https://starchart.cc/0x727/ShuiZe_0x727)