A PowerShell module for decompiling .NET assemblies using the ILSpy decompiler engine.
ISpy module provides comprehensive cmdlets to decompile .NET assemblies into readable C# source code.
Built on top of the ICSharpCode.Decompiler library (the engine behind ILSpy), it offers a powerful command-line interface for .NET assembly analysis and decompilation tasks.
- Complete Assembly Decompilation: Decompile entire .NET assemblies to organized C# source code
- Targeted Type Analysis: Focus on specific types, methods, or namespaces
- Cross-Platform Support: Works with .NET Framework, .NET Core, and .NET 5+ assemblies
- Flexible Output Options: Console output, single files, or organized directory structures
- Advanced Search Capabilities: Find types and methods across multiple assemblies
- Pipeline Integration: Full PowerShell pipeline support for batch operations
- Dependency Analysis: Analyze assembly dependencies and relationships
- Syntax highlighting: PowerShell Module TextMate, pipe
Expand-Typeoutput toFormat-TextMate
Install-Module ISpy- PowerShell: 7.6
- Windows Powershell: 5.1
- Clone this repository
- Open a terminal in the project directory
- Build the project:
& .\build.ps1- Import the module:
Import-Module .\output\ISpy.psd1This module exposes the following cmdlets for assembly analysis and decompilation:
| Cmdlet | Purpose |
|---|---|
| Expand-Type | Decompile specific methods or show type source (interactive) |
| Export-DecompiledSource | Export decompiled types to files with namespace organization |
| Get-AssemblyInfo | Assembly metadata and information |
| Get-DecompiledSource | Decompile types (returns an object per type) |
| Get-Dependency | Assembly dependency mapping |
| Get-Type | List and filter types within assemblies |
| New-Decompiler | Create configured CSharpDecompiler instances |
| New-DecompilerSetting | Creates a configurable DecompilerSettings |
| New-DecompilerFormattingOption | Creates a configurable CSharpFormattingOptions |
[Math]::Truncate | Expand-TypeGet-Command Get-ChildItem | Expand-TypeGet-Item (Get-Module ISpy).Path | Get-TypeGet-Type -Path (Join-Path $PSHOME 'System.Console.dll') -NamePattern "*Console*" Get-AssemblyInfo -Path (Join-Path $PSHOME 'System.Console.dll')Get-Item (Get-Module ISpy).Path | Get-Dependency -ExternalOnlyGet-DecompiledSource -Path (Join-Path $PSHOME 'System.Console.dll') | Select-Object -First 1# settings + formatting
$formatSplat = @{
# Stroustrup-ish formatting
ClassBraceStyle = 'EndOfLine'
IndentationString = ' '
MethodBraceStyle = 'EndOfLine'
NewLineAferIndexerOpenBracket = 'NewLine'
StatementBraceStyle = 'EndOfLine'
ChainedMethodCallWrapping = 'WrapAlways'
InterfaceBraceStyle = 'EndOfLine'
StructBraceStyle = 'EndOfLine'
EnumBraceStyle = 'EndOfLine'
ConstructorBraceStyle = 'EndOfLine'
}
$options = @{
FileScopedNamespaces = $true
AlwaysUseBraces = $true
CSharpFormattingOptions = New-DecompilerFormattingOption @formatSplat
}
$Settings = New-DecompilerSetting @options
[System.Console]::Write | Expand-Type -Settings $Settingssee docs/en-us/ for more examples.
ISpy/
├── src/ # Source code
│ ├── Cmdlets/ # PowerShell cmdlet implementations
│ ├── Models/ # Data transfer objects
│ └── Utilities/ # Helper classes
├── tests/ # Pester test suite
├── docs/en-us/ # PowerShell help documentation
├── output/ # Built module package
└── build.ps1 # Build script
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Update documentation as needed
- Submit a pull request
This project follows the same license terms as the ISpy project it's based on.
Note: This module is designed for legitimate reverse engineering, learning, and analysis purposes. Please respect intellectual property rights and licensing terms when decompiling third-party assemblies.