SecurityScriptographer/defensive-toolkit
GitHub: SecurityScriptographer/defensive-toolkit
该仓库汇集了威胁狩猎、端点取证和安全检测工程所需的脚本与规则集合,涵盖 Sigma、YARA、KQL 及 Python/PowerShell 工具,每项内容均配有博客文档说明。
Stars: 0 | Forks: 0
# 防御工具包
SecurityScriptographer (https://www.securityscriptographer.com) 的配套仓库。这里的每个脚本和检测规则在博客上都有完整的说明文档,解释了它的功能、设计原因以及局限性。博客文章即是文档;此仓库用于下载。
## Python
用于威胁狩猎的独立 Python 工具:文件哈希和 IOC 匹配、从日志中提取 IOC、VirusTotal 查询、文件完整性监控以及 EVTX 解析。
| 文件 | 描述 | 博客文章 |
|---|---|---|
| [`python/file_hashing_ioc_match.py`](python/file_hashing_ioc_match.py) | 对文件进行哈希处理 (MD5/SHA-1/SHA-256) 并将其与 IOC 哈希列表进行匹配。 | [说明文档](https://www.securityscriptographer.com/2026/06/python-for-threat-hunting-iocs-hashing.html) |
| [`python/extract_iocs_regex.py`](python/extract_iocs_regex.py) | 使用 regex 从原始日志文本中提取 IP、URL、域名和哈希值并对其进行净化。 | [说明文档](https://www.securityscriptographer.com/2026/06/python-for-threat-hunting-iocs-hashing.html) |
| [`python/virustotal_hash_lookup.py`](python/virustotal_hash_lookup.py) | 通过 VirusTotal v3 API 查询文件哈希,支持免费版本的速率限制。 | [说明文档](https://www.securityscriptographer.com/2026/06/python-for-threat-hunting-iocs-hashing.html) |
| [`python/file_integrity_monitor.py`](python/file_integrity_monitor.py) | 为目录树建立基线,并报告新增、更改和删除的文件。 | [说明文档](https://www.securityscriptographer.com/2026/06/python-for-threat-hunting-iocs-hashing.html) |
| [`python/parse_evtx.py`](python/parse_evtx.py) | 使用 python-evtx 将 Windows EVTX 事件日志解析为可操作的 Python 对象。 | [说明文档](https://www.securityscriptographer.com/2026/06/parse-windows-event-logs-with-python.html) |
| [`python/port_scanner.py`](python/port_scanner.py) | 用于检查您自己主机暴露情况的小型 TCP 端口扫描器。 | [说明文档](https://www.securityscriptographer.com/2025/01/python-quick-guide-simple-port-scanner.html) |
## PowerShell
用于端点取证、安全审计和 Windows 事件日志管理的 PowerShell 脚本。
| 文件 | 描述 | 博客文章 |
|---|---|---|
| [`powershell/Invoke-SecurityAudit.ps1`](powershell/Invoke-SecurityAudit.ps1) | 本地安全审计:系统、安全设置、账户和服务,并导出为 CSV/JSON。 | [说明文档](https://www.securityscriptographer.com/2026/06/building-powershell-security-audit.html) |
| [`powershell/endpoint-triage-checks.ps1`](powershell/endpoint-triage-checks.ps1) | 来自威胁狩猎指南的 11 项端点取证检查:进程、服务、自启动项、签名、连接。 | [说明文档](https://www.securityscriptographer.com/2026/06/powershell-threat-hunting-windows.html) |
| [`powershell/eventlog-management.ps1`](powershell/eventlog-management.ps1) | 针对 Windows 安全日志的事件日志查询和日志大小/保留策略管理代码片段。 | [说明文档](https://www.securityscriptographer.com/2026/06/powershell-event-log-management-for.html) |
| [`powershell/Export-ProjectOnlineMpp.ps1`](powershell/Export-ProjectOnlineMpp.ps1) | 在 2026-09-30 停用之前,通过 Project Professional COM 接口将 Project Online 项目批量导出为 .mpp。 | [说明文档](https://www.securityscriptographer.com/2026/06/back-up-project-online-projects-before.html) |
## Sigma 规则
Sigma 检测规则,按博客的 Sigma 系列中开发的那样,每种技术和 Windows Event ID 对应一条规则。使用 sigma-cli 将它们转换为适合您后端的格式。
| 文件 | 描述 | 博客文章 |
|---|---|---|
| [`detections/sigma/win_security_1102_log_cleared.yml`](detections/sigma/win_security_1102_log_cleared.yml) | 安全事件日志被清除 (Event ID 1102)。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-cleared-event-logs-event.html) |
| [`detections/sigma/win_system_104_log_cleared.yml`](detections/sigma/win_system_104_log_cleared.yml) | 非安全事件日志通道被清除 (System Event ID 104)。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-cleared-event-logs-event.html) |
| [`detections/sigma/proc_creation_eventlog_clear_cmdline.yml`](detections/sigma/proc_creation_eventlog_clear_cmdline.yml) | 通过命令行工具 (wevtutil, Clear-EventLog) 清除事件日志。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-cleared-event-logs-event.html) |
| [`detections/sigma/sysmon_10_lsass_credential_access.yml`](detections/sigma/sysmon_10_lsass_credential_access.yml) | 通过 Sysmon Event ID 10 进程访问实现 LSASS 凭据访问。 | [说明文档](https://www.securityscriptographer.com/2026/07/sigma-rule-for-lsass-credential-access.html) |
| [`detections/sigma/win_security_4698_susp_scheduled_task.yml`](detections/sigma/win_security_4698_susp_scheduled_task.yml) | 注册了可疑的计划任务 (Event ID 4698)。 | [说明文档](https://www.securityscriptographer.com/2026/05/sigma-rule-for-malicious-scheduled.html) |
| [`detections/sigma/proc_creation_schtasks_staging.yml`](detections/sigma/proc_creation_schtasks_staging.yml) | 通过 schtasks.exe 创建带有暂存指示器的计划任务。 | [说明文档](https://www.securityscriptographer.com/2026/05/sigma-rule-for-malicious-scheduled.html) |
| [`detections/sigma/sysmon_13_runkey_persistence.yml`](detections/sigma/sysmon_13_runkey_persistence.yml) | 通过 Sysmon Event ID 13 注册表写入实现的可疑 Run-key 持久化。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-registry-run-key.html) |
| [`detections/sigma/sysmon_13_high_risk_autostart_keys.yml`](detections/sigma/sysmon_13_high_risk_autostart_keys.yml) | 修改高风险登录自启动项 (Winlogon, IFEO, AppInit)。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-registry-run-key.html) |
| [`detections/sigma/win_system_7045_susp_service_install.yml`](detections/sigma/win_system_7045_susp_service_install.yml) | 安装了可疑的服务 (Event ID 7045)。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-suspicious-service.html) |
| [`detections/sigma/win_system_7045_kernel_driver_service.yml`](detections/sigma/win_system_7045_kernel_driver_service.yml) | 安装了内核模式驱动程序服务 (Event ID 7045)。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-suspicious-service.html) |
| [`detections/sigma/proc_creation_sc_exe_staging.yml`](detections/sigma/proc_creation_sc_exe_staging.yml) | 通过 sc.exe 创建带有暂存指示器的服务。 | [说明文档](https://www.securityscriptographer.com/2026/06/sigma-rule-for-suspicious-service.html) |
| [`detections/sigma/win_security_4769_kerberoasting_rc4.yml`](detections/sigma/win_security_4769_kerberoasting_rc4.yml) | 通过 RC4 服务票据请求进行的潜在 Kerberoasting (Event ID 4769)。 | [说明文档](https://www.securityscriptographer.com/2026/05/sigma-rules-for-siem-detection.html) |
## YARA 规则
来自博客 YARA 入门指南的 YARA 规则。
| 文件 | 描述 | 博客文章 |
|---|---|---|
| [`detections/yara/ss_suspicious_powershell_artifact.yar`](detections/yara/ss_suspicious_powershell_artifact.yar) | PowerShell 主机调用与暂存原语 (编码命令、下载诱饵) 结合使用。 | [说明文档](https://www.securityscriptographer.com/2025/07/yara-rules-for-beginners-teaching-your.html) |
| [`detections/yara/ss_packed_pe_indicators.yar`](detections/yara/ss_packed_pe_indicators.yar) | 针对加壳 PE 的启发式检测:少数节、低入口点、UPX 标记或高节熵。 | [说明文档](https://www.securityscriptographer.com/2025/07/yara-rules-for-beginners-teaching-your.html) |
## KQL 查询
Advanced Hunting (Microsoft Defender XDR) 和 Sentinel KQL 查询集合。每个文件打包了一篇博客文章中的查询,并将原始章节标题作为注释保留。
| 文件 | 描述 | 博客文章 |
|---|---|---|
| [`detections/kql/entra-password-spray.kql`](detections/kql/entra-password-spray.kql) | 用于密码喷射检测和喷射源溯源的 Entra ID 登录日志查询。 | [说明文档](https://www.securityscriptographer.com/2026/06/entra-id-password-spray-detection-with.html) |
| [`detections/kql/defender-threat-hunting.kql`](detections/kql/defender-threat-hunting.kql) | 来自 KQL 威胁狩猎完整指南的 Advanced Hunting 查询。 | [说明文档](https://www.securityscriptographer.com/2026/07/kql-threat-hunting-in-microsoft.html) |
| [`detections/kql/defender-useful-queries.kql`](detections/kql/defender-useful-queries.kql) | 独立的 Advanced Hunting 查询:登录异常、电子邮件威胁、关联的登录活动。 | [说明文档](https://www.securityscriptographer.com/2026/05/useful-advanced-hunting-kql-queries-in.html) |
| [`detections/kql/defender-persistence-lolbin.kql`](detections/kql/defender-persistence-lolbin.kql) | 在 Defender Advanced Hunting 中搜寻持久化机制和 LOLBin 滥用。 | 即将发布 |
## 相关仓库
- [mitre](https://github.com/SecurityScriptographer/mitre) - 用于获取 MITRE ATT&CK STIX 数据、将其映射到 D3FEND 以及构建 Navigator 覆盖层的 Python 工具链。
## 授权使用
本仓库中发布的所有内容均用于防御目的:检测工程、系统加固、取证分析,以及在您拥有或获得书面授权评估的系统上进行测试。
## 许可证
[MIT](LICENSE)。感谢您注明出处——一个指向博客的链接比点个赞更有价值。
标签:AI合规, DNS 反向解析, HTTP工具, IPv6, KQL, PowerShell, Python, Sigma规则, TLS, x64dbg, YARA, 云资产可视化, 无后门, 目标导入, 逆向工具, 防御工具