mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-04-23 10:49:35 +02:00
Remove trailing whitespaces
This commit is contained in:
parent
416636fa9b
commit
47030e846b
sshuttle
@ -150,17 +150,17 @@ def ipfw_noexit(*args):
|
|||||||
ssubprocess.call(argv)
|
ssubprocess.call(argv)
|
||||||
|
|
||||||
class Method(BaseMethod):
|
class Method(BaseMethod):
|
||||||
|
|
||||||
def get_supported_features(self):
|
def get_supported_features(self):
|
||||||
result = super(Method, self).get_supported_features()
|
result = super(Method, self).get_supported_features()
|
||||||
result.ipv6 = False
|
result.ipv6 = False
|
||||||
result.udp = False #NOTE: Almost there, kernel patch needed
|
result.udp = False #NOTE: Almost there, kernel patch needed
|
||||||
result.dns = True
|
result.dns = True
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_tcp_dstip(self, sock):
|
def get_tcp_dstip(self, sock):
|
||||||
return sock.getsockname()
|
return sock.getsockname()
|
||||||
|
|
||||||
def recv_udp(self, udp_listener, bufsize):
|
def recv_udp(self, udp_listener, bufsize):
|
||||||
srcip, dstip, data = recv_udp(udp_listener, bufsize)
|
srcip, dstip, data = recv_udp(udp_listener, bufsize)
|
||||||
if not dstip:
|
if not dstip:
|
||||||
@ -199,7 +199,7 @@ class Method(BaseMethod):
|
|||||||
raise Exception(
|
raise Exception(
|
||||||
'Address family "%s" unsupported by ipfw method_name'
|
'Address family "%s" unsupported by ipfw method_name'
|
||||||
% family_to_string(family))
|
% family_to_string(family))
|
||||||
|
|
||||||
#XXX: Any risk from this?
|
#XXX: Any risk from this?
|
||||||
ipfw_noexit('delete', '1')
|
ipfw_noexit('delete', '1')
|
||||||
|
|
||||||
@ -207,13 +207,13 @@ class Method(BaseMethod):
|
|||||||
name = _changedctls.pop()
|
name = _changedctls.pop()
|
||||||
oldval = _oldctls[name]
|
oldval = _oldctls[name]
|
||||||
_sysctl_set(name, oldval)
|
_sysctl_set(name, oldval)
|
||||||
|
|
||||||
if subnets or dnsport:
|
if subnets or dnsport:
|
||||||
sysctl_set('net.inet.ip.fw.enable', 1)
|
sysctl_set('net.inet.ip.fw.enable', 1)
|
||||||
|
|
||||||
ipfw('add', '1', 'check-state', 'ip',
|
ipfw('add', '1', 'check-state', 'ip',
|
||||||
'from', 'any', 'to', 'any')
|
'from', 'any', 'to', 'any')
|
||||||
|
|
||||||
ipfw('add', '1', 'skipto', '2',
|
ipfw('add', '1', 'skipto', '2',
|
||||||
'tcp',
|
'tcp',
|
||||||
'from', 'any', 'to', 'table(125)')
|
'from', 'any', 'to', 'table(125)')
|
||||||
|
@ -9,7 +9,7 @@ def _notify(message):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
addr = '\0' + addr[1:] if addr[0] == '@' else addr
|
addr = '\0' + addr[1:] if addr[0] == '@' else addr
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||||
except (OSError, IOError) as e:
|
except (OSError, IOError) as e:
|
||||||
|
@ -84,7 +84,7 @@ def test_subnet_weight():
|
|||||||
(socket.AF_INET, 16, 0, '192.168.0.0', 0, 0),
|
(socket.AF_INET, 16, 0, '192.168.0.0', 0, 0),
|
||||||
(socket.AF_INET, 0, 1, '0.0.0.0', 0, 0)
|
(socket.AF_INET, 0, 1, '0.0.0.0', 0, 0)
|
||||||
]
|
]
|
||||||
|
|
||||||
assert subnets_sorted == \
|
assert subnets_sorted == \
|
||||||
sorted(subnets, key=sshuttle.firewall.subnet_weight, reverse=True)
|
sorted(subnets, key=sshuttle.firewall.subnet_weight, reverse=True)
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ def test_setup_firewall_openbsd(mock_pf_get_dev, mock_ioctl, mock_pfctl):
|
|||||||
mock_pf_get_dev.reset_mock()
|
mock_pf_get_dev.reset_mock()
|
||||||
mock_ioctl.reset_mock()
|
mock_ioctl.reset_mock()
|
||||||
mock_pfctl.reset_mock()
|
mock_pfctl.reset_mock()
|
||||||
|
|
||||||
with pytest.raises(Exception) as excinfo:
|
with pytest.raises(Exception) as excinfo:
|
||||||
method.setup_firewall(
|
method.setup_firewall(
|
||||||
1025, 1027,
|
1025, 1027,
|
||||||
|
@ -241,7 +241,7 @@ def test_setup_firewall(mock_ipt_chain_exists, mock_ipt_ttl, mock_ipt):
|
|||||||
'--tproxy-mark', '0x1/0x1', '--dest', u'1.2.3.33/32',
|
'--tproxy-mark', '0x1/0x1', '--dest', u'1.2.3.33/32',
|
||||||
'-m', 'udp', '-p', 'udp', '--dport', '53', '--on-port', '1027'),
|
'-m', 'udp', '-p', 'udp', '--dport', '53', '--on-port', '1027'),
|
||||||
call(2, 'mangle', '-A', 'sshuttle-m-1025', '-j', 'RETURN',
|
call(2, 'mangle', '-A', 'sshuttle-m-1025', '-j', 'RETURN',
|
||||||
'--dest', u'1.2.3.66/32', '-m', 'tcp', '-p', 'tcp',
|
'--dest', u'1.2.3.66/32', '-m', 'tcp', '-p', 'tcp',
|
||||||
'--dport', '80:80'),
|
'--dport', '80:80'),
|
||||||
call(2, 'mangle', '-A', 'sshuttle-t-1025', '-j', 'RETURN',
|
call(2, 'mangle', '-A', 'sshuttle-t-1025', '-j', 'RETURN',
|
||||||
'--dest', u'1.2.3.66/32', '-m', 'tcp', '-p', 'tcp',
|
'--dest', u'1.2.3.66/32', '-m', 'tcp', '-p', 'tcp',
|
||||||
|
Loading…
Reference in New Issue
Block a user