Python利用shadon进行信息收集
2021/10/28 22:39:53
本文主要是介绍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']))
人生漫漫其修远兮,网安无止境。
一同前行,加油!
这篇关于Python利用shadon进行信息收集的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-10-04Python外包有哪些常见的主要库-icode9专业技术文章分享
- 2024-10-02基于深度学习的钢铁缺陷检测系统(yolov8、注意力机制、PyQt5界面、Python)
- 2024-10-01怎么用python搭建一个系统-icode9专业技术文章分享
- 2024-09-30Python基础入门教程
- 2024-09-30获取参数学习:Python中的基础教程
- 2024-09-30Python编程基础详解
- 2024-09-29点击加载学习:Python编程基础教程
- 2024-09-29数据科学五大Python前端库:第二部分
- 2024-09-27使用python 将ETH账户的资产打散
- 2024-09-26Python编程基础