访问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如何访问Struts2中的请求参数?   java将大图像设置为背景   java如何使用子查询。在里面   java我希望我的计算器重新启动,直到我按下“q”字母   将Java Http服务器的响应写入jQuery   java JPA/HSQLDB仍然在消耗我所有的内存   使用MySql结果集数据在Java Swing应用程序中创建图形和图表   java创建一个程序,从用户那里获取输入并将其写入输出文件   java Windows无法删除具有大路径的文件   java方法运行它3次   java如何仅为Http状态代码500配置RetryTemplate?   java读取,从JAR写入外部xml文件   如何在安卓 java中实现自定义导航栏,如图所示   java使用ApacheCamel框架将数据持久化为Oracle DB中的BLOB/CLOB数据类型