Last active
February 25, 2024 20:57
-
-
Save t94j0/4df172f781f6e60fe0853194a477c987 to your computer and use it in GitHub Desktop.
Some discovery scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-GlobalSymbolResolver -DbgHelpPath 'C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll' | |
function Process-RpcProcedure { | |
param ( | |
[string]$Path | |
) | |
$dllHash = (Get-FileHash -Path $Path).Hash | |
$rpcs = Get-RpcServer -Path $Path | |
if ($rpcs.Procedures.Count -gt 0) { | |
foreach ($rpc in $rpcs) { | |
foreach ($procedure in $rpc.Procedures) { | |
[PSCustomObject]@{ | |
Dll = $Path | |
DllHash = $dllHash | |
Name = $procedure.Name | |
ProcNum = $procedure.ProcNum | |
} | |
} | |
} | |
} | |
} | |
function Get-RpcProceduresFromService { | |
Get-Win32Service | ?{$_.ServiceDll -ne ""} | %{$_.ServiceDLL} | ForEach-Object { | |
Process-RpcProcedure -Path $_ | |
} | |
} | |
function Get-RpcProceduresFromPath { | |
[CmdletBinding()] | |
param ( | |
[string]$Root = "C:\" | |
) | |
Get-ChildItem -Path $Root -Recurse -Include "*.dll","*.exe" | ForEach-Object -Parallel { | |
. .\importer.ps1 | |
Process-RpcProcedure -Path $_.FullName | |
} -ThrottleLimit 30 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment