We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 118171a commit 1ae4fceCopy full SHA for 1ae4fce
sshuttle/methods/pf.py
@@ -158,12 +158,13 @@ def get_tcp_dstip(self, sock):
158
argv = (sock.family, socket.IPPROTO_TCP,
159
peer[0].encode("ASCII"), peer[1],
160
proxy[0].encode("ASCII"), proxy[1])
161
- 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
162
+ pfile.write(out_line)
163
pfile.flush()
- line = pfile.readline()
164
- debug2(b"QUERY_PF_NAT %d,%d,%s,%d,%s,%d" % argv + b' > ' + line)
165
- if line.startswith(b'QUERY_PF_NAT_SUCCESS '):
166
- (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 '):
167
+ (ip, port) = in_line[21:].split(b',')
168
return (ip.decode("ASCII"), int(port))
169
170
return sock.getsockname()
sshuttle/tests/test_methods_pf.py
@@ -12,6 +12,7 @@ def test_get_supported_features():
12
assert not features.udp
13
14
15
+@patch('sshuttle.helpers.verbose', new=3)
16
def test_get_tcp_dstip():
17
sock = Mock()
18
sock.getpeername.return_value = ("127.0.0.1", 1024)
0 commit comments