How slachet/nishang works
Project type and purpose
• This is a script-library framework (“Nishang”) for offensive security, penetration testing, and red teaming using PowerShell. It’s not a client-server application but a modular collection of categorized PowerShell payloads, utilities, and backdoors that an operator imports and invokes during a pentest engagement.
File structure
• Top-level:
• nishang.psm1 – the module manifest that imports all functions.
• powerpreter/Powerpreter.psm1 – a “single-script” version wrapping most functionality.
• Directories: ActiveDirectory, Antak-WebShell, Backdoors, Bypass, Client, Escalation, Execution, Gather, MITM, Pivot, Prasadhak, Scan, Shells, Utility, Misc.
• Pattern: “Plugin” architecture. Each directory is a category of payloads or helpers. Scripts expose a function with the same name. Utility contains reusable routines (encoding, exfiltration, download).
README insights
• The framework is loaded via Import-Module .\nishang.psm1.
• Scripts are dot-sourced or invoked directly.
• No single persistent server component; instead scripts establish outbound channels (HTTP, HTTPS, DNS TXT, ICMP, WMI, etc.) to attacker-controlled services.
a. Main components
1. Module Loader (nishang.psm1 / Powerpreter.psm1)
2. Script Categories (“plugins”):
– ActiveDirectory
– Antak-WebShell
– Backdoors
– Bypass
– Client (document-based payload generators)
– Escalation
– Execution
– Gather
– MITM
– Pivot
– Prasadhak
– Scan
– Shells
– Utility
3. External Interfaces / Services:
– Attacker C2 Servers (HTTP, HTTPS, WebDAV, custom listener)
– DNS Resolver for TXT-based communication
– Email Service (Gmail for PsGcat)
– SMB / File servers (exfil capture)
– Web server (Antak/Webshell host)
4. Target System (Windows host under test)
b. Relationships and interactions
• Within each category, scripts often call Utility routines (Utility → all categories).
• Shells / Backdoors / MITM modules initiate outbound connections to External C2 Services.
c. Architecture patterns and design principles
• Plugin / modular architecture: each feature lives in its own directory as an independent script.
• Utility module provides common services (encoding, exfiltration, persistence) to avoid code duplication.
• “Single entry” via Import-Module; dynamic discovery of functions.
• Separation of payload generation (Client) vs. payload execution (Shells, Backdoors).
d. Key technologies and frameworks
• PowerShell v3+ (module manifests, dot-sourcing)
• .psm1 modules for packaging
• HTTP/HTTPS (Invoke-PoshRatHttp/Https), DNS TXT (DNS_TXT_Pwnage), ICMP (Invoke-PowerShellIcmp), WMI remoting.
• Volume Shadow Copy (Copy-VSS), Mimikatz integration, AD-specific APIs for DCShadow.
Detail but avoid overcomplexity
• Every top-level directory as its own component.
• Interdependencies only where they exist (Utility is the only shared dependency).
• Do not break out each script file; group them by category for readability.