shodan使用教程
環境安裝:
- 1、在python下安裝shadon:pip3 install shadon
- 2、初始化api:shodan init 你的api
- 3、查詢剩余的查詢積分和掃描積分:
- shodan info
基本使用:
參考課程:DeeLMind的個人空間_嗶哩嗶哩_bilibili
參考官方文檔:Filter Reference (shodan.io)
-
shodan search :搜索
- --limit 1
- 只顯示1條,得到的數據比較多,各種數據都有
- --fields ip_str
- 只顯示ip
- --fields ip_str,port
- 只顯示ip和端口,中間用空格隔開
- 示例:shodan search --limit 1 --fields ip_str,port country:jp
- --limit 1
-
country:cn
- 限定國家為中國
-
port:3389
- 限定端口3389
-
shodan host 203.215.56.2
- 查看某個目標的詳細信息,包括是否存在漏洞
-
os:windows 7
- 限定操作系統為win7
-
device:webcam
- 限定攝像頭
-
device:router
- 限定路由器
-
device:switch
- 限定交換機
-
asn:"AS4538"
- 限定asn為4538的目標,也就是教育的目標
-
查找總的搜索結果有多少條
- shodan count asn:"AS4538" 查詢asn為4538的結果一共有多少條
- 易錯點:一定要注意,這里沒有search,沒有search
-
http.title:xx
- 查詢標題為xx的網站
-
搜索特定網段:net
- shodan count net:222.30.45.0/24 這是搜索南開大學的網段
-
搜索主域名
- hostname:"edu.com"
- hostname:"edu.cn"
-
搜索組織
- org:"Education"
- org:"edu"
-
搜索有waf的網站
- http.waf:Safedog 這是搜索有安全狗的
- 作用:后期學習waf繞過,需要找目標,可以通過這種方式尋找
-
查找html里的有關鍵字的目標
- http.html:"默認密碼" 查找html里有關鍵字 默認密碼的網站
-
has_vuln:True
- 限定存在漏洞的目標
-
查找存在特定漏洞的目標:高級會員及以上才可以用,我用的是高級會員
- shodan search vuln:cve-2019-0708 --limit 1
-
下載數據
-
下載全部數據:
- shodan download C:\Users\painter\Desktop\result --limit 2 asn:"AS4538"
- 將文件下載到桌面,文件名為result
- shodan download C:\Users\painter\Desktop\result --limit 2 asn:"AS4538"
-
提取數據:
-
shodan parse --fields ip_str,port,vulns re.json.gz > result.tx
- 注意,這里的re.json.gz就是上一步下載的數據,所以這個數據的路徑要根據實際情況來寫,我這里是因為都在桌面,所以直接寫的名字
-
-
特定漏洞
-
vnc未授權訪問
- "authentication disabled" port:5900 和edu的組合過,沒有edu的資產
-
查詢被黑網站
- http.title:"hacked by"
-
搜索思科未授權的設備
- shodan search --fields ip_str --limit 1 "cisco -authorized port:23"
- 思科cisco默認賬號和密碼
- 賬戶:admin/cisco
- 密碼:cisco
-
搜索后台
- shodan search --fields ip_str,port --limit 1 http.title:后台
-
搜索訪問需要密碼的頁面
- shodan search --fields ip_str,port --limit 1 http.title:password
-
查詢mongodb未授權訪問
- "MongoDB Server Information -authentication"
使用技巧:
-
技巧
-
查詢到的漏洞前往msf進行驗證
- msf 批量掃描:設置rhosts的時候,使用file關鍵字
- 1、先使用search 語法在msf中搜索漏洞
- 2、使用該模塊,用use
- 3、顯示參數:show options
- set rhosts file:/home/kali/Desktop/xx.txt
- msf 批量掃描:設置rhosts的時候,使用file關鍵字
-
查詢到的漏洞在互聯網上找poc進行驗證
-
-
易錯點:漏洞不成功
- 查看msf里的攻擊或者掃描模塊支持的對方的環境,使用 show targets 來進行查看
- 查看完,選定一個目標的環境,然后使用 set targets 數字 來進行選定
- 查看msf里的攻擊或者掃描模塊支持的對方的環境,使用 show targets 來進行查看