Port Forwarding with Socat
Socat is a multipurpose relay tool. It can be used to port forwarding.
- [how-to-setup-ssh-tunneling](https://linuxize.com/post/how-to-setup-ssh-tunneling/)
Port Forwarding
Run the following command in local machine.
With command above, we can access to http://localhost:8080/
and get the content of the remote website.
Port Forwarding (from Remote Machine)
Run the following command in remote machine.
With command above, we can access to http://<remote-ip>:1234
in local machine, and get the content of the remote 8080 port.
Quiet Port Forwarding
1. Open Up Two Ports in Local Machine
2. Make a Connection between Local Port and Remote Port
In remote machine,
3. Confirmation in Your Local Machine
For example, if <remote-port>
is 8000 (HTTP), we can access to localhost:<remote-port>
.
4. Stop Port Forwarding
Reverse Shell Relay
1. Open Listener in Your Local Machine
2. Run Socat in Remote Machine
3. Confirmation in Your Local Machine
You can connect the remote shell, confirm by some commands.