访问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多变量If语句   java使用带有maven的findbugsslf4j插件   stringbuilder Java三值运算符不工作?   java在Mac上使用Applet添加两个数字时,得到的和总是0   java在将Springboot从2.1.0迁移到2.2.1时出现Mongo错误   系统的java时间复杂性。阵列拷贝(…)?   java如何通过setter设置最终字段?   java结果集提前关闭   在Java中,这是将字符转换为字符串的正确方法吗?   java RAD JVM调试端口正在使用中   java在数据库中删除或插入后如何触发Jtable更新?   单击物料抽屉时,java将更改为另一个活动   java在新项目中使用gradle自定义插件及其依赖项   java valid方法在Netbeans RCP平台上的自定义选项面板上不起作用   java如何在按下键时停止对象移动