[渗透测试]-(信息收集)
字数 1736 2025-08-11 17:40:22

渗透测试信息收集全面指南

1. 信息收集概述

信息收集是渗透测试、红蓝对抗、CTF和漏洞挖掘中最关键的环节,决定了后续攻击的成功率。信息收集的目标包括:

  • 目标系统的组织架构
  • IT资产分布
  • 敏感信息泄露
  • 供应商信息
  • 域名和子域名
  • 服务器真实IP
  • 开放端口和服务
  • 网站目录结构
  • 历史漏洞信息

2. 备案查询

通过备案查询获取主域名和相关企业信息:

常用备案查询平台:

  • 天眼查:https://www.tianyancha.com/
  • 爱企查:https://aiqicha.baidu.com/
  • 企查查:https://www.qcc.com/
  • 官方ICP备案查询:https://beian.miit.gov.cn/

重点关注信息:

  • 企业注册信息
  • 关联企业
  • 法人代表
  • 联系方式(邮箱、电话)
  • 微博、QQ、微信等社交账号

3. 子域名收集

3.1 工具收集

1. OneForAll

git clone https://gitee.com/shmilylty/OneForAll.git
# 单个目标扫描
python oneforall.py --target example.com run
# 批量目标扫描
python oneforall.py --targets ./example.txt run

2. Amass

amass enum -v -src -ip -brute -min-for-recursive 2 -d example.com

3.2 搜索引擎收集

1. FOFA

domain="baidu.com"
header="baidu.com"
cert="baidu.com"
host="baidu.com"
body="baidu.com"

2. 钟馗之眼

https://www.zoomeye.org/

3. Shodan

https://www.shodan.io/

4. 鹰图

https://hunter.qianxin.com/

3.3 证书查询

crt.sh证书查询

https://crt.sh/?q=douyu.com

3.4 域名枚举工具Altdns

altdns -i subdomains.txt -o data_output -w words.txt -r -s results_output.txt

参数说明:

  • -i 已知子域列表文件
  • -o 生成的排列子域输出文件
  • -w 用于排列的单词列表
  • -r 解析每个生成的子域
  • -s 保存有效子域结果

4. 目录扫描

1. dirb

dirb https://www.douyu.com

2. dirsearch

dirsearch -u https://www.douyu.com

重点关注:

  • 备份文件(.bak, .zip等)
  • 管理后台(/admin, /login等)
  • 源码泄露(.git, .svn等)
  • 配置文件(config.php, web.config等)

5. 端口扫描

1. masscan

masscan 192.168.61.1 -p 1-65535 --rate=1000

2. nmap

nmap -sV -A -p- 127.0.0.1/24

6. Google Hacking技术

6.1 基本搜索语法

  • 逻辑与:and
  • 逻辑或:or
  • 逻辑非:-
  • 完整匹配:"关键字"
  • 通配符:*?

6.2 高级搜索语法

1. 查找管理后台

site:xx.com intext:管理
site:xx.com inurl:login
site:xx.com intitle:后台

2. 查看服务器程序

site:xx.com filetype:asp
site:xx.com filetype:jsp
site:xx.com filetype:php
site:xx.com filetype:aspx

3. 查找上传漏洞

site:xx.com inurl:file
site:xx.com inurl:load

4. 目录遍历漏洞

index of /admin
index of /passwd
index of /password
index of /mail
"index of /" + passwd
"index of /" + password.txt
"index of /" + .htaccess
"index of /root"
"index of /cgi-bin"
"index of /logs"
"index of /config"

7. GitHub信息收集

7.1 基本搜索语法

in:name test # 仓库标题搜索
in:description test # 仓库描述搜索
in:readme test # Readme文件搜索
stars:>3000 test # stars大于3000
forks:>1000 test # forks大于1000
size:>=5000 test # 仓库大于5MB
pushed:>2019-02-12 test # 发布时间
created:>2019-02-12 test # 创建时间
user:test # 用户名搜索
language:java test # 指定语言

7.2 敏感信息搜索

1. 邮件配置信息

site:Github.com smtp
site:Github.com smtp @qq.com
site:Github.com smtp password
site:Github.com String password smtp

2. 数据库信息

site:Github.com sa password
site:Github.com root password
site:Github.com User ID='sa';Password
site:Github.com inurl:sql

3. SVN信息

site:Github.com svn
site:Github.com svn username
site:Github.com svn password
site:Github.com svn username password

8. 真实IP查找

8.1 CDN识别工具

多地ping工具:

  • https://ping.chinaz.com/
  • https://get-site-ip.com/
  • https://tools.ipip.net/cdn.php
  • http://17ce.com/
  • https://www.cdnplanet.com/tools/cdnfinder/

8.2 历史DNS记录查询

https://dnsdb.io/zh-cn/
https://x.threatbook.cn/
http://toolbar.netcraft.com/
https://community.riskiq.com/
http://www.crimeflare.com/cfssl.html

8.3 其他方法

  1. 通过子域名查找(子站可能未使用CDN)
  2. 使用国外主机直接访问(部分CDN仅解析国内线路)
  3. 通过网站漏洞获取真实IP
  4. 利用应用功能获取反向连接

9. C段扫描

1. nmap

nmap -sV -A -p- 127.0.0.1/24

2. goby
图形化工具,支持漏洞验证和POC测试

3. fscan

https://github.com/shadow1ng/fscan

快速主机存活探测、端口扫描、服务爆破

10. 存活探测与指纹识别

