> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/zh/ports-and-services/smb-445/rpcclient-smb-tool.md).

# rpcclient（SMB 工具）

使用 rpcclient 进行 SMB 和 Active Directory 枚举，涵盖用户、组、RID、描述和空会话。

> 一个 **RPCClient** 它是一个用于进行远程过程调用的程序。它允许客户端在远程服务器上执行函数或方法，就像它们在本地执行一样。客户端通过网络向服务器发送请求，服务器执行所请求的函数，并将结果返回给客户端。这种通信通常用于分布式架构中，以促进不同系统之间的交互。

### **连接到域控制器**

**1. 未经身份验证的初始登录**/ 无需提供密码即可连接到域控制器的命令。 `-N` 该选项表示 `rpcclient` 不要发送密码：

```bash
rpcclient -U "" 10.10.10.175 -N
```

**2. 枚举域用户**/ 列出域用户：

```bash
enumdomusers
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8ba2900412473c9125cb98ea67e44eb358aa820b%2Fimage%20(1567).png?alt=media" alt=""><figcaption></figcaption></figure>

**3. 域组列表**/ 列出域组的命令：

```bash
rpcclient -U "" 10.10.10.161 -N -c 'enumdomgroups'
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a05b4db631f36c83d6747ada6553d52ba4e07944%2Fimage%20(1569).png?alt=media" alt=""><figcaption></figcaption></figure>

### **用户和组的探查**

**1. 使用密码登录**/ 使用指定密码连接到域控制器：

```bash
rpcclient -U "<password>" 10.10.10.10
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a8d50175795880762fabaa6e19b27077c6d8b76f%2Fimage%20(2095).png?alt=media" alt=""><figcaption></figcaption></figure>

**2. 识别 Administrators 组成员**/ 要识别 Administrators 组成员（RID `0x200`):

```bash
rpcclient -U "<password>" 10.10.10.10 -c 'querygroupmem 0x200'
```

**3. 获取特定组中的用户**/ 要获取特定组中的用户（RID `0x1f4`):

```bash
rpcclient -U "<password>" 10.10.10.10 -c 'queryuser 0x1f4'
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-aea61c2fe124a97485708b74246a6d0827e9a329%2Fimage%20(2096).png?alt=media" alt=""><figcaption></figcaption></figure>

**4. 列出用户描述**/ 列出所有用户的描述：

```bash
rpcclient -U "<password>" 10.10.10.10 -c 'querydispinfo'
```

<div data-full-width="true"><figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-31c767e9a21e6717b930a8cdafb9ab30bdc01ae4%2Fimage%20(2097).png?alt=media" alt=""><figcaption></figcaption></figure></div>

### 域枚举

**1. 使用凭据登录域**/ 使用凭据连接到域控制器：

```bash
rpcclient -U 'ldap%nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' 10.10.11.174
```

**2. 域用户列表**

要列出域用户：

```
enumdomusers
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6b0b35dd85e726addffce56832f56c8a40ea29f4%2Fimage%20(1541).png?alt=media" alt=""><figcaption></figcaption></figure>

**3. 域组列表**/ 列出域中的组：

```bash
enumdomgroups
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-db6b248cef31df6216180ce1148c26c917ef9f2a%2Fimage%20(1543).png?alt=media" alt=""><figcaption></figcaption></figure>

**4. 用户描述**/ 获取用户描述：

```bash
querydispinfo
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9a6c088afc83bd590c7cee65ec87e9a5bfd6e8d9%2Fimage%20(1544).png?alt=media" alt=""><figcaption></figcaption></figure>

**5. 将有效用户写入文件**/ 将所有有效用户写入文件：

```bash
rpcclient -U 'ldap%nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' 10.10.11.174 -c 'enumdomusers' | grep -oP '/[.*?/]' | grep -v 0x |tr -d '[]'
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8d30a010c21f0ac40cf81716bea9056e3ffe7124%2Fimage%20(1545).png?alt=media" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/zh/ports-and-services/smb-445/rpcclient-smb-tool.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
