目标信息搜集
目标信息搜集是渗透测试和安全评估的第一阶段,目的是尽可能多地收集目标组织、人员、系统和资产的信息。
搜集阶段分类
1. 被动搜集
不直接与目标系统交互,通过公开渠道获取信息。
2. 主动搜集
与目标系统直接交互,获取更详细的信息。
企业信息搜集
公司基本信息
在线查询平台
工商信息内容
1 2 3 4 5
| - 公司名称、法人代表 - 注册资本、成立时间 - 股东信息、高管信息 - 经营范围、注册地址 - 变更记录、行政处罚
|
技术资产发现
1. IP 地址和域名
1 2 3 4 5 6 7 8 9 10
| whois example.com
curl https://ipinfo.io/8.8.8.8
for ip in $(cat ips.txt); do whois $ip | grep -E "Organization|Country|NetRange" done
|
2. 网络资产
人员信息搜集
社交媒体侦察
LinkedIn
微信/公众号
邮箱搜集
1 2 3 4 5 6 7 8 9 10
| git clone https://github.com/laramies/theHarvester.git cd theHarvester python3 theHarvester.py -d example.com -b google -l 500
python3 theHarvester.py -d example.com -b google,bing,linkedin,github
python3 theHarvester.py -d example.com -b google -f results.html
|
邮箱格式猜测
1 2 3 4 5 6
| 常见格式: - firstname.lastname@domain.com - firstinitiallastname@domain.com - lastname@domain.com - firstname@domain.com - flastname@domain.com
|
网络资产测绘
Shodan
1 2 3 4 5 6 7 8 9 10
|
curl -X GET "https://api.shodan.io/shodan/host/search?query=org:Example&key=YOUR_API_KEY"
import shodan api = shodan.Shodan('YOUR_API_KEY') results = api.search('org:"Example Company"')
|
Fofa
1 2 3 4
| # 搜索语法 domain="example.com" cert="example.com" icon_hash="-123456789"
|
Hunter
1 2 3 4
| # 搜索语法 domain.example.com web.body="example.com" web.title="管理后台"
|
Censys
1 2 3 4 5
| curl -s "https://search.censys.io/api/v2/certificates/search?q=names: example.com&api_key=YOUR_API_KEY"
curl -s "https://search.censys.io/api/v2/hosts/search?q=services.tls.certificate.parsed.names: example.com"
|
GitHub 情报搜集
敏感信息搜索
1 2 3 4 5 6 7 8 9 10
|
curl "https://api.github.com/orgs/example-org/repos"
git clone https://github.com/UncleJ4ck/gitdorker.git python3 gitdorker.py -i domains.txt -s dorks.txt -o output/
|
常用 GitHub Dorks
1 2 3 4 5 6 7 8 9 10 11
| # API 密钥 org:target filename:.env API_KEY org:target filename:config.ini api_key
# 数据库连接 org:target extension:sql mysql_password org:target extension:env DB_PASSWORD
# 凭证文件 org:target filename:credentials org:target filename:.aws credentials
|
开源情报 (OSINT) 工具集成
Maltego
可视化情报收集工具,支持多种转换。
常用转换:
- DNS 枚举
- Whois 查询
- 社交媒体搜索
- 域名关联
自动化 OSINT 收集工具。
1 2 3 4 5 6 7 8
| git clone https://github.com/smicallef/spiderfoot.git cd spiderfoot pip3 install -r requirements.txt python3 sf.py -l 127.0.0.1:5001
python3 sf.py -m auto_scan -t example.com
|
端口和服务扫描
Nmap 基础扫描
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| nmap -sS -p- target.com
nmap -sU -p- target.com
nmap -sV -sC target.com
nmap -O target.com
nmap --script vuln -p- target.com
|
Masscan 快速扫描
1 2 3 4 5 6 7 8
| masscan -p1-65535 target.com --rate=10000
masscan -p80,443,8080,8443 target.com --rate=1000
masscan -p1-65535 target.com -oL results.txt --rate=10000
|
Web 应用发现
httpx
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| go install -v github.com/projectdiscovery/httpx@latest
httpx -l hosts.txt -o alive.txt
httpx -l hosts.txt -title -tech-detect -o details.txt
httpx -l hosts.txt -status-code -o status.txt
httpx -l hosts.txt -follow-redirects -o results.txt
|
nuclei
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| go install -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest
nuclei -l hosts.txt
nuclei -l hosts.txt -t /path/to/templates/
nuclei -update-templates
nuclei -l hosts.txt -severity critical,high
|
网站指纹识别
Wappalyzer
1 2 3 4
| curl -X POST "https://api.wappalyzer.com/v2/analyze" \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com", "apiKey": "YOUR_API_KEY"}'
|
WhatWeb
1 2 3 4 5 6 7 8 9 10 11
| whatweb example.com
whatweb -v example.com
whatweb -a 3 -i urls.txt -o output.txt
whatweb --log-json=results.json example.com
|
搜集框架
收集清单
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| ## 目标信息搜集清单
### 组织信息 - [ ] 公司名称、法人、注册资本 - [ ] 业务范围、主要产品 - [ ] 分支机构、关联公司 - [ ] 招聘信息(技术栈) - [ ] 新闻动态
### 网络资产 - [ ] 主域名和子域名 - [ ] IP 地址段 - [ ] CDN 使用情况 - [ ] 云服务使用情况 - [ ] 开放端口和服务
### 人员信息 - [ ] 员工邮箱 - [ ] 社交媒体账号 - [ ] 技术人员信息 - [ ] GitHub 账号
### 技术信息 - [ ] Web 应用框架 - [ ] 前端技术栈 - [ ] CMS 类型 - [ ] WAF 检测 - [ ] API 端点
### 安全状况 - [ ] 历史漏洞 - [ ] 安全事件 - [ ] 安全防护措施 - [ ] 合规认证
|
信息整理和分析
建立资产清单
1 2 3 4 5 6 7 8 9 10 11 12 13
| cat *.txt | sort -u > assets.txt
|
攻击面映射
使用工具绘制攻击面图谱:
1 2 3 4 5 6
| git clone https://github.com/six2dez/AttackSurfaceMapper.git python3 attack-surface-mapper.py example.com
python3 attack-surface-mapper.py -o report.html example.com
|
最佳实践
系统化搜集
- 按照清单逐项完成
- 记录数据来源和时间
- 保持信息的时效性
多源验证
隐私保护
- 遵守法律法规
- 不搜集个人敏感信息
- 仅用于合法授权测试
持续更新
防御建议
减少信息泄露
限制公开信息
- 最小化 Whois 信息暴露
- 审查公开文档中的敏感信息
监控暴露情况
- 定期搜索敏感信息
- 使用 Google Alerts
- 监控 GitHub 泄露
加强资产管理
人员安全意识