信息收集利器-shodan干货教程

学习视频笔记均来自B站UP主" 泷羽sec",如涉及侵权马上删除文章
笔记的只是方便各位师傅学习知识,以下只涉及学习内容,其他的都与本人无关,切莫逾越法律红线,否则后果自负

链接直达:https://space.bilibili.com/350329294

介绍

Shodan 是一个专门用于信息安全的搜索引擎,它通过互联网扫描,收集各种联网设备的信息和开放端口,并整理出各类网络资产的详细数据。Shodan 搜索的对象包括但不限于服务器、摄像头、路由器、工业控制系统(ICS)、物联网设备(IoT)、数据库和其他网络设备。与传统搜索引擎聚焦网页内容不同,Shodan 主要采集设备的元数据,如开放端口、设备型号、操作系统、使用的协议、服务状态、证书信息等。

安装及基本用法

kali Linux安装

  1. 克隆shodan文件
git clone https://github.com/achillean/shodan-python.git
  1. setup执行安装
cd shadon-python
python setup.py install
  1. shodan初始化
shodan init api_key
  1. 查看帮助文档
shodan -h

相关参数解释

Commands:

alert 管理您账户的网络警报

convert 将给定输入数据文件转换为不同格式

count 返回搜索结果的数量

data 批量访问 Shodan 数据

domain 查看域名的所有可用信息

download 下载搜索结果并将其保存为压缩 JSON 文件

honeyscore 检查 IP 是否为蜜罐

host 查看 IP 地址的所有可用信息

info 显示有关您账户的一般信息

init 初始化 Shodan 命令行

myip 打印您的外部 IP 地址

org 管理您组织对 Shodan 的访问

parse 从压缩的 JSON 文件中提取信息

radar Shodan 实时发现的一些结果地图

scan 使用 Shodan 扫描 IP/网段

search 搜索 Shodan 数据库

stats 提供搜索查询的摘要信息

stream 实时流数据

trends 搜索 Shodan 历史数据库

version 打印此工具的版本信息

基本用法

  1. alert - 管理网络监控警报

功能:管理 Shodan 帐户的网络警报,通过对特定 IP 地址或网段的监控,及时获取设备变化。

使用场景:用于监控公司网络、家庭设备的安全状况。

示例:

shodan alert create "My Server" 192.168.1.1

此命令将在指定的 IP 地址 192.168.1.1 上创建一个名为 “My Server Alert” 的警报。

  1. convert - 数据格式转换

功能:将输入数据文件转换为 Shodan 支持的格式。

使用场景:当已有扫描结果的格式不符合 Shodan 要求时,可以使用该命令完成格式转换。

  1. count - 获取查询结果数量

功能:返回指定搜索条件的结果数量。

使用场景:快速了解某一搜索条件的匹配数量,有助于预估搜索结果规模。

示例:

shodan count port:80 country:US
  1. download - 下载搜索结果

功能:根据查询条件下载搜索结果,便于离线存储与分析

示例:

shodan download apache_servers "apache country:US" --limit 10
  1. honeyscore - 检查蜜罐设备

功能:检测某个 IP 是否是蜜罐设备(honeypot)。
使用场景:在进行安全评估时,可用于识别伪装成真实设备的蜜罐。
示例:

shodan honeyscore 8.8.8.8
  1. host - 获取 IP 详细信息

功能:查看特定 IP 地址的所有详细信息。

使用场景:当对某个设备的详细网络状态、端口开放情况感兴趣时使用。

示例:

shodan host 8.8.8.8
  1. info - 显示账户信息

功能:查看当前账户的 API 使用情况和查询额度。

示例:

shodan info
  1. init - 初始化 Shodan CLI

功能:初始化 Shodan CLI,并绑定 API Key。

示例:

shodan init YOUR_API_KEY
  1. myip - 查看外部 IP 地址

功能:返回当前设备的公网 IP。

示例:

shodan myip
  1. parse - 解析下载的 JSON 数据

功能:解析使用 download 命令下载的 JSON 数据文件,便于提取关键字段。

