Shodan Skill
A comprehensive wrapper for the Shodan API using the official Python library.
Setup
- 1. Install dependencies:
CODEBLOCK0
- 2. Configure API Key:
CODEBLOCK1
Usage
1. Search (Advanced)
Search with limits, pages, and facets (statistics).
CODEBLOCK2
- *
--facets: Comma separated, e.g., country:5,org:5 (top 5 countries and orgs).
2. Count (Statistics)
Get the total count of results without consuming query credits for full details.
CODEBLOCK3
3. Host Details
Get details for an IP.
CODEBLOCK4
4. On-Demand Scan
Request Shodan to scan a network (consumes Scan Credits).
CODEBLOCK5
- *
<IPs>: Single IP, CIDR, or comma-separated list.
5. Network Alerts
Monitor your networks for exposure.
- * List Alerts: INLINECODE3
- Create Alert: INLINECODE4
- Alert Info: INLINECODE5
6. DNS & Domains
- * Domain Info: INLINECODE6
- Resolve: INLINECODE7
7. Account & Tools
- * Profile: INLINECODE8
- My IP: INLINECODE9
- Ports: INLINECODE10
- Protocols: INLINECODE11
8. Directory (Saved Queries)
- * Search Queries: INLINECODE12
- Popular Tags: INLINECODE13
9. Notifiers (Alerts)
- * List Notifiers: INLINECODE14
10. Exploits
- * Search Exploits: INLINECODE15
11. Stream (Realtime)
Stream realtime banners. Use --ports or --alert to filter.
CODEBLOCK6
12. Trends (Facets)
Use count with facets to analyze trends.
CODEBLOCK7
13. Cheat Sheets (Help)
- * List Filters: INLINECODE19
- List Banner Fields: INLINECODE20
Shodan 技能
一个使用官方 Python 库的 Shodan API 综合封装工具。
环境配置
- 1. 安装依赖:
bash
pip install shodan
- 2. 配置 API 密钥:
bash
shodan init
APIKEY>
使用方法
1. 高级搜索
支持限制数量、分页和分面统计。
bash
python3 {baseDir}/scripts/shodan_skill.py search --limit --page --facets
- * --facets:逗号分隔,例如 country:5,org:5(前 5 个国家和组织)。
2. 计数统计
获取结果总数,无需消耗查询积分获取完整详情。
bash
python3 {baseDir}/scripts/shodan_skill.py count --facets
3. 主机详情
获取指定 IP 的详细信息。
bash
python3 {baseDir}/scripts/shodan_skill.py host [--history] [--minify]
4. 按需扫描
请求 Shodan 扫描网络(消耗扫描积分)。
bash
python3 {baseDir}/scripts/shodan_skill.py scan
5. 网络告警
监控网络暴露情况。
- * 列出告警:python3 {baseDir}/scripts/shodanskill.py alertlist
- 创建告警:python3 {baseDir}/scripts/shodanskill.py alertcreate RANGE>
- 告警信息:python3 {baseDir}/scripts/shodanskill.py alertinfo ID>
6. DNS 与域名
- * 域名信息:python3 {baseDir}/scripts/shodanskill.py dnsdomain
- 解析:python3 {baseDir}/scripts/shodanskill.py dnsresolve
7. 账户与工具
- * 个人资料:python3 {baseDir}/scripts/shodanskill.py profile
- 我的 IP:python3 {baseDir}/scripts/shodanskill.py myip
- 端口:python3 {baseDir}/scripts/shodanskill.py ports
- 协议:python3 {baseDir}/scripts/shodanskill.py protocols
8. 目录(已保存查询)
- * 搜索查询:python3 {baseDir}/scripts/shodanskill.py querysearch
- 热门标签:python3 {baseDir}/scripts/shodanskill.py querytags
9. 通知器(告警)
- * 列出通知器:python3 {baseDir}/scripts/shodanskill.py notifierlist
10. 漏洞利用
- * 搜索漏洞利用:python3 {baseDir}/scripts/shodanskill.py exploitsearch
11. 实时流
实时流式传输横幅信息。使用 --ports 或 --alert 进行过滤。
bash
python3 {baseDir}/scripts/shodan_skill.py stream --limit 10
12. 趋势分析(分面)
使用带分面的 count 命令分析趋势。
bash
python3 {baseDir}/scripts/shodan_skill.py count apache --facets country
13. 速查表(帮助)
- * 列出过滤器:python3 {baseDir}/scripts/shodanskill.py filters
- 列出横幅字段:python3 {baseDir}/scripts/shodanskill.py datapedia