共计 1399 个字符,预计需要花费 4 分钟才能阅读完成。
挺多用 shodan 的 mjj,这里发些高级点的搜索参数,注意 shodan 不支持正则匹配,所以下面的值都要是全名。 server=”xxx” // 值可以是 nginx 或者 apache 等等 country:”SG” // 国家 port:”443″ // 开启的端口 asn:”asxxxx” // asn
api 使用方法 1,打开 https://account.shodan.io/ 找到 API Key 2,安装 python3 和 pip 3,pip install shodan 4,复制下面代码到 sd.py 文件,注意 API Key 替换为第一步的 key
- import argparse
- import shodan
-
- # Configuration
- API_KEY = “xxx”
-
- parser = argparse.ArgumentParser(description=’Process shodan search’)
- parser.add_argument(‘filters’, type=str, nargs=’+’, help=’shodan search filters’)
- parser.add_argument(‘-p’, type=int, default=1, metavar=’page’, help=’page number’)
- args = parser.parse_args()
-
- try:
- # Setup the api
- api = shodan.Shodan(API_KEY)
-
- # Perform the search
- query = ‘ ‘.join(args.filters)
- result = api.search(query, args.p)
-
- # Loop through the matches and print each IP
- for service in result[‘matches’]:
- print (service[‘ip_str’])
- except Exception as e:
- print (‘Error: %s’ % e)
复制代码
5,运行命令 python3 sd.py server=”xxx” country:”SG” port:”443″ asn:”asxxx” -p 2 注意,shodan api 一次只能返回最多 100 条结果,一个月最多 10000 条结果
打包为可执行单文件方法,这样不用安装 python 和 shodan 就可以调 api 了 1,apt install build-essential python3-dev patchelf ccache 2,pip install virtualenv 3,virtualenv venv 4,cd venv && source bin/activate 5,pip install orderedset zstandard shodan 6,pip install -U –force-reinstall “https://github.com/Nuitka/Nuitka/archive/develop.zip” 7,复制 sd.py 到当前目录 8,python3 -m nuitka –onefile sd.py 9,运行./sd.bin server=”xxx” country:”SG” port:”443″ asn:”asxxx” |
网友回复:
注册 : 有漏洞让我直接抓一堆肉鸡挖矿吗
xqdoo00o: 注意这个是转到 c 语言编译了,速度比直接打包 py 快点