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']))

在这里插入图片描述

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

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值