本文介绍Shodan提供的Python API开发环境基本配置过程及脚本示例。以上内容在官方说明文档中都有详细描述,如果想深入了解推荐前往以下链接查阅:
Shodan官网:https://www.shodan.io
Python API Document:https://shodan.readthedocs.io/en/latest/
环境说明
OS: Kali GNU/Linux Rolling 2019.4
Python 2.7.16+
环境准备
首先要去官网注册一个账户,然后趁着黑五打折入一个5$的membership终身会员,否则即使有了API Key,也无法执行带过滤条件的查询,笔者这里分享自己的API Key: Vvm2atebzfedrKuMDLFNbJf2hlxyDRed ,不过一个月只有100查询凭证,先用先得吧。
# 安装pip
root@kali:~/Downloads# apt-get install python-pip
......
# 安装shodan库
root@kali:~/Downloads# pip install shodan
Collecting shodan
Downloading https://files.pythonhosted.org/packages/f9/46/b3aaa376a5c3e5ad15b61bb0e2914477926e900885ee7ce482fe4f1cd237/shodan-1.21.3.tar.gz (50kB)
100% |████████████████████████████████| 51kB 4.4kB/s
Collecting XlsxWriter (from shodan)
Downloading https://files.pythonhosted.org/packages/00/1f/2092a81056d36c1b6651a645aa84c1f76bcee03103072d4fe1cb58501d69/XlsxWriter-1.2.8-py2.py3-none-any.whl (141kB)
100% |████████████████████████████████