mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-05-30 14:48:51 +02:00
Fix logging with pf method and Python 3.5
This commit is contained in:
parent
118171af7f
commit
1ae4fce6b3
@ -158,12 +158,13 @@ class Method(BaseMethod):
|
|||||||
argv = (sock.family, socket.IPPROTO_TCP,
|
argv = (sock.family, socket.IPPROTO_TCP,
|
||||||
peer[0].encode("ASCII"), peer[1],
|
peer[0].encode("ASCII"), peer[1],
|
||||||
proxy[0].encode("ASCII"), proxy[1])
|
proxy[0].encode("ASCII"), proxy[1])
|
||||||
pfile.write(b"QUERY_PF_NAT %d,%d,%s,%d,%s,%d\n" % argv)
|
out_line = b"QUERY_PF_NAT %d,%d,%s,%d,%s,%d\n" % argv
|
||||||
|
pfile.write(out_line)
|
||||||
pfile.flush()
|
pfile.flush()
|
||||||
line = pfile.readline()
|
in_line = pfile.readline()
|
||||||
debug2(b"QUERY_PF_NAT %d,%d,%s,%d,%s,%d" % argv + b' > ' + line)
|
debug2(out_line.decode("ASCII") + ' > ' + in_line.decode("ASCII"))
|
||||||
if line.startswith(b'QUERY_PF_NAT_SUCCESS '):
|
if in_line.startswith(b'QUERY_PF_NAT_SUCCESS '):
|
||||||
(ip, port) = line[21:].split(b',')
|
(ip, port) = in_line[21:].split(b',')
|
||||||
return (ip.decode("ASCII"), int(port))
|
return (ip.decode("ASCII"), int(port))
|
||||||
|
|
||||||
return sock.getsockname()
|
return sock.getsockname()
|
||||||
|
@ -12,6 +12,7 @@ def test_get_supported_features():
|
|||||||
assert not features.udp
|
assert not features.udp
|
||||||
|
|
||||||
|
|
||||||
|
@patch('sshuttle.helpers.verbose', new=3)
|
||||||
def test_get_tcp_dstip():
|
def test_get_tcp_dstip():
|
||||||
sock = Mock()
|
sock = Mock()
|
||||||
sock.getpeername.return_value = ("127.0.0.1", 1024)
|
sock.getpeername.return_value = ("127.0.0.1", 1024)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user