elin-olsson/ghost-trail

GitHub: elin-olsson/ghost-trail

一个零依赖的 Linux 入侵后取证工具,通过解析系统二进制日志、命令历史和文件痕迹自动重建事件时间线并标记可疑行为。

Stars: 0 | Forks: 0

ghost-trail

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/84ec99ac59092846.svg)](https://github.com/elin-olsson/ghost-trail/actions/workflows/ci.yml) 一个 Linux 入侵后取证重建工具,通过解析二进制记录、文件系统痕迹和 shell 命令历史,构建出按时间顺序排列的系统活动时间线。 ## 前置条件 - Python 3.10 或更高版本 - 建议使用 root 权限以获取完整的系统访问权限 - 无外部运行时依赖 检查你的 Python 版本: ``` python3 --version ``` ## 安装说明 ``` git clone https://github.com/elin-olsson/ghost-trail.git cd ghost-trail ``` ## 用法 ``` python3 ghosttrail.py [options] ``` ``` # 重建过去 24 小时(默认) python3 ghosttrail.py # 自定义时间窗口 python3 ghosttrail.py --hours 48 # 将时间线导出为 JSON python3 ghosttrail.py --json report.json # 导出包含时间线的交互式 HTML 报告 python3 ghosttrail.py --html report.html # 将取证 artifacts 打包为 ZIP 存档 python3 ghosttrail.py --collect ``` ### 参数标志 | 标志 | 描述 | |---|---| | `--hours N` | 重建窗口期(单位:小时,默认值:24) | | `--json FILE` | 将时间线写入 JSON 文件 | | `--html FILE` | 生成包含 D3 时间线的交互式 HTML 报告 | | `--collect` | 将痕迹打包成 ZIP 归档文件以便移交 | ## 检查内容 | 模块 | 方法 | 目的 | |---|---|---| | Binary Parser | 直接解码 `utmp`/`wtmp` | 从原始系统结构中重建登录会话 | | File Tracker | MAC 时间线分析 | 识别在敏感目录(`/tmp`、`/etc`)中被修改的文件 | | History Engine | 多 shell 聚合 | 收集所有本地用户的命令历史(bash、zsh、python) | | Gap Detector | Auth 日志时间戳分析 | 标记日志连续性中的可疑中断 | | Alert Engine | 正则表达式匹配 | 标记日志擦除、反向 shell、后门创建和数据窃取行为 | ## 示例输出 ``` ══════════════════════════════════════════════════════════════ GHOST-TRAIL — Forensic Timeline Reconstructor ══════════════════════════════════════════════════════════════ Target: Local System Window: Last 24 hours Generated: 2026-04-25 16:45:00 ══════════════════════════════════════════════════════════════ 2026-04-25 09:12:04 LOGIN User 'fox' session from 192.168.1.50 2026-04-25 09:14:22 FILE Modified: /tmp/.hidden_payload (1240 bytes) 2026-04-25 09:15:10 ALERT CRITICAL: User 'fox' ran suspicious command: rm -rf /var/log/auth.log 2026-04-25 09:18:33 LOGIN User 'root' session from localhost ══════════════════════════════════════════════════════════════ ``` ## 依赖项 无运行时依赖——仅使用标准库。 | 包 | 版本 | 用途 | |---|---|---| | `pytest` | ≥ 9.0 | 仅用于测试套件——运行时不需要 |

Logo 归 © 2026 shadowfox.se 所有——保留所有权利,不受 MIT 许可证保护。

标签:D3.js, Google搜索, HTML报告, JSON导出, MIT许可, PB级数据处理, Python, Root权限, Shell历史, 二进制日志解析, 命令聚合, 安全运维, 库, 应急响应, 数字取证, 无后门, 无外部依赖, 无线安全, 日志缺失检测, 时间线重构, 痕迹追踪, 网络安全审计, 自动化分析, 自动化脚本, 蓝军工具, 跨站脚本