
A lightweight Python module to interact with the [MITRE ATT&CK®](https://attack.mitre.org/) Enterprise dataset. Built for speed with minimal dependencies. [Read the docs](https://gitlab.com/xakepnz/enterpriseattack/tree/main/docs) for more info.
一个轻量级的 Python 模块,用于与 MITRE ATT&CK 企业数据集进行交互。由于其速度快且依赖极少,专为生产环境中的应用而构建。更多信息请参阅文档。
MITRE ATT&CK® 是一个全球可访问的知识库,收录了基于真实世界观测得出的对手战术与技术。ATT&CK 知识库被用作私营部门、政府以及网络安全产品和服务社区开发特定威胁模型和方法论的基础。
pip3 install enterpriseattack
git clone https://gitlab.com/xakepnz/enterpriseattack.git
cd enterpriseattack
python3 setup.py install
(返回顶部)
docker build enterpriseattack:0.1.8 .
docker tag enterpriseattack:0.1.8 enterpriseattack:latest
docker run enterpriseattack
(返回顶部)
import enterpriseattack
attack = enterpriseattack.Attack()
直接从 Attack 类访问任意对象,而无需通过迭代查找特定对象。
attack = enterpriseattack.Attack(subscriptable=True)
wizard_spider = attack.groups.get('Wizard Spider')
print(len(wizard_spider.tactics))
execution = attack.tactics.get('Execution')
print(len(execution.techniques))
在此示例中,你可以选择从何处下载官方 MITRE ATT&CK JSON 文件,包括要使用的代理。或者,如果你希望将 JSON 文件保存到其他位置,可以修改 enterprise_json 参数。默认情况下,该文件会保存到你的默认 site-packages 位置。
enterprise_json - (可选)enterprise json 文件的位置(自动保存到 pip 位置)url - (可选)要从中下载 enterprise json 文件的位置。update - (可选)布尔值,强制刷新下载(每次调用时),覆盖之前的文件。include_deprecated - (可选)布尔值,是否包含 MITRE ATT&CK 已弃用的对象(来自之前版本的 ATT&CK)。mitre_version - (可选)指定 MITRE ATT&CK 数据版本。proxies - (可选)用于访问 MITRE GitHub 获取 enterprise-attack.json 的代理字典。attack = enterpriseattack.Attack(
enterprise_json=None,
url='https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json',
include_deprecated=False,
update=False,
subscriptable=True,
mitre_version='latest',
proxies={'http':'http://127.0.0.1:1337'}
)
attack = enterpriseattack.Attack(
mitre_version='11.3',
update=True
)
print(attack.mitre_version)
attack = enterpriseattack.Attack()
for tactic in attack.tactics:
print(tactic.name)
for technique in tactic.techniques:
print(technique.name)
print(technique.detection)
for software in attack.software:
for technique in software.techniques:
for sub_technique in technique.sub_techniques:
print(software.name, technique.name, sub_technique.name)
attack = enterpriseattack.Attack()
for tactic in attack.tactics:
print(tactic.to_json())
for group in attack.groups:
print(group.to_json())
...
更多示例请参阅文档
(返回顶部)