diff options
Diffstat (limited to 'contrib/client-tools/tor-resolve.py')
-rwxr-xr-x | contrib/client-tools/tor-resolve.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/client-tools/tor-resolve.py b/contrib/client-tools/tor-resolve.py index 47ae1a0c38..85e7d2d8b4 100755 --- a/contrib/client-tools/tor-resolve.py +++ b/contrib/client-tools/tor-resolve.py @@ -1,4 +1,9 @@ -#!/usr/bin/python +#!/usr/bin/env python + +# Future imports for Python 2.7, mandatory in 3.0 +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals import socket import struct @@ -82,7 +87,7 @@ def parseHostAndPort(h): try: port = int(h[i+1:]) except ValueError: - print "Bad hostname %r"%h + print("Bad hostname %r"%h) sys.exit(1) elif h: try: @@ -118,15 +123,15 @@ def resolve(hostname, sockshost, socksport, socksver=4, reverse=0): return None answer += more result = parse(answer) - print "Got answer",result + print("Got answer",result) m = s.recv(1) if m: - print "Got extra data too: %r"%m + print("Got extra data too: %r"%m) return result if __name__ == '__main__': if len(sys.argv) not in (2,3,4): - print "Syntax: resolve.py [-4|-5] hostname [sockshost:socksport]" + print("Syntax: resolve.py [-4|-5] hostname [sockshost:socksport]") sys.exit(0) socksver = 4 reverse = 0 @@ -141,7 +146,7 @@ if __name__ == '__main__': break if len(sys.argv) >= 4: - print "Syntax: resolve.py [-x] [-4|-5] hostname [sockshost:socksport]" + print("Syntax: resolve.py [-x] [-4|-5] hostname [sockshost:socksport]") sys.exit(0) if len(sys.argv) == 3: sh,sp = parseHostAndPort(sys.argv[2]) |