diff --git a/examples/flowbasic b/examples/flowbasic index 083d7663b..6663dc468 100755 --- a/examples/flowbasic +++ b/examples/flowbasic @@ -30,7 +30,7 @@ class MyMaster(flow.FlowMaster): f = flow.FlowMaster.handle_response(self, f) if f: f.reply() - print f + print(f) return f diff --git a/examples/har_extractor.py b/examples/har_extractor.py index 1a76fa1f9..f06efec39 100644 --- a/examples/har_extractor.py +++ b/examples/har_extractor.py @@ -251,4 +251,4 @@ def print_attributes(obj, filter_string=None, hide_privates=False): if filter_string is not None and filter_string not in attr: continue value = getattr(obj, attr) - print "%s.%s" % ('obj', attr), value, type(value) + print("%s.%s" % ('obj', attr), value, type(value)) diff --git a/examples/mitmproxywrapper.py b/examples/mitmproxywrapper.py index 239642d7a..7ea107157 100755 --- a/examples/mitmproxywrapper.py +++ b/examples/mitmproxywrapper.py @@ -32,14 +32,14 @@ class Wrapper(object): return dict([re.findall(r'([^:]+): (.*)', line)[0] for line in state]) def enable_proxy_for_service(self, service): - print 'Enabling proxy on {}...'.format(service) + print('Enabling proxy on {}...'.format(service)) for subcommand in ['-setwebproxy', '-setsecurewebproxy']: self.run_networksetup_command( subcommand, service, '127.0.0.1', str( self.port)) def disable_proxy_for_service(self, service): - print 'Disabling proxy on {}...'.format(service) + print('Disabling proxy on {}...'.format(service)) for subcommand in ['-setwebproxystate', '-setsecurewebproxystate']: self.run_networksetup_command(subcommand, service, 'Off') @@ -129,7 +129,7 @@ class Wrapper(object): @classmethod def ensure_superuser(cls): if os.getuid() != 0: - print 'Relaunching with sudo...' + print('Relaunching with sudo...') os.execv('/usr/bin/sudo', ['/usr/bin/sudo'] + sys.argv) @classmethod diff --git a/examples/nonblocking.py b/examples/nonblocking.py index f96b7f40a..7bc9c07b3 100644 --- a/examples/nonblocking.py +++ b/examples/nonblocking.py @@ -4,6 +4,6 @@ from libmproxy.script import concurrent @concurrent # Remove this and see what happens def request(context, flow): - print "handle request: %s%s" % (flow.request.host, flow.request.path) + print("handle request: %s%s" % (flow.request.host, flow.request.path)) time.sleep(5) - print "start request: %s%s" % (flow.request.host, flow.request.path) + print("start request: %s%s" % (flow.request.host, flow.request.path)) diff --git a/examples/read_dumpfile b/examples/read_dumpfile index 9da604cc8..2238d2d28 100644 --- a/examples/read_dumpfile +++ b/examples/read_dumpfile @@ -14,6 +14,6 @@ with open("logfile", "rb") as logfile: print(f) print(f.request.host) json.dump(f.get_state(), sys.stdout, indent=4) - print "" + print("") except flow.FlowReadError as v: print "Flow file corrupted. Stopped loading." diff --git a/libmproxy/platform/windows.py b/libmproxy/platform/windows.py index 5133d0569..09a4422f1 100644 --- a/libmproxy/platform/windows.py +++ b/libmproxy/platform/windows.py @@ -371,7 +371,7 @@ class TransparentProxy(object): if server: packet.src_addr, packet.src_port = server else: - print "Warning: Previously unseen connection from proxy to %s:%s." % client + print("Warning: Previously unseen connection from proxy to %s:%s." % client) packet = self.driver.update_packet_checksums(packet) self.response_handle.send((packet.raw, metadata)) diff --git a/libmproxy/tnetstring.py b/libmproxy/tnetstring.py index bed8405ff..c5c185c64 100644 --- a/libmproxy/tnetstring.py +++ b/libmproxy/tnetstring.py @@ -60,10 +60,10 @@ By default tnetstrings work only with byte strings, not unicode. If you want unicode strings then pass an optional encoding to the various functions, like so:: - >>> print repr(tnetstring.loads("2:\\xce\\xb1,")) + >>> print(repr(tnetstring.loads("2:\\xce\\xb1,"))) '\\xce\\xb1' >>> - >>> print repr(tnetstring.loads("2:\\xce\\xb1,","utf8")) + >>> print(repr(tnetstring.loads("2:\\xce\\xb1,","utf8"))) u'\u03b1' """ diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py index 69341e76e..29ae9e7a8 100644 --- a/libmproxy/web/app.py +++ b/libmproxy/web/app.py @@ -232,7 +232,7 @@ class Settings(RequestHandler): self.state.set_intercept(v) update[k] = v else: - print "Warning: Unknown setting {}: {}".format(k, v) + print("Warning: Unknown setting {}: {}".format(k, v)) ClientConnection.broadcast( type="settings",