pip install python-evtx lxml
Microsoft-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")
Scripts split across multiple 4104 events share a ScriptBlockId. Concatenate blocks ordered by MessageNumber to recover the full script.