Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MacOS precompiled app package for sshuttle-0.51

  • Loading branch information...
commit cd15e2eda6ab497d6dd9b8d507a5e17d14f0b1e6 1 parent 76359bc
@apenwarr apenwarr authored
Showing with 135 additions and 10 deletions.
  1. BIN  Sshuttle VPN.app/Contents/Resources/English.lproj/MainMenu.nib
  2. BIN  Sshuttle VPN.app/Contents/Resources/askpass.pyc
  3. +12 −4 Sshuttle VPN.app/Contents/Resources/main.py
  4. +9 −0 Sshuttle VPN.app/Contents/Resources/models.py
  5. BIN  Sshuttle VPN.app/Contents/Resources/models.pyc
  6. BIN  Sshuttle VPN.app/Contents/Resources/my.pyc
  7. +4 −0 Sshuttle VPN.app/Contents/Resources/sshuttle/client.py
  8. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/client.pyc
  9. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/compat/__init__.pyc
  10. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/compat/ssubprocess.pyc
  11. +13 −5 Sshuttle VPN.app/Contents/Resources/sshuttle/firewall.py
  12. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/firewall.pyc
  13. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.pyc
  14. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/hostwatch.pyc
  15. +4 −0 Sshuttle VPN.app/Contents/Resources/sshuttle/main.py
  16. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/options.pyc
  17. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/server.pyc
  18. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/ssh.pyc
  19. +4 −0 Sshuttle VPN.app/Contents/Resources/sshuttle/sshuttle
  20. +3 −1 Sshuttle VPN.app/Contents/Resources/sshuttle/ssnet.py
  21. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/ssnet.pyc
  22. BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/ssyslog.pyc
  23. +86 −0 Sshuttle VPN.app/Contents/Resources/sshuttle/stresstest.py
