最小的、一致的api,用于构建与恶意软件沙盒的集成。
sandboxapi的Python项目详细描述
用于构建与恶意软件沙盒集成的最小、一致的api。
此库当前支持以下沙盒系统:
它至少为每个沙盒提供以下方法:
- is_available():检查沙盒是否可操作且可访问;返回布尔值
- analyze(handle, filename):提交文件进行分析;返回item_id
- check(item_id):检查文件的分析是否已完成;返回布尔值
- report(item_id, report_format='json'):检索已提交文件的报告
- score(report):解析并返回报表对象的整数分数
一些沙盒类可能实现了其他方法。见内联 有关更多详细信息的文档。
注意,从score方法返回的值可能在范围内 0-10或0-100,这取决于所讨论的沙盒,因此您应该参考 解释此值时特定沙盒的文档。
安装
通过PIP安装:
pip install sandboxapi
支持Python2.7+。
用法
基本用法如下:
importsysimporttimeimportpprintfromsandboxapiimportcuckoo# connect to the sandboxsandbox=cuckoo.CuckooAPI('http://192.168.0.20:8090/')# verify connectivityifnotsandbox.is_available():print("sandbox is down, exiting")sys.exit(1)# submit a filewithopen('myfile.exe',"rb")ashandle:file_id=sandbox.analyze(handle,'myfile.exe')print("file {f} submitted for analysis, id {i}".format(f=filename,i=file_id))# wait for the analysis to completewhilenotsandbox.check(file_id):print("not done yet, sleeping 10 seconds...")time.sleep(10)# print the reportprint("analysis complete. fetching report...")report=sandbox.report(file_id)pprint.pprint(report)print("Score: {score}".format(score=sandbox.score(report)))
由于库提供了一致的api,因此可以处理所有沙盒 同样的方式:
importsysimporttimeimportpprintfromsandboxapiimportcuckoo,fireeye,joe# connect to the sandboxsandboxes=[cuckoo.CuckooAPI('http://192.168.0.20:8090/'),fireeye.FireEyeAPI('myusername','mypassword','https://192.168.0.21','winxp-sp3'),joe.JoeAPI('mykey','https://jbxcloud.joesecurity.org/api',True)]forsandboxinsandboxes:# verify connectivityifnotsandbox.is_available():print("sandbox is down, exiting")sys.exit(1)# submit a filewithopen('myfile.exe',"rb")ashandle:file_id=sandbox.analyze(handle,'myfile.exe')print("file {f} submitted for analysis, id {i}".format(f=filename,i=file_id))# wait for the analysis to completewhilenotsandbox.check(file_id):print("not done yet, sleeping 10 seconds...")time.sleep(10)# print the reportprint("analysis complete. fetching report...")report=sandbox.report(file_id)pprint.pprint(report)print("Score: {score}".format(score=sandbox.score(report)))
布谷鸟沙箱
构造函数签名:
CuckooAPI(url, verify_ssl=False)
示例:
CuckooAPI('http://192.168.0.20:8090/')
这个库试图支持任何类似杜鹃的api,包括旧的1.x 安装(尽管没有分数的安装将无法使用.score 方法),兼容的分叉,如Spender Sandbox和Cape,以及最新的2.x 布谷鸟释放。如果你发现一个版本不起作用,请告诉我们。
有一本由@keithjjones写的unofficial Cuckoo library,里面有很多 更多功能。有关布谷鸟api的更多信息,请参见Cuckoo API documentation。
火眼斧
构造函数签名:
FireEyeAPI(username, password, url, profile, legacy_api=False, verify_ssl=True)
示例:
FireEyeAPI('myusername', 'mypassword', 'https://192.168.0.20', 'winxp-sp3')
默认情况下,FireEyeAPI类使用FireEye API的1.2.0版,即 可在V8.x Fireeye Ax系列设备上使用。v1.1.0api,它是 在v7.x设备上可用,也受支持-只需设置legacy_api=True 使用旧版本。
他们的博客上有一些有限的FireEye API documentation。更多 有关FireEye沙箱系统的信息,请参见AX Series product page。 FireEye客户可以访问更多的API文档。
乔沙箱
构造函数签名:
JoeAPI(apikey, apiurl, accept_tac, timeout=None, verify_ssl=True, retries=3)
示例:
JoeAPI('mykey', 'https://jbxcloud.joesecurity.org/api', True)
有一个official Joe Sandbox library具有更多的功能。 此库作为sandboxapi的依赖项安装,并由 sandboxapi.joe.JoeSandbox类。
vmray分析仪
构造函数签名:
VMRayAPI(api_key, url='https://cloud.vmray.com', verify_ssl=True)
示例:
VMRayAPI('mykey')
vmray客户可以访问具有更多功能的python库。 有关详细信息,请查看vmray文档。
猎鹰沙箱
构造函数签名:
FalconAPI(key, url='https://www.reverse.it/api/v2', env=100)
示例:
FalconAPI('mykey')
这个类只支持Falcon API的2.0+版本,这是可用的 在Falcon沙箱的8.0.0+版本中。
有一个具有更多功能的official Falcon library,它 支持Falcon API的当前和旧版本。请注意 官方库只支持Python3.4+。
注释
您可能还对malsub感兴趣,这是一个支持 在线分析服务的数量。