mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-03-14 16:19:01 +01: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,
|
||||
peer[0].encode("ASCII"), peer[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()
|
||||
line = pfile.readline()
|
||||
debug2(b"QUERY_PF_NAT %d,%d,%s,%d,%s,%d" % argv + b' > ' + line)
|
||||
if line.startswith(b'QUERY_PF_NAT_SUCCESS '):
|
||||
(ip, port) = line[21:].split(b',')
|
||||
in_line = pfile.readline()
|
||||
debug2(out_line.decode("ASCII") + ' > ' + in_line.decode("ASCII"))
|
||||
if in_line.startswith(b'QUERY_PF_NAT_SUCCESS '):
|
||||
(ip, port) = in_line[21:].split(b',')
|
||||
return (ip.decode("ASCII"), int(port))
|
||||
|
||||
return sock.getsockname()
|
||||
|
@ -12,6 +12,7 @@ def test_get_supported_features():
|
||||
assert not features.udp
|
||||
|
||||
|
||||
@patch('sshuttle.helpers.verbose', new=3)
|
||||
def test_get_tcp_dstip():
|
||||
sock = Mock()
|
||||
sock.getpeername.return_value = ("127.0.0.1", 1024)
|
||||
|
Loading…
Reference in New Issue
Block a user