计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
analyzing-powershell-script-block-logging【效率与协作】从 EVTX 文件中解析 Windows PowerShell 脚本块日志(事件 ID 4104),以检测混淆命令、编码载荷和离地攻击技术(living-off-the-land)。使用 python-evtx 提取并重建多块脚本,通过熵分析和模式匹配检测 Base64 编码命令、Invoke-Expression 滥用、下载植入器(download cradles)和 AMSI 绕过尝试。
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
pip install python-evtx lxmlMicrosoft-Windows-PowerShell%4Operational.evtx-EncodedCommand、FromBase64String)DownloadString、DownloadFile、Invoke-WebRequest、Net.WebClient)AmsiUtils、amsiInitFailed)python scripts/agent.py --evtx-file /path/to/PowerShell-Operational.evtx --output ps_analysis.json
import base64
if "-encodedcommand" in script_text.lower():
encoded = script_text.split()[-1]
decoded = base64.b64decode(encoded).decode("utf-16-le")
拆分在多个 4104 事件中的脚本共享一个 ScriptBlockId。按 MessageNumber 顺序拼接各块以恢复完整脚本。