analyzing-powershell-script-block-logging

analyzing-powershell-script-block-logging is a skill for Claude Code from killvxk/cybersecurity-skills-zh. It costs 111 tokens per session (513 once invoked), scanned A, original, Apache-2.0.

A guide for reading Windows PowerShell Script Block Logging records from EVTX event-log files. These records contain pieces of PowerShell scripts, including commands that may be encoded, hidden, or used to download malware.

In plain words
What is it for?
Use it to parse event ID 4104 records, decode Base64 commands, reconstruct complete scripts, score suspicious activity, and map it to MITRE ATT&CK techniques.
Why use it?
It rebuilds scripts split across multiple log events and highlights patterns linked to obfuscation, payload downloads, and attempts to bypass security checks.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the cybersecurity-skills-zh plugin — 58 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/killvxk/cybersecurity-skills-zh/analyzing-powershell-script-block-logging
Any agent
npx skills add killvxk/cybersecurity-skills-zh --skill analyzing-powershell-script-block-logging
Clone the repo
git clone --depth 1 https://github.com/killvxk/cybersecurity-skills-zh

Made for: Claude Code.

Or install cybersecurity-skills-zh, the plugin that ships this one along with the rest of its 58 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for analyzing-powershell-script-block-logging

README.md
[![agentmods](https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-powershell-script-block-logging.svg)](https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-powershell-script-block-logging)
Your own site
<a href="https://agentmods.dev/skills/killvxk/cybersecurity-skills-zh/analyzing-powershell-script-block-logging"><img src="https://agentmods.dev/badge/skills/killvxk/cybersecurity-skills-zh/analyzing-powershell-script-block-logging.svg" alt="Measured on agentmods" height="20"></a>
Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 513 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00111 $0.00513
Opus 5 $0.00056 $0.00257
Sonnet 5 $0.00022 $0.00103
Haiku 4.5 $0.00011 $0.00051

Measured 6d ago against content hash 2e6a8f30e3ca, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

analyzing-powershell-script-block-logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/agent.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/analyzing-powershell-script-block-logging/SKILL.md · 41 lines

What it actually says

使用说明

  1. 安装依赖: pip install python-evtx lxml
  2. 收集 PowerShell 操作日志: Microsoft-Windows-PowerShell%4Operational.evtx
  3. 使用 python-evtx 解析事件 ID 4104 条目,提取 ScriptBlockText、ScriptBlockId 以及 MessageNumber/MessageTotal,用于多块脚本重建。
  4. 应用检测启发式规则:
    • Base64 编码命令(-EncodedCommandFromBase64String
    • 下载植入器(DownloadStringDownloadFileInvoke-WebRequestNet.WebClient
    • AMSI 绕过模式(AmsiUtilsamsiInitFailed
    • 混淆指标(高熵、反引号插入、字符串拼接)
  5. 生成报告,包含重建脚本、风险评分和 MITRE ATT&CK 映射。
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 顺序拼接各块以恢复完整脚本。

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 41 lines · 111 tokens per session scan A 2e6a8f30e3ca

Subscribe to this mod's changes

analyzing-powershell-script-block-logging is a skill published in the GitHub repository killvxk/cybersecurity-skills-zh (44 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 111 tokens to every session and 513 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

analyzing-powershell-script-block-logging

Parse Windows PowerShell Script Block Logs (Event ID 4104) from EVTX files to detect obfuscated commands, encoded payloads, and living-off-the-land techniques. Uses python-evtx to extract and reconstruct multi-block scripts, applies entropy analysis and pattern matching for Base64-encoded commands, Invoke-Expression…

autohandai/community-skills · 88 tokens

analyzing-powershell-script-block-logging

Parse Windows PowerShell Script Block Logs (Event ID 4104) from EVTX files to detect obfuscated commands, encoded payloads, and living-off-the-land techniques. Uses python-evtx to extract and reconstruct multi-block scripts, applies entropy analysis and pattern matching for Base64-encoded commands, Invoke-Expression…

pinkpixel-dev/skills-collection-1 · 88 tokens

analyzing-powershell-script-block-logging

Parse Windows PowerShell Script Block Logs (Event ID 4104) from EVTX files to detect obfuscated commands, encoded payloads, and living-off-the-land techniques. Uses python-evtx to extract and reconstruct multi-block scripts, applies entropy analysis and pattern matching for Base64-encoded commands, Invoke-Expression…

marysatasselshaped667/skills-collection-1 · 88 tokens

analyzing-powershell-script-block-logging

Parse Windows PowerShell Script Block Logs (Event ID 4104) from EVTX files to detect obfuscated commands, encoded payloads, and living-off-the-land techniques. Uses python-evtx to extract and reconstruct multi-block scripts, applies entropy analysis and pattern matching for Base64-encoded commands, Invoke-Expression…

RobotFlow-Labs/skills-repo · 88 tokens

Génération de script PowerShell pour popup élégant sans module

Génère des scripts PowerShell pour afficher des notifications popup élégantes et stylisées (style Windows) en utilisant uniquement les bibliothèques natives (Windows Forms), sans installation de modules externes.

ECNU-ICALK/AutoSkill · 53 tokens

golang

Go coding standards and conventions for this project. Apply when writing, reviewing, or refactoring any Go source file.

JanDeDobbeleer/oh-my-posh · 26 tokens