# SSH Tunneling

## Port Forwarding

{% tabs %}
{% tab title="Socks" %}

```bash
ssh -D 7000 qu35t@qu35t.pw
```

{% endtab %}

{% tab title="Forward Tunnel" %}
Map port from remote machine/network on local machine.

```bash
ssh -L 9002:127.0.0.1:3306 qu35t@qu35t.pw
```

{% endtab %}

{% tab title="Reverse Tunnel" %}
Make local port accessable to remote machine.

```bash
ssh -R 9004:127.0.0.1:9002 qu35t@qu35t.pw
```

{% endtab %}

{% tab title="Magic Key" %}

```sh
qu35t@qu35t.pw:~$ ~C
ssh> -L 9002:127.0.0.1:3306
```

{% endtab %}
{% endtabs %}

## Proxychains <a href="#proxychains" id="proxychains"></a>

{% tabs %}
{% tab title="Proxychains conf" %}
Add this following line at the end of the **/etc/proxychains.conf** file.

```bash
socks5 127.0.0.1 7000
```

{% endtab %}

{% tab title="Execute a command with proxychains" %}

```bash
proxychains -q nmap -T4 -sn 172.10.0.0/24 --unprivileged
```

{% endtab %}
{% endtabs %}
