Pranith-Jain/dfir-cli

GitHub: Pranith-Jain/dfir-cli

一款命令行数字取证与事件响应工具包,提供 IOC 提取、文件哈希分析、PE 文件分析和编码解码等功能,帮助安全人员快速完成日常取证任务。

Stars: 0 | Forks: 0

# dfir-cli 命令行 DFIR 工具包 — IOC 提取、编码/解码、文件分析、hash 分类处理。 由 [pranithjain.qzz.io](https://pranithjain.qzz.io) 提供支持。 ## 安装 ``` pip install git+https://github.com/Pranith-Jain/dfir-cli.git ``` 或克隆并安装: ``` git clone https://github.com/Pranith-Jain/dfir-cli.git cd dfir-cli pip install . ``` ## 用法 ``` # 从文本中提取 IOC echo "Suspicious traffic to 185.234.72.0 and CVE-2024-1709" | dfir extract # 从文件中提取 IOC dfir extract --file report.txt # 对文件进行哈希 — MD5、SHA1、SHA256、entropy dfir file-hash suspicious.exe # 从 binary 中提取可打印字符串 dfir strings malware.bin dfir strings malware.bin --min-len 8 # 解码 Base64、URL encoding、hex、HTML entities dfir decode "aHR0cHM6Ly9leGFtcGxlLmNvbQ==" dfir decode "https%3A%2F%2Fexample.com" # 编码数据 dfir encode "https://example.com" # 快速查找 — 自动检测类型 dfir lookup 8.8.8.8 dfir lookup CVE-2024-1709 dfir lookup evil.example.com # PE file 分析 — headers、sections、entropy dfir pe-info suspicious.exe # 分析文本并建议后续步骤 dfir analyze --file iocs.txt ``` 所有命令均支持 `--json` 以输出原始 JSON。 ## 命令 | 命令 | 描述 | |---------|-------------| | `extract` | 从文本/文件/stdin 中提取 IOC(IP、域名、hash、URL、电子邮件、CVE、加密货币地址) | | `file-hash` | 计算文件的 hash — MD5、SHA1、SHA256、Shannon 熵 | | `strings` | 从二进制文件中提取可打印字符串 | | `decode` | 解码 Base64、URL 编码、hex、HTML 实体 | | `encode` | 编码数据 — Base64、URL、hex | | `lookup` | 快速查询 — 自动检测类型并查询平台 | | `pe-info` | 基础 PE 文件分析 — 头部、节、熵 | | `analyze` | 分析文本中的 IOC 并建议后续步骤 | ## 提取的 IOC 类型 - IPv4 / IPv6 地址 - 域名(包含误报过滤) - URL (http/https) - SHA256、SHA1、MD5 hash - 电子邮件地址 - CVE 标识符 - 比特币地址 - 以太坊地址 ## 误报过滤 `extract` 命令默认会过滤常见的误报域名: - `example.com`、`schema.org`、`github.com`、`google.com` 等 - 本地/私有 IP (`127.x.x.x`、`0.x.x.x`、`255.x.x.x`) 使用 `--no-fp-filter` 禁用。 ## 身份验证 `extract`、`encode`、`decode`、`file-hash`、`strings` 和 `pe-info` 完全离线运行,不需要密钥。`lookup` 命令会调用托管 API,需要 API 密钥。要申请密钥,请联系(见[联系方式](#contact)),然后通过 `DFIR_API_KEY` 或 `--api-key` 提供: ``` export DFIR_API_KEY= dfir lookup 8.8.8.8 # 或按次调用 dfir --api-key lookup example.com ``` ## 配置 使用 `--base-url` / `DFIR_API_BASE` 将 `lookup` 指向不同的部署: ``` dfir --base-url http://localhost:8787/api/v1 lookup 8.8.8.8 # or DFIR_API_BASE ``` 退出码:`0` 成功 / `1` API 错误 / `2` 网络错误 / `3` 需要身份验证。 ## 联系方式 - LinkedIn:[linkedin.com/in/pranithjain](https://linkedin.com/in/pranithjain) - 电子邮件:[hello@pranithjain.qzz.io](mailto:hello@pranithjain.qzz.io) ## 许可证 MIT
标签:DAST, 威胁情报, 库, 应急响应, 开发者工具, 恶意软件分析, 数字取证, 文件分析, 文档结构分析, 自动化脚本, 逆向工具, 防御框架