# Pivoting & Port Forwarding

## Pivoting

Metasploit Pivoting

```bash
# Check if there are available pivoting targets
ifconfig | ipconfig

# Add a route to the internal subnet via pivot
run post/multi/manage/autoroute SESSION=<ID>

# (Optional) Verify new route
run post/multi/manage/autoroute -l

# Further enumeration through pivot
use auxiliary/scanner/discovery/arp_sweep

# Perform a TCP Port Scan
use auxiliary/scanner/portscan/tcp
```

#### Metasploit Port Forwarding

```bash
# Add a port forward
portfwd add -l <local_port> -p <remote_port> -r <remote_ip>

# Example: forward internal web server
portfwd add -l 8080 -p 80 -r <Our IP>

# View active forwards
portfwd list

# Remove a port forward
portfwd delete -l <local_port>

```
