Ahmedsalah-28/ThreatLens
GitHub: Ahmedsalah-28/ThreatLens
ThreatLens 是一条由 LangGraph 编排的自动化恶意软件智能分析管线,上传二进制文件后即可一键生成包含静态/动态分析、威胁情报与 YARA 匹配的完整报告。
Stars: 0 | Forks: 0
# 🛡 ThreatLens
## 📁 项目结构
```
ThreatLens/
│
├── app.py # Streamlit web interface
├── config.py # API keys & shared constants
├── state.py # GraphState TypedDict
├── graph.py # Graph builder & compiler
├── main.py # CLI entry point
├── requirements.txt
│
├── nodes/
│ ├── hash_node.py # SHA256 hashing
│ ├── upx_node.py # UPX packer detection
│ ├── floss_node.py # FLOSS string extraction
│ ├── vt_node.py # VirusTotal API lookup
│ ├── static_node.py # Static PE analysis
│ ├── dynamic_node.py # Dynamic / sandbox analysis
│ ├── yara_node.py # YARA rule matching
│ ├── aggregation_node.py # Fan-in aggregator
│ ├── insight_node.py # LLM threat intelligence report
│ ├── summary_report_node.py # LLM → premium HTML summary
│ └── render_report_html_node.py # Markdown → full HTML report
│
├── utils/
│ ├── llm.py # Groq client + call_llm()
│ └── yara_loader.py # YARA rules loader
│
├── rules/ # YARA rule files (see setup below)
│ ├── malware/
│ ├── packers/
│ └── webshells/
│
└── outputs/ # Generated reports (auto-created)
├── analysis.json
├── insights_report.md
├── summary_report.html
└── full_report.html
```
## ⚙️ 流程管道
```
input ──┬──► hash ──► vt ──┬──► static ──┐
│ └──► dynamic ──┤
├──► upx ──► floss ──────────────┤
│ ├──► agg ──► insight ──► summary_report
└──► yara ───────────────────────┘ └──────────► render_report_html
```
## 🚀 安装与设置
### 1. 克隆仓库
```
git clone https://github.com/Ahmedsalah-28/ThreatLens.git
cd ThreatLens
```
### 2. 安装 Python 依赖
```
pip install -r requirements.txt
```
### 3. 安装外部工具
- **UPX** — 从 https://upx.github.io 下载并添加到 PATH
- **FLOSS** — 从 https://github.com/mandiant/flare-floss/releases 下载 `floss64.exe`,并将其放置在项目根目录或添加到 PATH
### 4. 下载 YARA 规则
该流程使用社区的 YARA 规则。将它们克隆到 `rules/` 文件夹中:
```
git clone https://github.com/Yara-Rules/rules.git rules
```
克隆完成后,`rules/` 文件夹至少应包含:
```
rules/
├── malware/
├── packers/
└── webshells/
```
### 5. 配置 API 密钥
编辑 `config.py` 并填入你的密钥:
```
GROQ_API_KEY = "your_groq_api_key"
VT_API_KEY = "your_virustotal_api_key"
YARA_RULES_PATH = "rules"
```
- **Groq API 密钥** → https://console.groq.com
- **VirusTotal API 密钥** → https://www.virustotal.com/gui/my-apikey
## ▶️ 使用说明
### 运行 Streamlit Web 界面
```
streamlit run app.py
```
然后在浏览器中打开 `http://localhost:8501`,上传一个二进制文件,然后点击 **Run Analysis**。
### 通过 CLI 运行
```
python main.py
```
## 📊 输出报告
分析完成后,会在 `outputs/` 目录下生成两份 HTML 报告:
| 文件 | 描述 |
|---|---|
| `summary_report.html` | AI 生成的高级交互式仪表板 |
| `full_report.html` | 包含所有模块结果的完整技术报告 |
| `insights_report.md` | Markdown 格式的原始威胁情报报告 |
| `analysis.json` | 所有模块的聚合原始数据 |
## ⚠️ 免责声明
本工具仅用于**教育和研究目的**。
请务必在**隔离环境**(虚拟机 / 沙箱)中分析恶意软件。
切勿在你的主机上运行可疑的二进制文件。
标签:AI报告生成, DAST, DLL 劫持, DNS 反向解析, DNS枚举, DNS 解析, FLOSS, Go语言工具, HTML报告, IP 地址批量处理, Kubernetes, LangGraph, PE文件分析, Python, SHA256哈希, Streamlit, ThreatLens, UPX脱壳检测, VirusTotal查询, Webshell检测, YARA规则匹配, 二进制文件分析, 云安全监控, 大语言模型, 威胁情报, 字符串提取, 开发者工具, 恶意软件分析, 无后门, 沙箱分析, 网络信息收集, 网络安全, 网络安全工具, 自动化分析, 访问控制, 跨站脚本, 逆向工具, 隐私保护, 静态分析