Scenario: Create reverse ssh tunnels
Requirement: rforward.py. Please get the rforward.py from paramiko’s repository
Example 1

## filename: example1.spy
from rforward import reverse_forward_tunnel
server_port = 8022
remote_host = 'host-2'
remote_port = 22
with $.connect('user@host-1',passwod='123456') as c:
transport = c.client.get_transport()
reverse_forward_tunnel(server_port, remote_host, remote_port, transport)
Execution & Tests
## Execution on localhost
sshscript example1.spy
## Tests on host-1
ssh -p 8022 user@localhost
Example 2: (Nested Connections)

## filename: example2.spy
from rforward import reverse_forward_tunnel
server_port = 8443
remote_host = 'www.google.com'
remote_port = 443
with $.connect('user@host-1',passwod='123456') as c1:
with $.connect('user@host-2',passwod='123456') as c2:
transport = c2.client.get_transport()
reverse_forward_tunnel(server_port, remote_host, remote_port, transport)
Execution & Tests
## Execution on localhost
sshscript example2.spy
## Tests on host-2
curl -k -H 'Host: www.google.com' https://127.0.0.1:8443/
Last Updated: 2026-07-25 16:59:40
Table of contents
- SSHScript v3.1 Documentation
- Accounts (legacy URL)
- Checking the syncing status of two MySQL servers
- Getting Started with SSHScript
- Page not found
- Q: What can it do that Netmiko doesn’t do? (origin)
- SSHScript Documentation
- SSHScript Documents
- SSHScript v2.0 CLI(Draft)
- SSHScript v2.0 Commands Execution and Console
- SSHScript v2.0 Console of sudo and su
- SSHScript v2.0 Getting Started
- SSHScript v2.0 Interactive Commands and Foreground Commands
- SSHScript v2.0 Make Connections
- SSHScript v2.0 Recipes
- SSHScript v2.0 Reference Guide
- SSHScript v2.0 Stdout, Stderr and Exitcode
- SSHScript v2.0 Threading Support
- SSHScript v2.0 Upload and Download Files
- SSHScript v2.0.2 Release Notes
- SSHScript v3.0 Interactive and Foreground Commands
- SSHScript v3.0 Reference Guide
- SSHScript v3.0.0 Release Notes
- SSHScript v3.1
- SSHScript vs. Ansible
- 用 Python 作系統自動化