diff options
author | Brian May <brian@linuxpenguins.xyz> | 2015-12-07 13:16:47 +1100 |
---|---|---|
committer | Brian May <brian@linuxpenguins.xyz> | 2015-12-07 13:16:47 +1100 |
commit | 1ae4fce6b3562898d8d9f4a3db29855ca7cea6e2 (patch) | |
tree | ccaf4ac2e8e8b09100dc69ef47f1f18d652d5de3 /sshuttle/methods/pf.py | |
parent | 118171af7fe7d57fe28d27a581d92ea2e63820ae (diff) |
Fix logging with pf method and Python 3.5
Diffstat (limited to 'sshuttle/methods/pf.py')
-rw-r--r-- | sshuttle/methods/pf.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sshuttle/methods/pf.py b/sshuttle/methods/pf.py index d5357c5..bea3848 100644 --- a/sshuttle/methods/pf.py +++ b/sshuttle/methods/pf.py @@ -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() |