Skip to content

Instantly share code, notes, and snippets.

@t94j0
Last active February 25, 2024 20:57
Show Gist options
  • Save t94j0/4df172f781f6e60fe0853194a477c987 to your computer and use it in GitHub Desktop.
Save t94j0/4df172f781f6e60fe0853194a477c987 to your computer and use it in GitHub Desktop.
Some discovery scripts
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