Slasq/Browser-Autopsy
GitHub: Slasq/Browser-Autopsy
Slasq/Browser-Autopsy 是一款用于离线浏览器取证分析的 DFIR 工具。
Stars: 1 | Forks: 0
```
██████╗ ██████╗ ██████╗ ██╗ ██╗███████╗███████╗██████╗
██╔══██╗██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔════╝██╔══██╗
██████╔╝██████╔╝██║ ██║██║ █╗ ██║███████╗█████╗ ██████╔╝
██╔══██╗██╔══██╗██║ ██║██║███╗██║╚════██║██╔══╝ ██╔══██╗
██████╔╝██║ ██║╚██████╔╝╚███╔███╔╝███████║███████╗██║ ██║
╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚══════╝╚═╝ ╚═╝
█████╗ ██╗ ██╗████████╗ ██████╗ ██████╗ ███████╗██╗ ██╗
██╔══██╗██║ ██║╚══██╔══╝██╔═══██╗██╔══██╗██╔════╝╚██╗ ██╔╝
███████║██║ ██║ ██║ ██║ ██║██████╔╝███████╗ ╚████╔╝
██╔══██║██║ ██║ ██║ ██║ ██║██╔═══╝ ╚════██║ ╚██╔╝
██║ ██║╚██████╔╝ ██║ ╚██████╔╝██║ ███████║ ██║
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝ ╚═╝
```
适用于 Chrome 和 Firefox 浏览器文件碎片的离线取证分析器。
为 DFIR 调查构建 — 提取浏览历史、下载和
搜索查询,构建统一的时间线,针对可配置的 IOC 集合标记可疑活动,
并生成 HTML/CSV 报告。
## 功能
- **双浏览器支持** — Chrome (`History` SQLite) 和 Firefox (`places.sqlite`)
- **每个浏览器三种文件类型**:
- 浏览历史(每个访问的时戳,而不仅仅是最后一次访问)
- 下载(目标路径、文件大小、状态、重定向链)
- 从 9 个搜索引擎自动检测到的搜索查询:Google、Bing、DuckDuckGo、Yahoo、YouTube、Ecosia、Brave、Startpage、Yandex
- **保管链** — 在解析之前对每个源文件进行 SHA-256 哈希;哈希值通过每个派生事件传播
- **只读访问** — 在打开之前将源数据库复制到临时目录(包括 WAL/SHM);原始文件从未被修改
- **针对可配置的 IOC YAML 的异常检测**:
- 可疑域名(精确匹配 + 通配符 `*.tld`)
- 可疑文件扩展名(包括双扩展名技巧 — `invoice.pdf.exe`)
- 可疑搜索关键词
- **时间窗口过滤** — 将分析缩小到事件窗口
- **报告**:
- 自包含的 HTML,打印友好(`@media print` → 清洁 A4 PDF)
- CSV 导出(时间线 + 异常)带有 UTF-8 BOM 以便 Excel 使用
## 安装
需要 Python **3.10+**。
```
pip install -r requirements.txt
```
## 快速入门
```
python main.py --chrome-profile /path/to/chrome/Default --case-id INC-2024-001
```
报告存储在 `./output/`。在任何浏览器中打开 `output/report.html`。
## 使用方法
### 完整示例
```
python main.py \
--chrome-profile /evidence/chrome/Default \
--firefox-profile /evidence/firefox/abc123.default-release \
--output-dir /cases/INC-2024-001/reports \
--case-id INC-2024-001 \
--ioc-file /cases/INC-2024-001/custom_iocs.yaml \
--start 2024-01-15T22:00:00 \
--end 2024-01-16T06:00:00 \
--report both
```
### 选项
| 标志 | 默认 | 描述 |
|-----------------------|-----------------------|-------------|
| `--chrome-profile` | — | Chrome 配置文件目录的路径 |
| `--firefox-profile` | — | Firefox 配置文件目录的路径 |
| `--output-dir` | `./output` | 生成报告的目录 |
| `--report` | `both` | `html` / `csv` / `both` |
| `--case-id` | `UNSPECIFIED` | HTML 报告标题中显示的案件 ID |
| `--ioc-file` | `./config/iocs.yaml` | IOC YAML 配置的路径 |
| `--start` | — | 最早事件(ISO-8601;默认 = UTC) |
| `--end` | — | 最新事件(ISO-8601;默认 = UTC) |
至少需要 `--chrome-profile` / `--firefox-profile` 中的一个。
### 浏览器配置文件所在位置
| OS | Chrome | Firefox |
|----------|---------------------------------------------------------|----------------------------------------------------------------|
| Windows | `%LOCALAPPDATA%\Google\Chrome\User Data\Default` | `%APPDATA%\Mozilla\Firefox\Profiles\.default-release` |
| macOS | `~/Library/Application Support/Google/Chrome/Default` | `~/Library/Application Support/Firefox/Profiles/.default` |
| Linux | `~/.config/google-chrome/Default` | `~/.mozilla/firefox/.default-release` |
### 退出代码
- `0` — 成功
- `1` — 运行时失败(缺少文件碎片,缺少 IOC 文件)
- `2` — 参数错误(没有配置文件,无效日期,`--start > --end`)
## IOC 配置
默认的 `config/iocs.yaml` 包含合理的起始内容 — Tor
隐藏服务、粘贴站点、匿名文件共享、恶意扩展、攻击性安全关键词。使用 `--ioc-file` 覆盖每个调查:
```
suspicious_domains:
- "*.onion" # wildcard suffix match — any .onion
- pastebin.com # exact match (sub.pastebin.com NOT included)
- cdn.discordapp.com
suspicious_extensions:
- .exe
- .ps1
- .hta # HTML Application — classic phishing vector
suspicious_keywords:
- mimikatz
- "bypass uac"
- "disable defender"
```
匹配不区分大小写。扩展名前的 `.` 是可选的 — `exe` 和 `.exe` 都可以工作。
## 项目结构
```
Browser-Autopsy/
├── main.py CLI entry point
├── requirements.txt
├── report_demo.html sample rendered report
│
├── config/
│ └── iocs.yaml default IOC config
│
├── extractors/ parse raw browser artifacts
│ ├── base.py shared helpers + dataclasses
│ ├── chrome.py Chrome History parser
│ └── firefox.py Firefox places.sqlite parser
│
├── analyzers/ process extracted data
│ ├── timeline.py unify events into a chronological timeline
│ └── anomaly.py IOC-based detection
│
├── reporters/ generate output
│ ├── html.py Jinja2-rendered HTML report
│ ├── csv.py CSV exports
│ └── templates/
│ └── report.html report template (inline CSS, no JS)
│
└── tests/ extensive pytest suite
```
## 测试
```
pytest # full suite
pytest tests/test_timeline.py # one module
pytest -v -k chrome # only chrome-related tests
```
## 输出
三个文件位于 `--output-dir`:
- **`report.html`** — 包含摘要统计、源文件表(路径 + SHA-256)、异常表和完整
时间线的完整取证报告。标记为异常的行会进行视觉突出显示。打印友好。
- **`timeline.csv`** — 每个事件作为一行。扁平列(`url`、`query`、`filename`)加上一个
`details_json` 列,以实现取证完整性。
- **`anomalies.csv`** — 标记为异常的事件,带有完整的事件上下文,以便进行分类。按严重性排序(高 → 低)。
CSV 是 UTF-8 带有 BOM,因此 Windows 上的 Excel 可以正确处理非 ASCII(波兰语、西里尔语等)数据。
标签:逆向工具