访问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抽象基bean类   Java中的字符串比较“=”有什么问题?   java Android VideoView无法播放视频   java Lucene 5.3 Highlighter getBestFragments()不工作   java将PDF直接从数据库打开到用户的PDF应用程序中   波形Java库用于确定wav文件中的语音注释   java gzip压缩器不支持while循环   java JUnit输出不包括小黄瓜前缀   java日志记录的复杂性和对MessageFormat性能的关注   spring是否有一种方法可以在每次使用Java控制器方法时调用该方法?   帮助器类上的java重写方法   java绘制曲线箭头,将箭头置于正确位置   内存mymap=new int[500000][500000]需要多大的Eclipse Java堆空间;没有OutOfMemoryError?   java Drools从具有不同事实的多个DRL文件中触发多个规则