> 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/active-directory/enumeration/impacket-and-rpcclient.md).

# Impacket 和 rpcclient

### 本地 DNS 配置

在 Linux 机器上，我们在……中添加 DNS 解析 `/etc/hosts`:

{% code overflow="wrap" %}

```bash
172.16.0.10 WS01.whoami.local
172.16.0.20 WS02.whoami.local
172.16.0.100 DC01.whoami.local
```

{% endcode %}

这使得可以使用机器名而不是 IP 地址。

### 使用 rpcclient 进行枚举

使用域用户连接：

{% code overflow="wrap" %}

```bash
rpcclient -U "whoami/user1" WS01.whoami.local
```

{% endcode %}

`rpcclient` 可以查询特定的 Windows RPC 服务。

它可用于列出：

* 用户；
* 组；
* 一些 SAM 信息；
* 根据可用权限，某些域信息。

<figure><img src="/files/5d661f349463622ef5ab2cf8966731b297d9eea5" alt=""><figcaption></figcaption></figure>

### 使用 Impacket 进行枚举

#### 同步转储

{% code overflow="wrap" %}

```bash
samrdump.py 'whoami/user2'@WS02.whoami.local
```

{% endcode %}

`samrdump.py` 允许你列出可远程访问的 SAM 信息。

<figure><img src="/files/8c9226a2bed84f423b3a654dbc958f5733c2c02a" alt=""><figcaption></figcaption></figure>

#### secretsdump

{% code overflow="wrap" %}

```bash
secretsdump.py 'whoami/user2'@WS02.whoami.local
```

{% endcode %}

`secretsdump.py` 更为敏感：当用户具有必要权限时，它用于提取机密或哈希。

在实验环境中，你可以使用具有提升权限的用户进行测试。

### 使用 NetView 监听会话

{% code overflow="wrap" %}

```bash
netview.py 'whoami/administrador' -target WS01.whoami.local
```

{% endcode %}

该命令允许你观察与目标机器关联的某些会话或连接。

然后，我们可以向该机器创建一个 SMB 连接：

{% code overflow="wrap" %}

```bash
dir //WS01/c$
```

{% endcode %}

如果已建立会话，可能会在枚举工具中显示出来。

<figure><img src="/files/2f69b867450fb5f56644f5dd57265034232a1796" 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 dynamically by asking a question.

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

```
GET https://hacking-notes.jord4n.pro/zh/active-directory/enumeration/impacket-and-rpcclient.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
