From 651b9452998e210ba208ff9905095d7cc23683a7 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 1 May 2010 20:20:54 -0400 Subject: [PATCH] Prevent loopbacks caused by telnetting to the transproxy port directly. --- client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client.py b/client.py index ba3bdb7..5b39f0d 100644 --- a/client.py +++ b/client.py @@ -135,7 +135,11 @@ def main(remotename, subnets): def onaccept(): sock,srcip = listener.accept() dstip = original_dst(sock) - print 'Incoming connection from %r to %r.' % (srcip,dstip) + log('Incoming connection from %r to %r.\n' % (srcip,dstip)) + if dstip == sock.getsockname(): + log("-- ignored: that's my address!\n") + sock.close() + return outsock = socket() outsock.setsockopt(SOL_IP, IP_TTL, 42) outsock.connect(dstip)