codescueduard24/Static-Malware-Analyzer

GitHub: codescueduard24/Static-Malware-Analyzer

基于 Python 的静态恶意软件分析工具,在不执行文件的前提下完成哈希计算、PE 解析、熵值与壳检测、VirusTotal 查询及风险评分,输出结构化 JSON 报告供 SOC 分析师快速分诊。

Stars: 0 | Forks: 0

# 静态恶意软件分析器 一款基于 Python 的可疑文件静态分析工具。专为需要在无需执行文件的情况下进行快速分诊的 SOC 分析师和安全研究人员设计。 ## 功能 - **哈希计算** — MD5, SHA1, SHA256 - **VirusTotal 查询** — 检查 70 多个 AV 引擎的检测率 - **PE 分析** — 架构、编译时间戳、区段、导入表 - **熵值计算** — 检测加壳/加密 payload(熵值 > 7.0 = 可疑) - **壳检测** — UPX, MPRESS, Themida, VMProtect 等 - **可疑字符串提取** — IP、URL、注册表键、危险 API 调用 - **风险评分** — 0–100 分制,附带详细推论 - **JSON 报告导出** — 用于 SIEM 摄取或进一步分析的结构化输出 ## 安装 ``` git clone https://github.com/codescueduard24/static-malware-analyzer cd static-malware-analyzer pip install -r requirements.txt ``` ## Windows PowerShell ``` $env:VT_API_KEY="your_api_key_here" ``` ## Linux / macOS ``` export VT_API_KEY="your_api_key_here" ``` 请勿在源代码中硬编码您的 VirusTotal API key。请改用环境变量。 ## 使用方法 ``` # 基础分析 python analyzer.py suspicious_file.exe # 跳过 VirusTotal (offline mode) python analyzer.py suspicious_file.exe --no-vt # 保存 JSON 报告 python analyzer.py suspicious_file.exe --save ``` ## 输出示例 ``` [+] Hashes MD5 : d41d8cd98f00b204e9800998ecf8427e SHA1 : da39a3ee5e6b4b0d3255bfef95601890afd80709 SHA256: e3b0c44298fc1c149afbf4c8996fb924... [+] Entropy: 7.82 ← very high (possible packing/encryption) [+] VirusTotal Detections: 48/72 Top detections: Kaspersky: Trojan.Win32.Agent ESET: Win32/Kryptik.ABC [+] PE Analysis Architecture: x64 Compiled : 2023-11-14 03:22:11 UTC Packers detected: UPX Sections (3): .text entropy=6.43 size=45,056 .data entropy=7.91 size=12,288 ← HIGH ENTROPY UPX0 entropy=7.98 size=0 Suspicious imports (4): KERNEL32.DLL!CreateRemoteThread KERNEL32.DLL!VirtualAllocEx KERNEL32.DLL!WriteProcessMemory ADVAPI32.DLL!RegSetValueExA [+] Risk Assessment Score : 87/100 Level : HIGH Reasons: • Detected by 48/72 AV engines • Very high entropy (7.82) • Known packer detected: UPX • 4 suspicious API calls found ``` ## 项目结构 ``` static-malware-analyzer/ ├── analyzer.py # Main analysis engine ├── requirements.txt # Dependencies ├── reports/ # JSON reports (auto-created) └── README.md ``` ## 检查指标 | 类别 | 检测内容 | |---|---| | 网络 | 基于 IP 的 URL、硬编码域名 | | 执行 | cmd.exe, powershell, WinExec, CreateProcess | | 注入 | CreateRemoteThread, VirtualAllocEx, WriteProcessMemory | | 持久化 | 注册表 Run 键、计划任务 | | 隐藏规避 | 已知壳、高熵值区段 | | 键盘记录 | GetAsyncKeyState, SetWindowsHookEx | | 下载 | URLDownloadToFile, InternetConnect |
标签:DAST, Homebrew安装, PE文件分析, Python, SolidJS, 云安全监控, 恶意软件分析, 无后门, 逆向工具, 静态分析, 风险评分