Shodan的使用

2023-06-25

目录

Shodan

Shodan工作原理

Shodan的使用

使用搜索过滤

Kali中安装 Shodan

Kali中Shodan的使用


Shodan

Shodan 是一个搜索引擎,但它与 Google 这种搜索网址的搜索引擎不同,Shodan 是用来搜索网络空间中在线设备的,你可以通过 Shodan 搜索指定的设备,或者搜索特定类型的设备,其中 Shodan 上最受欢迎的搜索内容是:webcam,linksys,cisco,netgear,SCADA等等。

在windows系统上访问Shodan只需要访问链接:https://www.shodan.io/

Shodan工作原理

那么 Shodan 是怎么工作的呢?Shodan 通过扫描全网设备并抓取解析各个设备返回的 banner 信息,通过了解这些信息 Shodan 就能得知网络中哪一种 Web 服务器是最受欢迎的,或是网络中到底存在多少可匿名登录的 FTP 服务器,或者哪个ip对应的主机是哪种设备。

Shodan的使用

我们在左上角输入我们要搜索的关键字,然后下面就出来搜索结果了。比如我们搜索 SSH

上图的搜索结果包含两个部分,左侧是大量的汇总数据包括:

Results map – 搜索结果展示地图
Top services (Ports) – 使用最多的服务/端口
Top organizations (ISPs) – 使用最多的组织/ISP
Top operating systems – 使用最多的操作系统
Top products (Software name) – 使用最多的产品/软件名称

随后,在中间的主页面我们可以看到包含如下的搜索结果:

IP 地址
主机名
ISP
该条目的收录收录时间
该主机位于的国家
Banner 信息

想要了解每个条目的具体信息,只需要点击每个条目下方的 details 按钮即可。

我们还可以点击 Exploits ,Shodan 就会帮我们查找针对不同平台、不同类型可利用的 exploits。当然也可以通过直接访问网址来自行搜索:https://exploits.shodan.io/welcome;

我们还可以点击Maps,查看设备分布的地图

如果我们想生成报表,我们可以点击Create Report

我们还可以直接点击 Explore ,看网络上其他用户使用最多的搜索

如果像前面单纯只使用关键字直接进行搜索,搜索结果可能不尽人意,那么此时我们就需要使用一些特定的命令对搜索结果进行过滤。

使用搜索过滤

hostname:搜索指定的主机或域名,例如 hostname:"google"
port:搜索指定的端口或服务,例如 port:"21"
country:搜索指定的国家,例如 country:"CN"
city:搜索指定的城市,例如 city:"Hefei"
org:搜索指定的组织或公司,例如 org:"google"
isp:搜索指定的ISP供应商,例如 isp:"China Telecom"
product:搜索指定的操作系统/软件/平台,例如 product:"Apache httpd"
version:搜索指定的软件版本,例如 version:"1.6.2"
geo:搜索指定的地理位置,参数为经纬度,例如 geo:"31.8639, 117.2808"
before/after:搜索指定收录时间前后的数据,格式为 dd-mm-yy,例如 before:"11-11-15"
net:搜索指定的IP地址或子网,例如 net:"210.45.240.0/24"

Kali中安装 Shodan

Shodan 是由官方提供的 Python 库

安装命令:

git clone https://github.com/achillean/shodan-python.git && cd shodan-python
python setup.py install

Kali中Shodan的使用

Commands:
alert Manage the network alerts for your account # 管理账户的网络提示
convert Convert the given input data file into a... # 转换输入文件
count Returns the number of results for a search # 返回查询结果数量
download Download search results and save them in a... # 下载查询结果到文件
honeyscore Check whether the IP is a honeypot or not. # 检查 IP 是否为蜜罐
host View all available information for an IP... # 显示一个 IP 所有可用的详细信息
info Shows general information about your account # 显示账户的一般信息
init Initialize the Shodan command-line # 初始化命令行
myip Print your external IP address # 输出用户当前公网IP
parse Extract information out of compressed JSON... # 解析提取压缩的JSON信息,即使用download下载的数据
scan Scan an IP/ netblock using Shodan. # 使用 Shodan 扫描一个IP或者网段
search Search the Shodan database # 查询 Shodan 数据库
stats Provide summary information about a search... # 提供搜索结果的概要信息
stream Stream data in real-time. # 实时显示流数据

初始化Shodan:shodan  init   API_Key

返回查询结果的数量:shodan  count  SSH

将查询到的结果下载:shodan  download  microsoft-data microsoft iis 6.0  。将搜索结果下载到  ssh-data 文件中,文件中的每一行都是 JSON 格式存储的目标 banner 信息。默认情况下,该命令只会下载 100 条结果。如果我们想获取更多的结果,需要我们花钱注册,然后下载的时候指定 --limit 参数。

解析下载的数据:shodan parse --fields ip_str,port,org --separator , microsoft-data.json.gz

查看指定主机的相关信息,如地理位置信息,开放端口,甚至是否存在某些漏洞等信息。

shodan  search  microsoft iis 6.0

search查找,直接将查询结果展示在命令行中,默认情况下只显示IP、端口号、主机名和HTTP数据

当然我们也可以通过使用 –fields 来自定义显示内容,例如,我们只显示IP、端口号、组织名称和主机名:

shodan search --fields ip_str,port,org,hostnames microsoft iis 6.0

文章参考:FreeBuf-Shodan新手入坑指南

相关文章: Python脚本自动化破解大白鲨摄像头(Shodan)

Shodan的使用的相关教程结束。

《Shodan的使用.doc》

下载本文的Word格式文档,以方便收藏与打印。