mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-16 00:59:29 +01:00
ssh.py: allow hostnames of the form hostname:port
Feature requested by Wayne Scott and Ed Maste.
This commit is contained in:
parent
0cdd72c830
commit
8173925bcd
2
main.py
2
main.py
@ -45,7 +45,7 @@ def parse_ipport(s):
|
|||||||
|
|
||||||
|
|
||||||
optspec = """
|
optspec = """
|
||||||
sshuttle [-l [ip:]port] [-r [username@]sshserver] <subnets...>
|
sshuttle [-l [ip:]port] [-r [username@]sshserver[:port]] <subnets...>
|
||||||
sshuttle --iptables <port> <subnets...>
|
sshuttle --iptables <port> <subnets...>
|
||||||
sshuttle --server
|
sshuttle --server
|
||||||
--
|
--
|
||||||
|
9
ssh.py
9
ssh.py
@ -2,8 +2,13 @@ import sys, os, re, subprocess, socket
|
|||||||
import helpers
|
import helpers
|
||||||
from helpers import *
|
from helpers import *
|
||||||
|
|
||||||
def connect(rhost):
|
def connect(rhostport):
|
||||||
main_exe = sys.argv[0]
|
main_exe = sys.argv[0]
|
||||||
|
l = (rhostport or '').split(':', 1)
|
||||||
|
rhost = l[0]
|
||||||
|
portl = []
|
||||||
|
if len(l) > 1:
|
||||||
|
portl = ['-p', str(int(l[1]))]
|
||||||
nicedir = os.path.split(os.path.abspath(main_exe))[0]
|
nicedir = os.path.split(os.path.abspath(main_exe))[0]
|
||||||
nicedir = re.sub(r':', "_", nicedir)
|
nicedir = re.sub(r':', "_", nicedir)
|
||||||
myhome = os.path.expanduser('~') + '/'
|
myhome = os.path.expanduser('~') + '/'
|
||||||
@ -29,7 +34,7 @@ def connect(rhost):
|
|||||||
sh -c PATH=%s:'$HOME'/%s:'$PATH exec sshuttle --server%s'
|
sh -c PATH=%s:'$HOME'/%s:'$PATH exec sshuttle --server%s'
|
||||||
""" % (escapedir, escapedir2,
|
""" % (escapedir, escapedir2,
|
||||||
' -v' * (helpers.verbose or 0))
|
' -v' * (helpers.verbose or 0))
|
||||||
argv = ['ssh', rhost, '--', cmd.strip()]
|
argv = ['ssh'] + portl + [rhost, '--', cmd.strip()]
|
||||||
debug2('executing: %r\n' % argv)
|
debug2('executing: %r\n' % argv)
|
||||||
(s1,s2) = socket.socketpair()
|
(s1,s2) = socket.socketpair()
|
||||||
def setup():
|
def setup():
|
||||||
|
Loading…
Reference in New Issue
Block a user