commit 49f8f59838890dc565d01a1956953d6e1359af51 Author: David Fifield david@bamsoftware.com Date: Wed Jul 4 07:09:39 2012 -0700
Shorten parse_socks_request log messages. --- connector.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/connector.py b/connector.py index 333997a..7a180df 100755 --- a/connector.py +++ b/connector.py @@ -563,16 +563,16 @@ def parse_socks_request(data): except struct.error: raise ValueError("Couldn't unpack SOCKS4 header") if ver != 4: - raise ValueError("SOCKS header has wrong version (%d)" % ver) + raise ValueError("Wrong SOCKS version (%d)" % ver) if cmd != 1: - raise ValueError("SOCKS header had wrong command (%d)" % cmd) + raise ValueError("Wrong SOCKS command (%d)" % cmd) pos, userid = grab_string(data, 8) if userid is None: - raise ValueError("Couldn't read userid from SOCKS header") + raise ValueError("Couldn't read userid") if o1 == 0 and o2 == 0 and o3 == 0 and o4 != 0: pos, dest = grab_string(data, pos) if dest is None: - raise ValueError("Couldn't read destination from SOCKS4a header") + raise ValueError("Couldn't read destination") else: dest = "%d.%d.%d.%d" % (o1, o2, o3, o4) return dest, dport @@ -587,7 +587,7 @@ def handle_socks_request(fd): try: dest_addr = parse_socks_request(data) except ValueError, e: - log(u"Error parsing SOCKS header: %s." % str(e)) + log(u"Error parsing SOCKS request: %s." % str(e)) # Error reply. fd.sendall(struct.pack(">BBHBBBB", 0, 91, 0, 0, 0, 0, 0)) return False