示例:

shodan parse apache_servers.json.gz --fields ip_str,port
  1. scan - 使用 Shodan 扫描 IP 或网段

功能:通过 Shodan 对 IP 或 IP 段进行扫描,获取实时数据(需高级帐户权限)。

示例:

shodan scan submit 192.168.1.0/24
  1. search - 数据库查询

功能:在 Shodan 数据库中搜索特定设备或服务。

示例:

shodan search [query] [options] [filters]

其中query是指定搜索内容,options是参数,filters是过滤器

options包含以下参数:

参数说明示例
--color启用颜色输出--color
--no-color禁用颜色输出--no-color
--fields TEXT列出在搜索结果中显示的属性。--fields ip_str,port
--limit INTEGER应返回的搜索结果数量。最大值为 1000。--limit 100
--separator TEXT搜索结果属性之间的分隔符。--separator ","
-h, --help显示帮助信息并退出。--help

其中–fields(选取返回字段)包含以下字段

字段描述
ip_str设备的 IP 地址。
port设备的开放端口。
hostnames设备的主机名。
org设备所属组织。
asn设备的自编号(ASN)。
data设备返回的原始数据。
timestamp结果返回的时间戳。
location设备的地理位置信息。包括城市,国家
product设备上运行的产品名称。
version设备上运行的版本。
os (偶尔有)设备的操作系统。
ssl设备的 SSL 证书信息。
http设备的 HTTP 服务信息。
vuln设备存在的漏洞信息。
tags设备的标签信息。
domains设备相关的域名。
cert设备的 SSL 证书信息。

filter条件

字段说明示例
after搜索指定收录时间之后的数据,格式为 dd-mm-yyafter:"11-11-15"
before搜索指定收录时间之前的数据,格式为 dd-mm-yybefore:"11-11-15"
city搜索指定的城市city:"Hefei"
cloud.provider搜索指定的云服务提供商cloud.provider:"AWS"
cloud.region搜索指定的云服务区域cloud.region:"us-east-1"
cloud.service搜索指定的云服务类型cloud.service:"EC2"
device搜索指定的设备类型device:"router"
geo搜索指定的地理位置,参数为经纬度geo:"31.8639, 117.2808"
has_vuln搜索是否存在已知漏洞的设备has_vuln:true
hostname搜索指定的主机或域名hostname:"google"
isp搜索指定的 ISP 供应商isp:"China Telecom"
net搜索指定的 IP 地址或子网net:"210.45.240.0/24"
org搜索指定的组织或公司org:"google"
port搜索指定的端口或服务port:"21"
product搜索指定的操作系统/软件/平台product:"Apache httpd"
region搜索指定的区域region:"CA"
ssl搜索是否使用 SSLssl:true
state搜索指定的州/省state:"California"
tag搜索指定的标签tag:"test"
version搜索指定的软件版本version:"1.6.2"
http.title搜索指定的 HTTP 标题http.title:"Welcome"
http.html搜索指定的 HTML 内容http.html:"<html>"
http.status搜索指定的 HTTP 状态码http.status:200
ip搜索指定的 IP 地址ip:"192.168.1.1"
  1. stats - 查询结果统计信息

功能:返回某个查询条件的统计信息。

示例:

shodan stats apache --facets country
  1. stream - 实时流数据

功能:实时显示 Shodan 数据流,适合进行网络监控和快速分析。

示例:

shodan stream banners

高阶用法

Search

搜索shodan的数据库

  1. 扫描日本的IP地址
shodan search --limit 10 country:jp
  1. 限定扫描内容ip和端口
shodan search --limit 10 --fields ip,port country:jp
shodan search --limit 10 --fields ip_str,port country:jp
shodan search --limit 10 --fields ip_str,port 80 country:jp
shodan search --color --limit 10 --fields ip_str port:3389 country:cn city:shenzhen

参数color,将搜查数据重点标色

shodan search --limit 10 --fields ip_str,port:3389 country:cn city:shenzhen os:windows 11
  1. 查看有漏洞设备
