# Metasploit Tunneling

The autoroute module creates a reverse tunnel and allows us to direct network traffic into the appropriate subnet.

{% code title="@multihandler shell session" %}

```
background
use multi/manage/autoroute
set session 1 (the meterpreter shell session)
exploit

use auxiliary/server/socks_proxy
set srvhost 127.0.0.1
exploit -j

sudo bash -c 'echo "socks5 127.0.0.1 1080" >> /etc/proxychains4.conf'
```

{% endcode %}

We can configure to force TCP traffic through the proxy by adding the SOCKS4 proxy IP and port to the config file.

{% code overflow="wrap" %}

```
sudo bash -c 'echo "socks4 127.0.0.1 1080" >> /etc/proxychains.conf'
```

{% endcode %}

```
proxychains rdesktop 192.168.120.10
```

{% hint style="info" %}
Proxychains can be used with many other applications. For example, we can use Nmap to conduct an internal network scan or Firefox to browse internal web sites.
{% endhint %}


---

# 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://osnotes.jackielam.net/osep/network/windows-lateral-movement/metasploit-tunneling.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.
