访问StopBadware数据源的PythonAPI实现

pysbw的Python项目详细描述


python 3的实现 StopBadware<;https://www.stopBadware.org/>;私有api<;https://stopbadware.atlassian.net/wiki/display/apidocs/stopbadware+api+documentation+home>;。 在其当前形式中,它只实现从特定时间戳、IP地址和基于搜索的事件下载 在时间戳上。

如何使用

import pysbw
import time

api = pysbw.API('~/.stopbadware.key')

# Retrieve event reports for past 24 hours using UNIX style timestamp
json_response = api.retrieve(int(time.time()) - 24 * 3600)

# Retrieve event report with report UID
json_response = api.retrieve("564f2c78e4b0a131f050f844")

# Retrieve event reports for past 24 hours using search functionality
end = int(time.time())
json_response = self.api.search_between(end - 24 * 3600, end)

安装

pip3 install pysbw --pre

密钥文件示例

[sbw]
apikey=<String of private key>
publickey=<String of public key>

实例化

api = pysbw.API('~/.virustotal.key')  # The default way of using the
api = pysbw.API('', private_api_key=<PRIVATE API KEY>, public_api_key=<PUBLIC API KEY>)  # Providing other parameters
api = pysbw.API( ... , max_retires=<N: Number>)  # If specified the API will only retry <N> times to get the response
api = pysbw.API( ... , rate_limit={"requests": 40, "seconds": 300})  # The rate limits for the number of queries to the API

API

使用方法*retrieve()*获取报告。这种方法是第一次 参数可以是:

  • 从那以后检索报表的UTC格式的Unix时间戳 时间戳
  • 用点表示法的IP地址,如“8.8.8.8”,以检索所有 有关IP地址的报告
  • 事件报告uid,它是一个24位十六进制数。

retrieve()将尝试自动检测您提供的内容。如果你 要显式,可以将thing\u类型参数与 值:

  • IP
  • 时间戳
  • uid

这些值作为常量提供,您可以在 “api_constans”类,可以按如下方式导入

from pysbw import API_Constansts

使用方法*search_between()*搜索两个之间的事件 时间戳值。

参考文献

SBW API文档<;https://stopbadware.atlassian.net/wiki/display/apidocs/stopbadware+api+documentation+home>;

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
Java正则表达式:重复组?   java遇到COM异常:在调用时:AddItem Description:80004002/不支持此类接口   java获取ServletContextListener上的spring应用程序上下文   java工作簿。写入(fileoutputstream);写入空的excel文件   java如何在没有关系的情况下连接多个表   Java8流:列表到按分组的平面图   java如何在go-in firebase数据库中修改所有经过身份验证的用户的数据   java扫描器。hasNext()导致无限循环   jframe开发Java应用程序启动器   java局部变量类型推断   java我的viewpager实现在片段/活动方面让我很困惑   java如何在多模块项目中正确使用dependencyManagement?它在我的演示中总是无法工作   java Junit5和Maven:@BeforeAll初始化方法未被调用   java主应用程序线程在到达方法末尾之前不更新GUI   JavaSpring:MongoRepository count()和findAll()   java Android Studio滑动以更改屏幕   荡秋千。getPreferredSize不总是在Java 9中工作?   java在Android中以编程方式添加视图   多线程Java:线程技术与概念