shodan search has_vuln:True port:3389 country:cn city:shenzhen os:windows 7 --fields ip_str --limit 10
  1. 查看摄像头
shodan search --limit 10 --fields ip_str,port:3389 country:cn city:shenzhen device:webcam
  1. 查看路由器
shodan search --limit 10 --fields ip_str,port:3389 country:cn city:shenzhen device:router
  1. 查看web设备
shodan search --limit 10 --fields ip_str,port:3389 country:cn city:shenzhen tp-link
  1. 查询漏洞
shodan search --limit 10 --fields ip_str,port '"\x03\x00\x00\x0b\x06\xd0\x00\x00\x124\x00"'

上面十六进制字符串为CVE-2019-0708的漏洞特征, 漏洞对应3389端口开放

shodan search vuln:CVE-2019-0708

vuln参数需要高级会员及以上

CVE-2019-0708 是一个高危的远程桌面服务漏洞,它允许未经身份验证的攻击者通过 RDP(远程桌面协议)连接到目标系统并发送特殊设计的请求来执行远程代码。这个漏洞是预身份验证的,不需要用户交互,即攻击者可以在目标系统上执行任意代码,安装程序,查看、更改或删除数据,或者创建具有完全用户权限的新账户

MSF验证

使用msfconsole查找CVE-2019-0708的利用模块

search 0708

可以看到四个利用模块,选择第二个

use exploit/windows/rdp/cve_2019_0708_bluekeep_rce

展示可能存在漏洞的操作系统

show targets

将上图IP导入一个txt(0708),设置目标主机

set rhosts file:0708.txt

批量检测目标IP是否可以漏洞利用

check

  1. 查看vnc空密码
shodan search --limit 10 --fields ip_str "authentication disabled" port 5900 country:jp
  1. 查看黑页
shodan search --limit 10 --fields ip_str,port http.title:hacked by country:cn city:shenzhen
  1. 查看思科弱口令
shodan search --limit 10 --fields ip_str,port "cisco -authorized port:23" country:cn
  1. 查询网段
shodan search --limit 10 --fields ip_str,port net 208.88.84.0/24
  1. 查询社会组织IP
shodan search --limit 10 --fields ip_str,port org:nsa.gov
shodan search --limit 10 --fields ip_str,port org:Tencent
  1. 查询主机IP
shodan search --limit 10 --fields ip_str,port hostname:google
  1. 查询安装安全狗的网站
shodan search --limit 10 --fields ip_str,port country:cn http.waf:safedog
  1. 查询前端页面含特定关键字的IP
shodan search --limit 10 --fields ip_str,port country:cn http.html:login
  1. 查询Mongodb未授权登录
shodan search --limit 10 --fields ip_str "Mongodb server information -authentication" port:27017
  1. 根据响应头查询jenkins组件
shodan search --limit 10 --fields ip_str "X-Jenkins" OR "Set-cookie:JSESSIONID" http.title:"Dashboard"

Jekins:

  1. 皓峰防火墙登录
shodan search --limit 10 --fields ip_str,port http.html:"皓峰防火墙系统登录"
  1. 查看中间件
shodan search --limit 10 --fields ip_str,port product:Apache

Host

  1. 查看主机详细信息
shodan host 47.107.33.31
  1. 查看IP历史解析
shodan host 160.251.63.158 --history

Download

将搜索结果下载为json压缩包文件

shodan download CVE_2019_0708 --limit 100 '"\x03\x00\x00\x0b\x06\xd0\x00\x00\x124\x00"'

shodan download --limit 10 "authentication disabled" port:5900

Parse

将下载的json压缩包解压

shodan parse --fields ip_str CVE_2019_0708.json.gz

保存文件

shodan parse --fields ip_str CVE_2019_0708.json.gz > ip.txt

Count

shodan count '"\x03\x00\x00\x0b\x06\xd0\x00\x00\x124\x00"'

Honeyscore

Scan

shodan scan -h

  1. 扫描IP
shodan scan submit IP/CIDR
  1. 查看扫描信息
