performing-automated-malware-analysis-with-cape
部署和操作 CAPEv2 沙箱,进行自动化恶意软件分析,具备行为监控、载荷提取、配置解析和反规避能力。
Best use case
performing-automated-malware-analysis-with-cape is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
部署和操作 CAPEv2 沙箱,进行自动化恶意软件分析,具备行为监控、载荷提取、配置解析和反规避能力。
Teams using performing-automated-malware-analysis-with-cape should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/performing-automated-malware-analysis-with-cape/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How performing-automated-malware-analysis-with-cape Compares
| Feature / Agent | performing-automated-malware-analysis-with-cape | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
部署和操作 CAPEv2 沙箱,进行自动化恶意软件分析,具备行为监控、载荷提取、配置解析和反规避能力。
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 使用 CAPE 进行自动化恶意软件分析
## 概述
CAPE(Config And Payload Extraction,配置与载荷提取)是一款从 Cuckoo 派生的开源恶意软件沙箱,可自动化执行行为分析、载荷转储和配置提取。CAPEv2 具备用于行为插桩的 API 钩挂功能,可捕获执行过程中创建/修改/删除的文件,以 PCAP 格式记录网络流量,并包含 70+ 个针对 Emotet、TrickBot、Cobalt Strike、AsyncRAT 和 Rhadamanthys 等家族的自定义配置提取器(cape-parsers)。签名系统包含 1000+ 个行为签名,可检测规避技术、持久化、凭据窃取和勒索软件行为。CAPE 的调试器支持通过在 YARA 签名中组合调试器操作来动态绕过反规避机制。推荐部署方式:Ubuntu LTS 宿主机 + Windows 10 21H2 客户机虚拟机。
## 前置条件
- Ubuntu 22.04 LTS 服务器(8+ CPU 核心、32GB+ 内存、500GB+ SSD)
- KVM/QEMU 虚拟化支持
- Windows 10 21H2 客户机镜像
- Python 3.9+,安装 CAPEv2 依赖项
- 用于隔离分析网络的网络配置
## 操作步骤
### 步骤 1:通过 API 提交和分析样本
```python
#!/usr/bin/env python3
"""用于自动化恶意软件提交和分析的 CAPE 沙箱 API 客户端。"""
import requests
import json
import time
import sys
from pathlib import Path
class CAPEClient:
def __init__(self, base_url="http://localhost:8000", api_token=None):
self.base_url = base_url.rstrip("/")
self.headers = {}
if api_token:
self.headers["Authorization"] = f"Token {api_token}"
def submit_file(self, filepath, options=None):
"""提交文件进行分析。"""
url = f"{self.base_url}/apiv2/tasks/create/file/"
files = {"file": open(filepath, "rb")}
data = options or {}
data.setdefault("timeout", 120)
data.setdefault("enforce_timeout", False)
resp = requests.post(url, files=files, data=data, headers=self.headers)
resp.raise_for_status()
result = resp.json()
task_id = result.get("data", {}).get("task_ids", [None])[0]
print(f"[+] 已提交 {filepath} -> 任务 ID:{task_id}")
return task_id
def get_status(self, task_id):
"""检查任务分析状态。"""
url = f"{self.base_url}/apiv2/tasks/status/{task_id}/"
resp = requests.get(url, headers=self.headers)
return resp.json().get("data", "unknown")
def wait_for_completion(self, task_id, poll_interval=15, max_wait=600):
"""等待分析完成。"""
elapsed = 0
while elapsed < max_wait:
status = self.get_status(task_id)
if status == "reported":
print(f"[+] 任务 {task_id} 已完成")
return True
time.sleep(poll_interval)
elapsed += poll_interval
print(f" 等待中...({elapsed}s,状态:{status})")
return False
def get_report(self, task_id):
"""获取完整分析报告。"""
url = f"{self.base_url}/apiv2/tasks/get/report/{task_id}/"
resp = requests.get(url, headers=self.headers)
return resp.json()
def get_config(self, task_id):
"""获取提取的恶意软件配置。"""
report = self.get_report(task_id)
configs = report.get("CAPE", {}).get("configs", [])
return configs
def get_dropped_files(self, task_id):
"""列出分析期间投放的文件。"""
report = self.get_report(task_id)
return report.get("dropped", [])
def get_network_iocs(self, task_id):
"""从分析结果中提取网络 IoC。"""
report = self.get_report(task_id)
network = report.get("network", {})
iocs = {
"dns": [d.get("request") for d in network.get("dns", [])],
"http": [h.get("uri") for h in network.get("http", [])],
"tcp": [f"{h.get('dst')}:{h.get('dport')}"
for h in network.get("tcp", [])],
}
return iocs
def analyze_sample(self, filepath):
"""完整的自动化分析流水线。"""
task_id = self.submit_file(filepath)
if not task_id:
return None
if self.wait_for_completion(task_id):
report = {
"task_id": task_id,
"config": self.get_config(task_id),
"network_iocs": self.get_network_iocs(task_id),
"dropped_files": len(self.get_dropped_files(task_id)),
}
return report
return None
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f"用法:{sys.argv[0]} <malware_sample> [cape_url]")
sys.exit(1)
url = sys.argv[2] if len(sys.argv) > 2 else "http://localhost:8000"
client = CAPEClient(url)
result = client.analyze_sample(sys.argv[1])
if result:
print(json.dumps(result, indent=2))
```
## 验证标准
- 样本在配置的超时时间内提交并完成分析
- 已知恶意软件家族触发了行为签名
- cape-parsers 成功提取恶意软件配置
- 网络流量已捕获并提取 IoC
- 已收集投放的文件和载荷以供进一步分析
- 反规避绕过对具有沙箱感知的恶意软件有效
## 参考资料
- [CAPEv2 GitHub](https://github.com/kevoreilly/CAPEv2)
- [CAPE 沙箱文档](https://capev2.readthedocs.io/)
- [使用 CAPE 自动化恶意软件分析](https://endsec.au/blog/building-an-automated-malware-sandbox-using-cape/)
- [在 Ubuntu 上安装 CAPEv2](https://medium.com/@rizqisetyokus/building-capev2-automated-malware-analysis-sandbox-part-1-da2a6ff69cdb)Related Skills
reverse-engineering-rust-malware
使用 IDA Pro 和 Ghidra 对 Rust 编译的恶意软件进行逆向工程,掌握处理非空终止字符串、提取 crate 依赖项和 Rust 特有控制流分析的专项技术。
reverse-engineering-malware-with-ghidra
使用 NSA 的 Ghidra 反汇编器和反编译器对恶意软件二进制文件进行逆向工程,在汇编和伪 C 代码层面理解其内部逻辑、密码学例程、C2 协议和规避技术。适用于恶意软件逆向工程、反汇编分析、反编译、二进制分析或理解恶意软件内部机制等请求。
reverse-engineering-dotnet-malware-with-dnspy
使用 dnSpy 反编译器和调试器对 .NET 恶意软件进行逆向工程,分析 C#/VB.NET 源代码,识别混淆技术,提取配置信息,理解包括信息窃取器、远程访问木马(RAT)和加载器在内的恶意功能。适用于 .NET 恶意软件分析、C# 恶意软件反编译、托管代码逆向工程或 .NET 混淆分析等请求。
reverse-engineering-android-malware-with-jadx
使用 JADX 反编译器对恶意 Android APK 文件进行逆向工程,分析 Java/Kotlin 源代码,识别包括数据窃取、C2 通信、权限提升和覆盖攻击在内的恶意功能。检查 Manifest 权限、Receiver、Service 及原生库。适用于 Android 恶意软件分析、APK 逆向工程、移动端恶意软件调查或 Android 威胁分析等请求。
performing-yara-rule-development-for-detection
通过识别可执行文件中的唯一字节模式、字符串和行为指标,开发精准的 YARA 恶意软件检测规则,同时将误报率降至最低。
performing-wireless-security-assessment-with-kismet
使用 Kismet 通过被动射频监控进行无线网络安全评估,检测流氓接入点(Rogue AP)、隐藏 SSID、弱加密和未授权客户端。
performing-wireless-network-penetration-test
执行无线网络渗透测试,通过捕获握手包、破解 WPA2/WPA3 密钥、检测流氓接入点以及使用 Aircrack-ng 和相关工具测试无线网络分段,评估 WiFi 安全性。
performing-windows-artifact-analysis-with-eric-zimmerman-tools
使用 Eric Zimmerman 的开源 EZ Tools 套件(包括 KAPE、MFTECmd、PECmd、LECmd、JLECmd 和 Timeline Explorer)执行全面的 Windows 取证制品分析,解析注册表 hive、预取文件、事件日志和文件系统元数据。
performing-wifi-password-cracking-with-aircrack
在授权无线安全评估中捕获 WPA/WPA2 握手包,并使用 aircrack-ng、hashcat 和字典攻击进行离线密码破解, 以评估密码短语强度和无线网络安全状况。
performing-web-cache-poisoning-attack
在授权安全测试期间,通过未纳入缓存键的头部和参数毒化缓存响应,利用 Web 缓存机制向其他用户投递恶意内容。
performing-web-cache-deception-attack
通过利用 CDN 缓存层与源服务器之间的路径规范化差异,执行 Web 缓存欺骗攻击,从而缓存并获取敏感的已认证内容。
performing-web-application-vulnerability-triage
使用 OWASP 风险评级方法论对 DAST/SAST 扫描器的 Web 应用程序漏洞发现进行分类,区分真阳性和假阳性,并确定修复优先级。