Skip to content

Commit 8858cb7

Browse files
committed
Added ProcessId to Get-RpcEndpoint.
1 parent 49eb7ab commit 8858cb7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

NtObjectManager/RpcFunctions.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ A RPC binding string to query all endpoints from.
8383
An ALPC port name. Can contain a full path as long as the string contains \RPC Control\ (case sensitive).
8484
.PARAMETER FindAlpcPort
8585
Use brute force to find a valid ALPC endpoint for the interface.
86+
.PARAMETER ProcessId
87+
Used to find all ALPC ports in a process and get the supported interfaces.
8688
.INPUTS
8789
None or NtApiDotNet.Ndr.NdrRpcServerInterface
8890
.OUTPUTS
@@ -108,6 +110,9 @@ Get RPC endpoints for exposed over ncalrpc with name RPC_PORT.
108110
.EXAMPLE
109111
Get-RpcEndpoint -AlpcPort "RPC_PORT"
110112
Get RPC endpoints for exposed over ALPC with name RPC_PORT.
113+
.EXAMPLE
114+
Get-RpcEndpoint -ProcessId 1234
115+
Get RPC endpoints for exposed over ALPC for the process 1234.
111116
#>
112117
function Get-RpcEndpoint {
113118
[CmdletBinding(DefaultParameterSetName = "All")]
@@ -123,6 +128,9 @@ function Get-RpcEndpoint {
123128
[string]$Binding,
124129
[parameter(Mandatory, ParameterSetName = "FromAlpc")]
125130
[string]$AlpcPort,
131+
[parameter(Mandatory, ParameterSetName = "FromProcessId")]
132+
[alias("pid")]
133+
[int]$ProcessId,
126134
[parameter(ParameterSetName = "FromIdAndVersion")]
127135
[parameter(ParameterSetName = "FromServer")]
128136
[switch]$FindAlpcPort,
@@ -173,6 +181,9 @@ function Get-RpcEndpoint {
173181
"FromRpcClient" {
174182
[NtApiDotNet.Win32.RpcEndpointMapper]::QueryEndpoints($SearchBinding, $Client.InterfaceId, $Client.InterfaceVersion)
175183
}
184+
"FromProcessId" {
185+
(Get-RpcAlpcServer -ProcessId $ProcessId).Endpoints
186+
}
176187
}
177188

178189
if ($ProtocolSequence.Count -gt 0) {

0 commit comments

Comments
 (0)