与谷歌、百度等搜索引擎爬取网页信息不同,Shodan 爬取的是互联网上所有设备的 IP 地址及其端口号。而随着智能家电的普及,家家户户都有许多电器连接到互联网,这些设备存在被入侵的可能性,这是十分危险的。
Kali Linux 中自带 shodan,但是用户得先去 shodan 官方网站上注册,然后获得 api_key去激活 shodan 系统,具体命令是shodan init api_key,启动之后就可以在 Kali Linux 上自由使用了
shodan的官方网址:Shodan Search Engine
在Kali Linux 环境下使用shodan –h 命令去查看使用帮助
Commands:
1. alert Manage the network alerts for your account # 管理账户的网络提示
2. convert Convert the given input data file into a… # 转换输入文件
3. count Returns the number of results for a search # 返回查询结果数量
4. download Download search results and save them in a… # 下载查询结果到文件
5. honeyscore Check whether the IP is a honeypot or not. # 检查 IP 是否为蜜罐
6. host View all available information for an IP… # 显示一个 IP 所有可用的详细信息
7. info Shows general information about your account # 显示账户的一般信息
8. init Initialize the Shodan command-line # 初始化命令行
9. myip Print your external IP address # 输出用户当前公网IP
10. parse Extract information out of compressed JSON… # 解析提取压缩的JSON信息,即使用download下载的数据
11. scan Scan an IP/ netblock using Shodan. # 使用 Shodan 扫描一个IP或者网段
12. search Search the Shodan database # 查询 Shodan 数据库
13. stats Provide summary information about a search… # 提供搜索结果的概要信息
14. stream Stream data in real-time. # 实时显示流数据
请注意Shodan host 命令中的 IP 地址,必须是外网(公网)地址,而不是内网(局域网)地址。如果是局域网地址,是会报错的。关于外网地址和内网地址的差异,请参考 Dig 章节。
Kali Linux 上是命令行模式,也可以直接登录 shodan 网址,出来的是图形界面,使用图形化界面进行搜索展示更清晰。
备注:我使用的是免费版本,所以很多功能没有用到,大家有钱的可以充值试试,免费版本的话每天搜索的次数是有限制的。
那么 Shodan 是怎么工作的呢?Shodan 通过扫描全网设备并抓取解析各个设备返回的 banner 信息,通过了解这些信息 Shodan 就能得知网络中哪一种 Web 服务器是最受欢迎的,或是网络中到底存在多少可匿名登录的 FTP 服务器。
banner:http,ftp,telnet,ssh
常见语法:
1.net:搜索指定的IP地址或子网(192.168.1.1 192.168.2.0/24)
2.country:搜索指定的国家(CN,US,JP)
3.city:搜索指定的城市(beijing,kunming)
4.port:搜索指定的端口(22,80,53,3306)
5.OS:搜索指定的操作系统(windows,linux,)
6.hostname:搜索指定的主机或域名(baidu.com,223.5.5.6)
7.org:搜索指定的组织或公司(baidu,google)
8.isp:搜索指定的ISP供应商(china telecom)
9.version:搜索指定的软件版本(7.0)
10.server:搜索服务类型(apache,tomcat,nginx,iis,mysql…..)