声明

学习视频来自 B 站up主泷羽sec,如涉及侵权马上删除文章。

笔记的只是方便各位师傅学习知识,以下网站只涉及学习内容,其他的都与本人无关,切莫逾越法律红线,否则后果自负。

B站地址:https://space.bilibili/350329294

在哪可以使用shodan

在线网页

https://www.shodan.io/

 

通过搜索框直接利用

 

这里只是先了解有哪些利用shodan的方式,后面再讲怎么样利用shodan

Python

需要用pip进行下载

pip install -U --user shodan

 

查看是否安装成功

pip show shodan

 

由图片信息可知,相关包位于

Location: C:\Users\Administrator\AppData\Roaming\Python\Python312\site-packages

添加 PATH 环境变量

将site-packages改为Scripts

C:\Users\Administrator\AppData\Roaming\Python\Python312\Scripts

可找到相关shodan

 

win搜索环境,点击编辑系统环境变量

 

点击环境变量

 

双击

 

新建相对应的路径,然后复制进去刚开始编辑好的路径

 

一路确定保存。

重新打开一个终端,输入shodan,安装成功

 

Search_Viewer

项目地址:https://github/G3et/Search_Viewer

下载地址:https://github/G3et/Search_Viewer/releases

 

先填好配置

 

然后就可以使用了

 

怎么样使用shodan(以Python为例)

官方文档(网页版)

地址:https://cli.shodan.io/

命令概述

ShodanCLI有很多命令,下面是最流行/最常见的命令。对于完整的命令列表,只需运行该工具而不带任何参数:

shodan
count

返回搜索查询的结果数。

shodan count microsoft iis 6.0

5310594

download

搜索Shodan并将结果下载到一个文件中,其中每行都是JSON横幅。有关横幅内容的更多信息,请查看:

默认情况下,它只会下载1,000个结果,如果你想下载更多,请查看**--limit**标志。

download命令是从Shodan获取结果时最常使用的命令,因为它允许您保存结果并在之后使用parse命令处理它们。因为在结果中分页使用查询配额,所以总是存储您正在执行的搜索是有意义的,这样您就不需要为过去已经执行的搜索使用查询配额。

 

host

查看有关主机的信息,例如主机所在位置、开放的端口以及哪个组织拥有该IP。

shodan host 189.201.128.250

 

myip

返回面向Internet的IP地址。

shodan myip
parse

使用parse分析使用download命令生成的文件。它可以让你过滤出你感兴趣的字段,将JSON转换为CSV,并且可以友好地连接到其他脚本。

以下命令以CSV格式输出以前下载的Microsoft-IIS数据的IP地址、端口和组织:

shodan parse --fields ip_str,port,org --separator , microsoft-data.json.gz

 

search

此命令允许您搜索Shodan并以终端友好的方式查看结果。默认情况下,它将显示IP,端口,主机名和数据。您可以使用**--fields**参数打印您感兴趣的任何横幅字段。

要搜索Microsoft IIS 6.0并打印其IP、端口、组织和主机名,请使用以下命令:

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

 

官方文档(命令行版)

Usage: shodan [OPTIONS] COMMAND [ARGS]...

Options:
  -h, --help  Show this message and exit.

Commands:
  alert       Manage the network alerts for your account
  convert     Convert the given input data file into a different format.
  count       Returns the number of results for a search
  data        Bulk data access to Shodan
  domain      View all available information for a domain
  download    Download search results and save them in a compressed JSON...
  honeyscore  Check whether the IP is a honeypot or not.
  host        View all available information for an IP address
  info        Shows general information about your account
  init        Initialize the Shodan command-line
  myip        Print your external IP address
  org         Manage your organization's access to Shodan
  parse       Extract information out of compressed JSON files.
  radar       Real-Time Map of some results as Shodan finds them.
  scan        Scan an IP/ netblock using Shodan.
  search      Search the Shodan database
  stats       Provide summary information about a search query
  stream      Stream data in real-time.
  trends      Search Shodan historical database
  version     Print version of this tool.

汉化文档

使用方式:shodan [选项] 命令 [参数]...

选项:
  -h, --help  显示此消息并退出。

命令:
  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. 搜索 Shodan 数据库

shodan search "server: Apache"

这个命令会搜索所有使用 Apache 服务器的设备。

  1. 查看特定 IP 地址的信息

shodan host 8.8.8.8

这个命令会显示 IP 地址 8.8.8.8 的所有可用信息。

  1. 下载搜索结果

shodan search "city: Paris" --fields ip_str,port,data --limit 100 | shodan download --rate-limit 10

这个命令会搜索所有位于巴黎的设备,限制结果为 100 条,并且每 10 秒下载一次数据。

  1. 检查 IP 是否是蜜罐

shodan honeyscore 192.168.1.1

这个命令会检查 IP 地址 192.168.1.1 是否是蜜罐。

  1. 查看域名信息

shodan domain example

这个命令会显示域名 example 的所有可用信息。

  1. 初始化 Shodan 命令行工具

shodan init

这个命令会初始化 Shodan 命令行工具,通常用于设置 API 密钥。

  1. 打印外部 IP 地址

shodan myip

这个命令会打印出你的外部 IP 地址。

  1. 实时数据流

shodan search "server: Apache" --stream

这个命令会实时流式传输所有使用 Apache 服务器的设备信息。

  1. 查看 Shodan 账户信息

shodan info

这个命令会显示关于你的 Shodan 账户的一般信息。

  1. 搜索 Shodan 历史数据库

shodan trends "server: Apache" --timespan 2023-01-01:2023-12-31

这个命令会搜索 Apache 服务器在 2023 年的历史数据。

初始化

shodan init <api key>

 

api在你登录shodan后的https://account.shodan.io/,点击Show即可查看

 

实战

批量搜索并检查CVE-2019-0708

高级会员

shodan search "vuln:CVE-2019-0708 country:JP" --fields ip_str --limit 1000 > cve-2019-0708_jp.txt

 

非高级会员【特征值搜索】

shodan search '"\x03\x00\x00\x0b\x06\xd0\x00\x00\x124\x00"' --fields ip_str --limit 1000 > cve-2019-0708.txt

 

以360 RDP****漏洞无损扫描器结合自编写Python脚本来进行批量检测

360 RDP漏洞无损扫描器:下载链接

github项目:https://github/hualy13/CVE-2019-0708-Check

 

VNC空密码

shodan search  "authentication disabled" port:5900  --fields ip_str > VNC空密码_jp.txt
shodan search  "authentication disabled" port:5900 country:jp --limit 1000 --fields ip_str > VNC空密码_jp.txt

 

使用vncviewer.exe连接

 

mongodb数据库
shodan search --limit 1000 --fields ip_str "Mongodb server information -authentication" port:27017 > mongodb.txt

随便进入一个,不过已经被攻破了

 

jenkins组件

shodan search --limit 1000 --fields ip_str,port "X-Jenkins" OR "Set-cookie:JSESSIONID" http.title:"Dashboard"

得到的结果多尝试尝试

 

文章推荐

1、自动化getshell

2、CVE-2019-0708 批量检测