Skip to content

Commit

Permalink
GITBOOK-631: change request with no subject merged in GitBook
Browse files Browse the repository at this point in the history
  • Loading branch information
fborsani authored and gitbook-bot committed Apr 17, 2024
1 parent 42a969d commit e75e4bd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions networking/port-forwarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Proxychains-ng

Version of proxychains that allows to specify different configurations for each connection. Useful for running multiple proxies on different ports when pivoting through several subnets.
Version of proxychains that allows to specify different configurations for each connection. Useful for running multiple proxies on different ports when pivoting through several subnets.

```
apt-get install proxychains4
Expand Down Expand Up @@ -33,6 +33,16 @@ Can also be used to expose services running as localhost on the remote machine t
ssh -N -R <kali ip>:<kali port>:<target address>:<target port> <kali user>@<kali ip>
```

#### Example of exposing services running as localhost

Run the following command on the compromised machine to map the local service port to a new port exposed to the attacker's machine.

```
ssh -N -R <exposed port>:localhost:<service port> <kali user>@<kali ip>
```

We can access the exposed service by navigating to the exposed port in our attacker machine. For instance if the exposed service is a web server and the specified exposed port is 8000 we can access the hosted content by navigating to `http://localhost:8000` on the attacker machine

### Dynamic port forwarding

Set a local listening port and have it tunnel incoming traffic to any remote destination through a proxy. Works the same way as a local port forwarding but allows to target different ports and machines without having to create different tunnels for each host or port.
Expand Down Expand Up @@ -87,6 +97,3 @@ socks4 <proxy ip> <port>
#run commands through proxy
proxychains <command>
```



0 comments on commit e75e4bd

Please sign in to comment.