shaharyar0306/smaf-anav

GitHub: shaharyar0306/smaf-anav

这是一个基于Python的静态恶意软件分析自动化框架,通过集成TrID、strings和FLOSS等工具对PE文件进行深度扫描并生成分析报告。

Stars: 0 | Forks: 0

# ⚡ SMAF ANAV — Static Malware Analysis Automation Framework ``` ███████╗███╗ ███╗ █████╗ ███████╗ █████╗ ███╗ ██╗ █████╗ ██╗ ██╗ ██╔════╝████╗ ████║██╔══██╗██╔════╝ ██╔══██╗████╗ ██║██╔══██╗██║ ██║ ███████╗██╔████╔██║███████║█████╗ ███████║██╔██╗ ██║███████║██║ ██║ ╚════██║██║╚██╔╝██║██╔══██║██╔══╝ ██╔══██║██║╚██╗██║██╔══██║╚██╗ ██╔╝ ███████║██║ ╚═╝ ██║██║ ██║██║ ██║ ██║██║ ╚████║██║ ██║ ╚████╔╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═══╝ v1.0 ``` ![Python](https://img.shields.io/badge/Python-3.8%2B-blue?style=flat-square&logo=python) ![Platform](https://img.shields.io/badge/Platform-Windows-lightgrey?style=flat-square&logo=windows) ![Tools](https://img.shields.io/badge/Tools-TrID%20%7C%20strings.exe%20%7C%20FLOSS-green?style=flat-square) ![License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square) ![Status](https://img.shields.io/badge/Status-Active-brightgreen?style=flat-square) ## 📋 目录 - [概述](#-overview) - [功能](#-features) - [工具链](#-tool-chain) - [安装](#-installation) - [使用](#-usage) - [输出示例](#-output-example) - [报告格式](#-report-formats) - [检测到的恶意软件家族](#-malware-families-detected) - [项目结构](#-project-structure) - [免责声明](#-disclaimer) ## 🔍 概述 **SMAF ANAV** 是一个基于 Python 的静态恶意软件分析自动化脚本,专为安全研究人员和恶意软件分析师设计。它接收一个或多个 PE 可执行样本,并通过多工具管道运行,以提取可操作的威胁情报——所有这些均无需执行恶意软件。 该框架执行以下操作: - 通过 TrID 签名匹配进行**文件类型识别** - 通过 strings.exe 进行**字符串提取**(ASCII + Unicode) - 通过 FLOSS 进行**去混淆字符串恢复**(栈字符串及解码字符串) - 使用内置 IOC 签名数据库进行**恶意软件家族分类** 结果将导出为**人类可读的文本报告**和**样式化的 HTML 报告**。 ## ✨ 功能 | 功能 | 描述 | |---|---| | 🔎 文件类型检测 | 使用 TrID 识别文件类型并提供置信度百分比 | | 📝 字符串提取 | 通过 strings.exe 提取所有 ASCII/Unicode 字符串(最小长度 4) | | 🔓 FLOSS 去混淆 | 恢复静态分析无法发现的栈字符串和解码字符串 | | 🧬 恶意软件家族识别 | 将 IOC 签名与已知恶意软件家族进行匹配 | | 🌐 URL/域名提取 | 自动标记嵌入的 URL 和域名 | | ⚠️ 可疑关键词检测 | 高亮显示危险的 API 调用和关键词 | | 📊 双重报告输出 | 生成 `.txt` 和 `.html` 两种分析报告 | | 🛫 预检查 | 在分析开始前验证所有工具和样本文件 | ## 🛠 工具链 SMAF ANAV 依赖三个必须位于同一目录下的外部工具: | 工具 | 用途 | 下载 | |---|---|---| | **TrID** | 通过二进制签名进行文件类型识别 | [mark0.net](https://mark0.net/soft-trid-e.html) | | **strings.exe** | 从 PE 文件中提取字符串 | [Sysinternals](https://learn.microsoft.com/en-us/sysinternals/downloads/strings) | | **FLOSS** | 提取去混淆后的字符串 | [GitHub - mandiant/flare-floss](https://github.com/mandiant/flare-floss) | ## 💻 安装 ### 前置条件 - Windows 操作系统 - Python 3.8 或更高版本 ### 步骤 ``` # 1. 克隆 repository git clone https://github.com/YOUR_USERNAME/smaf-anav.git cd smaf-anav # 2. 将所需 tools 放入 project folder # - trid.exe + triddefs.trd # - strings.exe / strings64.exe / strings64a.exe # - floss.exe # 3. 将您的 malware sample(s) 放入同一 folder # (使用 .malz extension 或安全地 rename) # 4. 运行 analyzer python analyzer.py ``` ## 🚀 使用 ``` # 分析单个 sample python analyzer.py malware_sample.exe # 该 script 将自动: # [1] 检查所有 tools 是否存在 # [2] 验证 sample file # [3] 运行 TrID → strings.exe → FLOSS # [4] 与 malware signature database 进行匹配 # [5] 导出 reports ``` ### 运行示例 ``` PRE-FLIGHT: TOOL AVAILABILITY CHECK ✔ trid → trid ✔ strings → strings ✔ floss → floss PRE-FLIGHT: SAMPLE VALIDATION ✔ Found: TotalAware2.exe (14.50 KB) ℹ Total samples queued for analysis: 1 ANALYSING: TotalAware2.exe ℹ Running TrID ... ℹ Running strings.exe ... ℹ Running FLOSS (this may take a moment) ... ℹ Matching against malware signature database ... ``` ## 📄 输出示例 ### 文件元数据 ``` MD5 : 5a5d48d3796d7998bc805ee9a3725eeb SHA1 : d64d02073a102afb236631c7301084bbac882faa SHA256 : 32a4c49f2db185ebab27b668eb5e3cba57bb9461c785dc4432a2cd054640f1bd ``` ### 文件类型检测 (TrID) ``` 69.1% (.EXE) Generic CIL Executable (.NET, Mono, etc.) 9.9% (.EXE) Win64 Executable (generic) ``` ### 检测到的可疑关键词 ``` hookedKeyboardCallbackAsync hookedLowLevelKeyboardProc hookId midHook SetHook UnhookWindowsHookEx CallNextHookEx ``` ### 恶意软件家族识别 ``` #1 TotalAV_Rogue → Rogue Antivirus / Scareware (TotalAV-style) [LOW] #2 Generic_Keylogger → Generic Keylogger Behavior [MEDIUM] #3 AgentTesla → Agent Tesla Info-Stealer / Keylogger [LOW] ``` ## 📊 报告格式 分析完成后,将自动保存两个报告文件: | 格式 | 文件名 | 描述 | |---|---|---| | 📝 文本 | `malware_analysis_YYYYMMDD_HHMMSS.txt` | 完整的纯文本报告 | | 🌐 HTML | `malware_analysis_YYYYMMDD_HHMMSS.html` | 样式化的浏览器可查看报告 | ## 🧬 检测到的恶意软件家族 内置签名数据库目前涵盖: - `TotalAV_Rogue` — 流杀毒软件 / 诈骗软件 - `Generic_Keylogger` — 基于键盘钩子的键盘记录器 - `AgentTesla` — 信息窃取程序 / 键盘记录器 - *(可以轻松向数据库添加更多签名)* ## 📁 项目结构 ``` smaf-anav/ │ ├── analyzer.py # Main analysis script ├── README.md # This file │ ├── tools/ # External tool binaries (not included) │ ├── trid.exe │ ├── triddefs.trd │ ├── strings.exe │ ├── strings64.exe │ ├── strings64a.exe │ └── floss.exe │ ├── samples/ # Place malware samples here (.malz recommended) │ └── Rams1.exe.malz │ └── reports/ # Auto-generated analysis reports ├── malware_analysis_*.txt └── malware_analysis_*.html ``` ## ⚠️ 免责声明 ## 👤 作者 **Baani** — 恶意软件分析师 / 安全研究员 📍 巴基斯坦 ## 📜 许可证 本项目采用 MIT 许可证授权 — 详见 [LICENSE](LICENSE) 文件。 *为恶意软件分析社区用 ❤️ 构建*
标签:DAST, FLOSS, Python, SMAF, strings, TrID, 二进制分析, 云安全监控, 云安全运维, 云资产清单, 威胁情报, 字符串提取, 开发者工具, 恶意软件分析, 文件类型识别, 无后门, 样本分析, 网络安全, 脱壳, 自动化框架, 逆向工具, 逆向工程, 隐私保护, 静态分析