meltedinhex/analyst-ai-pack / skills/hunting-suspicious-powershell-execution
hunting-suspicious-powershell-execution
VerifiedHunts malicious PowerShell using script-block (EID 4104) and module logging: scoring encoded commands, download cradles, AMSI/logging bypass, and in-memory execution, then decoding payloads for triage. Activates for requests to hunt malicious PowerShell, analyze script-block logs, or detect encoded command abuse.
| File | Kind | Size |
|---|---|---|
| LICENSE | other | 340 B |
| SKILL.md | skill md | 3.2 KB |
| references/api-reference.md | markdown | 1.3 KB |
| scripts/analyst.py | script | 3.1 KB |
references/api-reference.md
View on GitHub# API Reference: Hunting Suspicious PowerShell Execution
## Overview
`scripts/analyst.py` scores PowerShell script-block events for suspicious construct combinations
and decodes `-EncodedCommand` base64 (UTF-16LE) payloads, re-scoring decoded content for
layered obfuscation. It reads local JSON and decodes strings only; it never executes PowerShell.
## Dependencies
| Package | Version | Purpose |
|---------|---------|---------|
| (stdlib) | — | base64, regex, JSON |
## Input format
```json
[
{"host": "WS01", "user": "alice", "script_block": "powershell -enc SQBFAFgA..."}
]
```
## Core functions
### `score_event(text)`
Returns a score, matched reasons, and any decoded EncodedCommand payloads for one script block.
### `decode_encoded(text)`
Extracts and base64-decodes `-EncodedCommand` blobs as UTF-16LE.
### `run(events)`
Scores all events and returns candidates scoring >= 30.
## Usage
```bash
python scripts/analyst.py score events.json
```
## Sources
- PowerShell script block logging (Event ID 4104) —
https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_logging_windows
- MITRE ATT&CK T1059.001 PowerShell — https://attack.mitre.org/techniques/T1059/001/
- EncodedCommand is UTF-16LE base64 — PowerShell command-line reference
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |