Port forward (linux)
ssh local port forwarding
setup
- all request to localhost will be forwarded to target_2 through target_1
+---------------+ +---------------+ +---------------+
| | | | | |
| 0.0.0.0 +---->| 10.11.0.128 +---->| 192.168.1.110 |
| kali +---->| target_1 +---->| target_2 |
| | | student | | |
+---------------+ +---------------+ +---------------+
ssh -N -L [bind_address:]port:host:hostport [user@address]
ssh -N -L 0.0.0.0:445:192.168.1.110:445 student@10.11.0.128
ssh remote port forwarding
setup
- port 3306 on target machine is bind to 3306 port on kali
+----------------+ +----------------+
| | | |
| 127.0.0.1:3306 +---->| 10.11.0.4:3306 +
| target +---->| kali +
| | | |
+----------------+ +----------------+
- all request to port 3306 on kali will be forwarded to 3306
+---------------+ +----------------+ +--------------------+
| | | | | |
| 0.0.0.0 +---->| 10.11.0.4:3306 +---->| 192.168.1.110:3306 |
| kali +---->| kali +---->| target |
| | | | | |
+---------------+ +----------------+ +--------------------+
ssh -N -R [bind_address:]port:host:hostport [user@address]
ssh -N -R 10.11.0.4:3306:127.0.0.1:3306 kali@10.11.0.4
or on kali
proxy
- on kali, update proxychains.con
socks4 127.0.0.1 8080
+---------------+ +----------------+ +----------------+ +--------------------+
| | | | | | | |
| 0.0.0.0 +---->| 127.0.0.1:8080 +---->| 10.11.0.128 +---->| 192.168.1.110 |
| kali +---->| PROXY +---->| student +---->| target |
| | | | | | | |
+---------------+ +----------------+ +----------------+ +--------------------+
socat port forwarding
template
sourcegit clone https://github.com/andrew-d/static-binaries
cd static-binaries/binaries/linux/x86_64
python3 -m http.server