mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-03 09:41:30 +01:00
Add support for IPv6 remote hosts.
Supported sshuttle commands for IPv6: ./sshuttle -r "IPv6:addr" 0.0.0.0/0 -vv ./sshuttle -r "[IPv6:addr]" 0.0.0.0/0 -vv ./sshuttle -r "[IPv6:addr]:22" 0.0.0.0/0 -vv Technically "invalid" address/port formats, but they can still be parsed because they’re unambiguous, so these also work: ./sshuttle -r "IPv6:addr]" 0.0.0.0/0 -vv ./sshuttle -r "IPv6:addr]:" 0.0.0.0/0 -vv ./sshuttle -r "IPv6:addr]:22" 0.0.0.0/0 -vv ./sshuttle -r "[IPv6:addr" 0.0.0.0/0 -vv (If you have a Mac with Back To My Mac, use dns-sd to discover the remote host's IPv6 address: dns-sd -G v4v6 <machine name>.<member name>.members.mac.com )
This commit is contained in:
parent
ef71751846
commit
95c9b788a0
27
ssh.py
27
ssh.py
@ -23,15 +23,33 @@ def empackage(z, filename):
|
||||
|
||||
def connect(ssh_cmd, rhostport, python):
|
||||
main_exe = sys.argv[0]
|
||||
l = (rhostport or '').split(':', 1)
|
||||
rhost = l[0]
|
||||
portl = []
|
||||
if len(l) > 1:
|
||||
portl = ['-p', str(int(l[1]))]
|
||||
|
||||
rhostIsIPv6 = False
|
||||
if rhostport.count(':') > 1:
|
||||
rhostIsIPv6 = True
|
||||
if rhostport.count(']') or rhostport.count('['):
|
||||
result = rhostport.split(']')
|
||||
rhost = result[0].strip('[')
|
||||
if len(result) > 1:
|
||||
result[1] = result[1].strip(':')
|
||||
if result[1] is not '':
|
||||
portl = ['-p', str(int(result[1]))]
|
||||
else: # can't disambiguate IPv6 colons and a port number. pass the hostname through.
|
||||
rhost = rhostport
|
||||
else: # IPv4
|
||||
l = (rhostport or '').split(':', 1)
|
||||
rhost = l[0]
|
||||
if len(l) > 1:
|
||||
portl = ['-p', str(int(l[1]))]
|
||||
|
||||
if rhost == '-':
|
||||
rhost = None
|
||||
|
||||
ipv6flag = []
|
||||
if rhostIsIPv6:
|
||||
ipv6flag = ['-6']
|
||||
|
||||
z = zlib.compressobj(1)
|
||||
content = readfile('assembler.py')
|
||||
content2 = (empackage(z, 'helpers.py') +
|
||||
@ -59,6 +77,7 @@ def connect(ssh_cmd, rhostport, python):
|
||||
sshl = ['ssh']
|
||||
argv = (sshl +
|
||||
portl +
|
||||
ipv6flag +
|
||||
[rhost, '--', "'%s' -c '%s'" % (python, pyscript)])
|
||||
(s1,s2) = socket.socketpair()
|
||||
def setup():
|
||||
|
Loading…
Reference in New Issue
Block a user