shodan会员版命令行详细使用说明

使用前奏:基于命令行的shodan会员版,首先需要拿到key(登录后账号信息里有),要不然会提示“Error: Please run “shodan init <api key>” before using this command”
导入key:

root:~$ shodan init T1N3uP0Lyeq5w0wxxxxxxxxxxxxxxx

如果未安装则需要安装shodan

root:~$ pip install shodan //安装
root:~$ pip install -U shodan //后续升级

正式进入命令详细说明之前,先用娱乐一下:

curl parrot.live //丧的时候对着会舞动的终端发发呆还是可以的
curl wttr.in     //终端版天气显示,"宅"心仁厚久了,出门还是有必要看一眼的

1.显示自己公网IP

root:~$ shodan myip

2.创建监控指定IP网络警报/情报信息,如果发现就会发送邮件通知(shodan注册时的邮箱)

root:~$ shodan alert create home xxx.xxx.xxx.xxx/24 //监控指定IP或者IP段,home即监控名称,创建成功后提示如下信息:
Successfully created network alert!
Alert ID: G579Gxxxxxxxx

后续如果需要查看指定监控的IP是否存在信息泄漏等信息,可使用如下命令

root:~$ shodan alert info G579Gxxxxxxxx

当然,也可以开启指定ip相关的任何信息泄漏监控,开启命令如下:

root:~$ alert enable G579Gxxxxxxxx any //当然可以使用shodan alert triggers查看可以监控的服务,最后替换any为指定服务即可。

3.查看指定cve漏洞在shodan发现的总数

root:~$ shodan count vuln:cve-2019-0708 //显示结果:509187

当然也可以查看漏洞的地区分布情况:

root:~$ shodan stats vuln:cve-2019-0708

也可以根据分类查看漏洞,哪些是私有云服务器

root:~$ shodan stats --facets org vuln:cve-2019-0708 tag:cloud

列出存在漏洞的top20的私有云服务商

root:~$ shodan stats --facets org:20 vuln:cve-2019-0708 tag:cloud

查看指定端口指定协议总计数量和漏洞数量、以及系统相关筛选

root:~$ shodan count port:445 SMB  //显示445端口且是SMB协议总数,显示结果:12311
root:~$ shodan stats port:445 SMB //根据地区统计显示445端口SMB协议数据
root:~$ shodan stats --facets os port:445 SMB //根据操作系统分类统计数据
root:~$ shodan stats --facets os 'port:445 SMB -os:Unix'//筛选指定系统
root:~$ shodan stats port:445 SMB vuln:ms17-010 //筛选存在指定漏洞的数据

4.查看指定IP段在网络中存活信息、端口泄漏信息

root:~$ shodan count net:xxx.xxx.xxx.xxx/16 //显示结果:70746 

统计端口方面的泄漏信息

root:~$ shodan stats --facets port net:xxx.xxx.xxx.xxx/16 

下载指定ip段相关的信息

root:~$ shodan download --limit -1 name net:xxx.xxx.xxx.xxx/16 //name为下载保存的名称,-1 就是全部,下载内容的为所有服务器开放的信息数据

5.查看IP或者IP段存在的漏洞信息,应该是渗透初期最常用的命令之一

root:~$ shodan stats --facets vuln net:xxx.xxx.xxx.xxx/24 //显示某个段是否存在漏洞,或者指定某个IP

查看IP或者IP段存在漏洞的top10 信息

root:~$ shodan stats --facets vuln:100 net:xxx.xxx.xxx.xxx/24

6.查看主机信息,端口信息,开放的服务等其它详细信息,保存信息和查看下载的压缩包信息

root:~$ shodan host xxx.xxx.xxx.xxx //当前这个IP相关的所有信息
root:~$ shodan host --save xxx.xxx.xxx.xxx //保存当前这个IP相关信息
root:~$ shodan host --save --history xx.xx.xx.xx //保存IP历史相关信息,如果没有历史记录会提示"Error: Unable to parse JSON response"
root:~$ shodan paser xxx.xxx.xxx.xxx.json.gz //查看下载下来的数据信息
root:~$ shodan convert xxx.xxx.xxx.xxx.json.gz images //如果目标有漏洞,转化成实际漏洞利用成功后的截图,还可以转化成 xlsx、kml、csv、geo.json. 

7.shodan 在线扫描,端口等信息

root:~$ shodan scan submit xxx.xxx.xxx.xxx //因为shodan host 搜索出来的信息不是最新的,所以可以通过扫描命令获取最新的服务器信息

8.更多命令使用请使用 shodan --help查看