View
BIN  Sshuttle VPN.app/Contents/Resources/English.lproj/MainMenu.nib
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/askpass.pyc
Binary file not shown
View
16 Sshuttle VPN.app/Contents/Resources/main.py
@@ -136,7 +136,7 @@ class SshuttleController(NSObject):
prefsWindow = objc.IBOutlet()
serversController = objc.IBOutlet()
logField = objc.IBOutlet()
- noLatencyControlField = objc.IBOutlet()
+ latencyControlField = objc.IBOutlet()
servers = []
conns = {}
@@ -162,14 +162,14 @@ def promptfunc(prompt):
manual_nets = ['0/0']
else:
manual_nets = []
+ noLatencyControl = (server.latencyControl() != models.LAT_INTERACTIVE)
conn = Runner(sshuttle_args(host,
auto_nets = nets_mode == models.NET_AUTO,
auto_hosts = server.autoHosts(),
dns = server.useDns(),
nets = manual_nets,
debug = self.debugField.state(),
- no_latency_control
- = self.noLatencyControlField.state()),
+ no_latency_control = noLatencyControl),
logfunc=logfunc, promptfunc=promptfunc,
serverobj=server)
self.conns[host] = conn
@@ -286,12 +286,14 @@ def load_servers(self):
autoNets = s.get('autoNets', models.NET_AUTO)
autoHosts = s.get('autoHosts', True)
useDns = s.get('useDns', autoNets == models.NET_ALL)
+ latencyControl = s.get('latencyControl', models.LAT_INTERACTIVE)
srv = models.SshuttleServer.alloc().init()
srv.setHost_(host)
srv.setAutoNets_(autoNets)
srv.setAutoHosts_(autoHosts)
srv.setNets_(nl)
srv.setUseDns_(useDns)
+ srv.setLatencyControl_(latencyControl)
sl.append(srv)
self.serversController.addObjects_(sl)
self.serversController.setSelectionIndex_(0)
@@ -310,7 +312,8 @@ def save_servers(self):
nets=nets,
autoNets=s.autoNets(),
autoHosts=s.autoHosts(),
- useDns=s.useDns())
+ useDns=s.useDns(),
+ latencyControl=s.latencyControl())
l.append(d)
my.Defaults().setObject_forKey_(l, 'servers')
self.fill_menu()
@@ -322,6 +325,11 @@ def awakeFromNib(self):
tf('Determine automatically')
tf('Custom...')
+ self.latencyControlField.removeAllItems()
+ tf = self.latencyControlField.addItemWithTitle_
+ tf('Fast transfer')
+ tf('Low latency')
+
# Hmm, even when I mark this as !enabled in the .nib, it still comes
# through as enabled. So let's just disable it here (since we don't
# support this feature yet).
View
9 Sshuttle VPN.app/Contents/Resources/models.py
@@ -58,6 +58,9 @@ def validateWidth_error_(self, value, error):
NET_AUTO = 1
NET_MANUAL = 2
+LAT_BANDWIDTH = 0
+LAT_INTERACTIVE = 1
+
class SshuttleServer(NSObject):
def init(self):
self = super(SshuttleServer, self).init()
@@ -155,3 +158,9 @@ def useDns(self):
def setUseDns_(self, v):
self._k_useDns = v
config_changed()
+
+ def latencyControl(self):
+ return getattr(self, '_k_latencyControl', LAT_INTERACTIVE)
+ def setLatencyControl_(self, v):
+ self._k_latencyControl = v
+ config_changed()
View
BIN  Sshuttle VPN.app/Contents/Resources/models.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/my.pyc
Binary file not shown
View
4 Sshuttle VPN.app/Contents/Resources/sshuttle/client.py
@@ -273,6 +273,10 @@ def onaccept():
sock.close()
return
chan = mux.next_channel()
+ if not chan:
+ log('warning: too many open channels. Discarded connection.\n')
+ sock.close()
+ return
mux.send(chan, ssnet.CMD_CONNECT, '%s,%s' % dstip)
outwrap = MuxWrapper(mux, chan)
handlers.append(Proxy(SockWrapper(sock, sock), outwrap))
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/client.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/compat/__init__.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/compat/ssubprocess.pyc
Binary file not shown
View
18 Sshuttle VPN.app/Contents/Resources/sshuttle/firewall.py
@@ -131,11 +131,11 @@ def _fill_oldctls(prefix):
def _sysctl_set(name, val):
argv = ['sysctl', '-w', '%s=%s' % (name, val)]
debug1('>> %s\n' % ' '.join(argv))
- rv = ssubprocess.call(argv, stdout = open('/dev/null', 'w'))
+ return ssubprocess.call(argv, stdout = open('/dev/null', 'w'))
_changedctls = []
-def sysctl_set(name, val):
+def sysctl_set(name, val, permanent=False):
PREFIX = 'net.inet.ip'
assert(name.startswith(PREFIX + '.'))
val = str(val)
@@ -146,8 +146,16 @@ def sysctl_set(name, val):
return
oldval = _oldctls[name]
if val != oldval:
- _changedctls.append(name)
- return _sysctl_set(name, val)
+ rv = _sysctl_set(name, val)
+ if rv==0 and permanent:
+ debug1('>> ...saving permanently in /etc/sysctl.conf\n')
+ f = open('/etc/sysctl.conf', 'a')
+ f.write('\n'
+ '# Added by sshuttle\n'
+ '%s=%s\n' % (name, val))
+ f.close()
+ else:
+ _changedctls.append(name)
def _udp_unpack(p):
@@ -206,7 +214,7 @@ def do_ipfw(port, dnsport, subnets):
if subnets or dnsport:
sysctl_set('net.inet.ip.fw.enable', 1)
- sysctl_set('net.inet.ip.scopedroute', 0)
+ sysctl_set('net.inet.ip.scopedroute', 0, permanent=True)
ipfw('add', sport, 'check-state', 'ip',
'from', 'any', 'to', 'any')
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/firewall.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/helpers.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/hostwatch.pyc
Binary file not shown
View
4 Sshuttle VPN.app/Contents/Resources/sshuttle/main.py
@@ -62,6 +62,7 @@ def parse_ipport(s):
e,ssh-cmd= the command to use to connect to the remote [ssh]
seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
no-latency-control sacrifice latency to improve bandwidth benchmarks
+wrap= restart counting channel numbers after this number (for testing)
D,daemon run in the background as a daemon
syslog send log messages to syslog (default if you use --daemon)
pidfile= pidfile name (only if using --daemon) [./sshuttle.pid]
@@ -74,6 +75,9 @@ def parse_ipport(s):
if opt.daemon:
opt.syslog = 1
+if opt.wrap:
+ import ssnet
+ ssnet.MAX_CHANNEL = int(opt.wrap)
helpers.verbose = opt.verbose
try:
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/options.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/server.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/ssh.pyc
Binary file not shown
View
4 Sshuttle VPN.app/Contents/Resources/sshuttle/sshuttle
@@ -62,6 +62,7 @@ v,verbose increase debug message verbosity
e,ssh-cmd= the command to use to connect to the remote [ssh]
seed-hosts= with -H, use these hostnames for initial scan (comma-separated)
no-latency-control sacrifice latency to improve bandwidth benchmarks
+wrap= restart counting channel numbers after this number (for testing)
D,daemon run in the background as a daemon
syslog send log messages to syslog (default if you use --daemon)
pidfile= pidfile name (only if using --daemon) [./sshuttle.pid]
@@ -74,6 +75,9 @@ o = options.Options(optspec)
if opt.daemon:
opt.syslog = 1
+if opt.wrap:
+ import ssnet
+ ssnet.MAX_CHANNEL = int(opt.wrap)
helpers.verbose = opt.verbose
try:
View
4 Sshuttle VPN.app/Contents/Resources/sshuttle/ssnet.py
@@ -1,6 +1,8 @@
import struct, socket, errno, select
if not globals().get('skip_imports'):
from helpers import *
+
+MAX_CHANNEL = 65535
# these don't exist in the socket module in python 2.3!
SHUT_RD = 0
@@ -300,7 +302,7 @@ def next_channel(self):
# channel 0 is special, so we never allocate it
for timeout in xrange(1024):
self.chani += 1
- if self.chani > 65535:
+ if self.chani > MAX_CHANNEL:
self.chani = 1
if not self.channels.get(self.chani):
return self.chani
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/ssnet.pyc
Binary file not shown
View
BIN  Sshuttle VPN.app/Contents/Resources/sshuttle/ssyslog.pyc
Binary file not shown
View
86 Sshuttle VPN.app/Contents/Resources/sshuttle/stresstest.py
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+import sys, os, socket, select, struct, time
+
+listener = socket.socket()
+listener.bind(('127.0.0.1', 0))
+listener.listen(500)
+
+servers = []
+clients = []
+remain = {}
+
+NUMCLIENTS = 50
+count = 0
+
+
+while 1:
+ if len(clients) < NUMCLIENTS:
+ c = socket.socket()
+ c.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ c.bind(('0.0.0.0', 0))
+ c.connect(listener.getsockname())
+ count += 1
+ if count >= 16384:
+ count = 1
+ print 'cli CREATING %d' % count
+ b = struct.pack('I', count) + 'x'*count
+ remain[c] = count
+ print 'cli >> %r' % len(b)
+ c.send(b)
+ c.shutdown(socket.SHUT_WR)
+ clients.append(c)
+ r = [listener]
+ time.sleep(0.1)
+ else:
+ r = [listener]+servers+clients
+ print 'select(%d)' % len(r)
+ r,w,x = select.select(r, [], [], 5)
+ assert(r)
+ for i in r:
+ if i == listener:
+ s,addr = listener.accept()
+ servers.append(s)
+ elif i in servers:
+ b = i.recv(4096)
+ print 'srv << %r' % len(b)
+ if not i in remain:
+ assert(len(b) >= 4)
+ want = struct.unpack('I', b[:4])[0]
+ b = b[4:]
+ #i.send('y'*want)
+ else:
+ want = remain[i]
+ if want < len(b):
+ print 'weird wanted %d bytes, got %d: %r' % (want, len(b), b)
+ assert(want >= len(b))
+ want -= len(b)
+ remain[i] = want
+ if not b: # EOF
+ if want:
+ print 'weird: eof but wanted %d more' % want
+ assert(want == 0)
+ i.close()
+ servers.remove(i)
+ del remain[i]
+ else:
+ print 'srv >> %r' % len(b)
+ i.send('y'*len(b))
+ if not want:
+ i.shutdown(socket.SHUT_WR)
+ elif i in clients:
+ b = i.recv(4096)
+ print 'cli << %r' % len(b)
+ want = remain[i]
+ if want < len(b):
+ print 'weird wanted %d bytes, got %d: %r' % (want, len(b), b)
+ assert(want >= len(b))
+ want -= len(b)
+ remain[i] = want
+ if not b: # EOF
+ if want:
+ print 'weird: eof but wanted %d more' % want
+ assert(want == 0)
+ i.close()
+ clients.remove(i)
+ del remain[i]
+listener.accept()
Please sign in to comment.
Something went wrong with that request. Please try again.