shodan scan list
  1. 查询特定扫描状态
shodan scan status <scan_id>

Domain

  1. 收集子域名列表
shodan domain baidu.com

Stats

统计中国使用了ssl的ip数量,并用版本做统计

Awesome Shodan Search Queries收集

  1. cve-2014-0160****漏洞影响的设备数量:
shodan count vuln:cve-2014-0160 
80467
  1. 为你的网络创建一个私人防护并订阅它
shodan alert create mynetwork 198.20.58.0/24 && shodan stream --alerts=all
  1. 查找位于瑞士的服务器最常见的10个漏洞
shodan stats --facets vuln country:CH 
  1. D-Link网络摄像机DCS-5300系列,无需身份验证
shodan search 'd-Link Internet Camera, 200 OK'
  1. 启用匿名身份验证的FTP服务器
shodan search '230 login successful port:21'
  1. 数据库
# MySQL 
shodan search 'product:MySQL' 

# MongoDB 
shodan search 'product:MongoDB' 

# elastic 
shodan search 'port:9200 json' 

# Memcached 
shodan search 'product:Memcached' 

# CouchDB 
shodan search 'product:CouchDB' 

# PostgreSQL 
shodan search 'port:5432 PostgreSQL' 

# Riak 
shodan search 'port:8087 Riak' 

# Redis 
shodan search 'product:Redis' 

# Cassandra 
shodan search 'product:Cassandra'
  1. 游戏
# Minecraft 
shodan search 'Minecraft Server port:25565' 

# Counter-Strike: Global Offensive 
shodan search 'product:"Counter-Strike Global Offensive"' 

# Starbound 
shodan search 'product:Starbound' 

# ARK: Survival Evolved 
shodan search 'product:"ARK Survival Evolved"'
  1. 工业控制系统
# XZERES Wind Turbine 
shodan search 'title:"xzeres wind"' 

# PIPS Automated License Plate Reader 
shodan search 'html:"PIPS Technology ALPR Processors"' 

# Modbus 
shodan search 'port:502' 

# Niagara Fox 
shodan search 'port:1911,4911 product:Niagara' 

# GE-SRTP 
shodan search 'port:18245,18246 product:"general electric"' 

# MELSEC-Q 
shodan search 'port:5006,5007 product:mitsubishi' 

# CODESYS 
shodan search 'port:2455 operating system' 

# S7 
shodan search 'port:102' 

# BACnet 
shodan search 'port:47808' 

# HART-IP 
shodan search 'port:5094 hart-ip' 

# Omron FINS 
shodan search 'port:9600 response code' 

# IEC 60870-5-104 
shodan search 'port:2404 asdu address' 

# DNP3 
shodan search 'port:20000 source address' 

# EtherNet/IP 
shodan search 'port:44818' 

# PCWorx 
shodan search 'port:1962 PLC' 

# Crimson v3.0 
shodan search 'port:789 product:"Red Lion Controls"' 

# ProConOS 
shodan search 'port:20547 PLC'
  1. 被黑的Ubiquiti Networks设备
shodan search 'hacked-router-help-sos'
  1. 监控摄像头,用户:admin,无密码
shodan search "default password" "cam"
  1. 家用路由器的存储设备/附加的USB存储设备
shodan search 'IPC$ all storage devices'
  1. 无需身份验证的PBX电话网关
shodan search 'port:23 console gateway -password'
  1. Lantronix以太网适配器的管理界面,无需密码
shodan search 'Press Enter for Setup Mode port:9999'
  1. Polycom视频会议系统免认证shell
shodan search '"polycom command shell"'
  1. 未经身份验证的VNC服务器
shodan search '"authentication disabled" port:5900,5901'
  1. NPort串口转eth / MoCA设备无密码
shodan search 'nport -keyin port:23'
  1. Jenkins默认安装
shodan search 'http.favicon.hash:81586312'
  1. SonarQube安装
shodan search 'http.favicon.hash:1485257654'
  1. IBM WebSphere版本泄漏
shodan search 'WASRemoteRuntimeVersion'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值