# rpc

## Recon

```bash
# rpcbind port converts RPC to universal address 
# allows to access the NFS, port:111 
nmap --script=nfs-ls,nfs-statfs,nfs-showmount -p 111 $ip

nmap --script rpcinfo.nse -p 111 $ip
rpcinfo –p IP
rpcbind -p IP

# dumps the remote RPC endpoints information via epmapper.
impacket-rpcdump @[IP | DOMAIN]
```

## rpclient

* [Plundering Windows Account Info via \*\* Authenticated\*\* SMB Sessions](https://www.sans.org/blog/plundering-windows-account-info-via-authenticated-smb-sessions/)

```bash
rpcclient -U ['' | USER%PASS | DOMAIN\USER%PASS] IP [-N]
# -N: no password

srvinfo: server information => os.version, samba-version.
netshareenum: enumerate shares

# basic info
querydominfo: domain info
enumdomusers: enum domain users
enumdomgroups: enum domain groups
dsr_enumtrustdom: enumerate trusted domains

# query group info and membership
querygroup 0xGROUP
querygrupmem 0xGROUP

# query specific user by RID
queryuser USER
lookupnames USER (if user exists)

# password policy
querydompwinfo

enumdrivers
enumprinters
```

## enumerate users using SIDs (windows only)

```bash
# needs some user creds (smb also works)
impacket-lookupsid USER:PASS@IP
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kashz.gitbook.io/kashz-jewels/protocols/rpc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