1. Finger

https://github.com/EASY233/Finger

红队专用,在大量资产中快速识别重点攻击目标

2. Vxscan

https://github.com/al0ne/Vxscan

综合扫描工具,包含存活验证、敏感文件探测、WAF识别等

3. EHole

https://github.com/EdgeSecurityTeam/EHole

从大量资产中精准定位易受攻击系统

11. APP信息收集

1. 工具收集

  • ENScan:https://github.com/wgpsec/ENScan_GO
  • AppInfoScanner:https://github.com/kelvinBen/AppInfoScanner
python app.py android -i 1.apk

2. 收集渠道

  • 应用商店(豌豆荚等)
  • 支付宝/微信小程序
  • 企业官网下载PC应用
  • 历史版本APP

12. 其他信息收集方法

1. whois查询

https://whois.chinaz.com/
https://x.threatbook.com/

2. DNS查询

https://dnsdumpster.com/
https://hackertarget.com/find-shared-dns-servers

3. 众测平台

  • 查看厂商公布的资产范围
  • 分析CNVD平台历史漏洞

4. IP反查域名

https://github.com/Sma11New/ip2domain

5. IP注册信息查询

https://ipwhois.cnnic.net.cn/

13. 信息整理与分析

收集到信息后需要:

  1. 分类整理(域名、IP、服务等)
  2. 标记重点目标(管理后台、老旧系统等)
  3. 分析薄弱环节(已知漏洞、默认凭证等)
  4. 制定攻击路径

通过系统化的信息收集,可以显著提高渗透测试的成功率,为后续的漏洞利用、权限提升和横向移动奠定基础。

渗透测试信息收集全面指南 1. 信息收集概述 信息收集是渗透测试、红蓝对抗、CTF和漏洞挖掘中最关键的环节,决定了后续攻击的成功率。信息收集的目标包括: 目标系统的组织架构 IT资产分布 敏感信息泄露 供应商信息 域名和子域名 服务器真实IP 开放端口和服务 网站目录结构 历史漏洞信息 2. 备案查询 通过备案查询获取主域名和相关企业信息: 常用备案查询平台: 天眼查:https://www.tianyancha.com/ 爱企查:https://aiqicha.baidu.com/ 企查查:https://www.qcc.com/ 官方ICP备案查询:https://beian.miit.gov.cn/ 重点关注信息: 企业注册信息 关联企业 法人代表 联系方式(邮箱、电话) 微博、QQ、微信等社交账号 3. 子域名收集 3.1 工具收集 1. OneForAll 2. Amass 3.2 搜索引擎收集 1. FOFA 2. 钟馗之眼 3. Shodan 4. 鹰图 3.3 证书查询 crt.sh证书查询 3.4 域名枚举工具Altdns 参数说明: -i 已知子域列表文件 -o 生成的排列子域输出文件 -w 用于排列的单词列表 -r 解析每个生成的子域 -s 保存有效子域结果 4. 目录扫描 1. dirb 2. dirsearch 重点关注: 备份文件(.bak, .zip等) 管理后台(/admin, /login等) 源码泄露(.git, .svn等) 配置文件(config.php, web.config等) 5. 端口扫描 1. masscan 2. nmap 6. Google Hacking技术 6.1 基本搜索语法 逻辑与: and 逻辑或: or 逻辑非: - 完整匹配: "关键字" 通配符: *? 6.2 高级搜索语法 1. 查找管理后台 2. 查看服务器程序 3. 查找上传漏洞 4. 目录遍历漏洞 7. GitHub信息收集 7.1 基本搜索语法 7.2 敏感信息搜索 1. 邮件配置信息 2. 数据库信息 3. SVN信息 8. 真实IP查找 8.1 CDN识别工具 多地ping工具: https://ping.chinaz.com/ https://get-site-ip.com/ https://tools.ipip.net/cdn.php http://17ce.com/ https://www.cdnplanet.com/tools/cdnfinder/ 8.2 历史DNS记录查询 8.3 其他方法 通过子域名查找(子站可能未使用CDN) 使用国外主机直接访问(部分CDN仅解析国内线路) 通过网站漏洞获取真实IP 利用应用功能获取反向连接 9. C段扫描 1. nmap 2. goby 图形化工具,支持漏洞验证和POC测试 3. fscan 快速主机存活探测、端口扫描、服务爆破 10. 存活探测与指纹识别 1. Finger 红队专用,在大量资产中快速识别重点攻击目标 2. Vxscan 综合扫描工具,包含存活验证、敏感文件探测、WAF识别等 3. EHole 从大量资产中精准定位易受攻击系统 11. APP信息收集 1. 工具收集 ENScan:https://github.com/wgpsec/ENScan_ GO AppInfoScanner:https://github.com/kelvinBen/AppInfoScanner 2. 收集渠道 应用商店(豌豆荚等) 支付宝/微信小程序 企业官网下载PC应用 历史版本APP 12. 其他信息收集方法 1. whois查询 2. DNS查询 3. 众测平台 查看厂商公布的资产范围 分析CNVD平台历史漏洞 4. IP反查域名 5. IP注册信息查询 13. 信息整理与分析 收集到信息后需要: 分类整理(域名、IP、服务等) 标记重点目标(管理后台、老旧系统等) 分析薄弱环节(已知漏洞、默认凭证等) 制定攻击路径 通过系统化的信息收集,可以显著提高渗透测试的成功率,为后续的漏洞利用、权限提升和横向移动奠定基础。