栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Python利用shadon进行信息收集

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Python利用shadon进行信息收集

常用shodan函数

shodan_api.count(query,facets=None) 查询结果数量
shodan_api.host(ip,history=False):获取一个IP的详细信息
shodan_api.port():获取Shodan可查询的端口号
shodan_api.protocols():获取Shodan可查询的协议
shodan_api.services():获取Shodan可查询的服务
shodan_api.scan(ips,force=False):使用Shodan进行扫描,ips可以为字符或字典类型

利用api查询信息
import shodan

key = '########'
api = shodan.Shodan(key)

res = api.search('nginx')
print(res['total'])

total查询结果主机数量
官网中可以查看键值

IP查询
import shodan

key = '########'
api = shodan.Shodan(key)

res = api.host('110.242.68.4')
print(res['country_name'])

China

同理 可以在官网SearchMethods中查看键值

shodan查询脚本
import shodan
import json
import sys

key = '########'
api = shodan.Shodan(key)

if len(sys.argv) == 1:
    print("usage: %s"%sys.argv[0])
    sys.exit(1)
try:
    query = ''.join(sys.argv[1:])
    result = api.search(query)
    for results in result['matches']:
        print(results['ip_str'] + ":" + str(results['port']))

except Exception as e:
    print("Error %s" %e)

Shodan搜索JAWS摄像头
import shodan
import json

key = '###'
api = shodan.Shodan(key)

res = api.search('JAWS/1.0')
print("found:%s"%res['total'])
for ress in res['matches']:
    print(ress['ip_str']+":"+str(ress['port']))

人生漫漫其修远兮,网安无止境。
一同前行,加油!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/354661.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号