analyzing-powershell-script-block-logging
यह क्या करती है
यह टूल PowerShell logs का विश्लेषण करके संदिग्ध या छिपाए गए कमांड खोजता है। यह उन तकनीकों को ढूंढता है जिनसे हैकर Windows पर खतरनाक कोड चलाते हैं।
कब इस्तेमाल करें
- ✓किसी सुरक्षा घटना की जांच करते समय।
- ✓खतरनाक गतिविधि पकड़ने के लिए अलर्ट बनाते समय।
- ✓यह देखने के लिए कि सुरक्षा सिस्टम ज्ञात हमले पकड़ पा रहा है या नहीं।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-powershell-script-block-logging/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस PowerShell log फ़ाइल का विश्लेषण करो और बताओ कि इसमें कुछ संदिग्ध है या नहीं।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
टूल PowerShell logs पढ़ता है, टुकड़ों में बंटे स्क्रिप्ट हिस्सों को जोड़ता है, और आम हमले के पैटर्न खोजता है, जैसे encoded कमांड या सुरक्षा बंद करने की कोशिश।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Analyzing PowerShell Script Block Logging
When to Use
- When investigating security incidents that require analyzing powershell script block logging
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Familiarity with security operations concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
Instructions
- Install dependencies:
pip install python-evtx lxml - Collect PowerShell Operational logs:
Microsoft-Windows-PowerShell%4Operational.evtx - Parse Event ID 4104 entries using python-evtx to extract ScriptBlockText, ScriptBlockId, and MessageNumber/MessageTotal for multi-part script reconstruction.
- Apply detection heuristics:
- Base64-encoded commands (
-EncodedCommand,FromBase64String) - Download cradles (
DownloadString,DownloadFile,Invoke-WebRequest,Net.WebClient) - AMSI bypass patterns (
AmsiUtils,amsiInitFailed) - Obfuscation indicators (high entropy, tick-mark insertion, string concatenation)
- Base64-encoded commands (
- Generate a report with reconstructed scripts, risk scores, and MITRE ATT&CK mappings.
python scripts/agent.py --evtx-file /path/to/PowerShell-Operational.evtx --output ps_analysis.json
Examples
Detect Encoded Command Execution
import base64
if "-encodedcommand" in script_text.lower():
encoded = script_text.split()[-1]
decoded = base64.b64decode(encoded).decode("utf-16-le")
Reconstruct Multi-Block Script
Scripts split across multiple 4104 events share a ScriptBlockId. Concatenate blocks ordered by MessageNumber to recover the full script.
अक्सर पूछे जाने वाले सवाल
'Script Block Logs' क्या होते हैं?
ये विस्तृत रिकॉर्ड हैं जो Windows तब बनाता है जब PowerShell कमांड चलाता है, जिससे पता चलता है कि असल में क्या चलाया गया।
'living-off-the-land' तकनीकें क्या हैं?
ये वे तरीके हैं जिनमें हमलावर Windows के असली टूल्स, जैसे PowerShell, का गलत इस्तेमाल करके हमला करते हैं, बिना कोई अलग खतरनाक सॉफ़्टवेयर इंस्टॉल किए।
इस संदर्भ में 'entropy' क्या है?
यह मापता है कि कोई टेक्स्ट कितना रैंडम या 'उलझा हुआ' दिखता है। ज़्यादा entropy वाला टेक्स्ट इशारा कर सकता है कि कमांड को इसलिए encode किया गया है ताकि उसका असली मकसद छिप जाए।
जानकारी
लेखक का मूल विवरण
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 abuse, download cradles, and AMSI bypass attempts.
लोकप्रियता
- GitHub स्टार
- 35k
- रैंकिंग में स्थान
- #7646
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।