https://github.com/stavxyz/tunnels
ssh tunnels with paramiko
https://github.com/stavxyz/tunnels
Last synced: about 2 months ago
JSON representation
ssh tunnels with paramiko
- Host: GitHub
- URL: https://github.com/stavxyz/tunnels
- Owner: stavxyz
- Created: 2014-04-30T16:32:23.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-02T19:08:23.000Z (about 11 years ago)
- Last Synced: 2025-02-14T08:13:28.656Z (3 months ago)
- Language: Python
- Size: 246 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
tunnels
=======ssh tunnels with paramiko
### install dependencies
```bash
pip install -r requirements.txt
```### as a psexec proxy
```python
import tunnelbastionhost = 'my.bastion'
pkey = open('~/.ssh/id_rsa', 'r').read()client = tunnel.get_sshclient(bastionhost, private_key=pkey)
tunnel = tunnel.connect('windows.server', 445, client)# what port was my tunnel assigned? (defaults to localhost:P)
print tunnel.address
... ('127.0.0.1', 59277)tunnel.serve_forever()
# not yet implemented
c2 = tunnel.get_psexecclient('localhost', 59277)
c2.remote_execute('echo hello')```
### as an ssh proxy
```python
bastionhost = 'my.bastion'
pkey = open('~/.ssh/id_rsa', 'r').read()client = tunnel.get_sshclient(bastionhost, private_key=pkey)
tunnel = tunnel.connect('linux.server', 22, client)# what port was my tunnel assigned? (defaults to localhost:P)
print tunnel.address
... ('127.0.0.1', 59268)
tunnel.serve_forever()c2 = tunnel.get_sshclient('localhost', 59268)
c2.remote_execute('echo hello')
```