mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge branch 'master' of ssh.github.com:mitmproxy/mitmproxy
This commit is contained in:
commit
7439e244a6
@ -30,7 +30,7 @@ class MyMaster(flow.FlowMaster):
|
|||||||
f = flow.FlowMaster.handle_response(self, f)
|
f = flow.FlowMaster.handle_response(self, f)
|
||||||
if f:
|
if f:
|
||||||
f.reply()
|
f.reply()
|
||||||
print f
|
print(f)
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
@ -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:
|
if filter_string is not None and filter_string not in attr:
|
||||||
continue
|
continue
|
||||||
value = getattr(obj, attr)
|
value = getattr(obj, attr)
|
||||||
print "%s.%s" % ('obj', attr), value, type(value)
|
print("%s.%s" % ('obj', attr), value, type(value))
|
||||||
|
@ -32,14 +32,14 @@ class Wrapper(object):
|
|||||||
return dict([re.findall(r'([^:]+): (.*)', line)[0] for line in state])
|
return dict([re.findall(r'([^:]+): (.*)', line)[0] for line in state])
|
||||||
|
|
||||||
def enable_proxy_for_service(self, service):
|
def enable_proxy_for_service(self, service):
|
||||||
print 'Enabling proxy on {}...'.format(service)
|
print('Enabling proxy on {}...'.format(service))
|
||||||
for subcommand in ['-setwebproxy', '-setsecurewebproxy']:
|
for subcommand in ['-setwebproxy', '-setsecurewebproxy']:
|
||||||
self.run_networksetup_command(
|
self.run_networksetup_command(
|
||||||
subcommand, service, '127.0.0.1', str(
|
subcommand, service, '127.0.0.1', str(
|
||||||
self.port))
|
self.port))
|
||||||
|
|
||||||
def disable_proxy_for_service(self, service):
|
def disable_proxy_for_service(self, service):
|
||||||
print 'Disabling proxy on {}...'.format(service)
|
print('Disabling proxy on {}...'.format(service))
|
||||||
for subcommand in ['-setwebproxystate', '-setsecurewebproxystate']:
|
for subcommand in ['-setwebproxystate', '-setsecurewebproxystate']:
|
||||||
self.run_networksetup_command(subcommand, service, 'Off')
|
self.run_networksetup_command(subcommand, service, 'Off')
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class Wrapper(object):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def ensure_superuser(cls):
|
def ensure_superuser(cls):
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
print 'Relaunching with sudo...'
|
print('Relaunching with sudo...')
|
||||||
os.execv('/usr/bin/sudo', ['/usr/bin/sudo'] + sys.argv)
|
os.execv('/usr/bin/sudo', ['/usr/bin/sudo'] + sys.argv)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -4,6 +4,6 @@ from libmproxy.script import concurrent
|
|||||||
|
|
||||||
@concurrent # Remove this and see what happens
|
@concurrent # Remove this and see what happens
|
||||||
def request(context, flow):
|
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)
|
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))
|
||||||
|
@ -14,6 +14,6 @@ with open("logfile", "rb") as logfile:
|
|||||||
print(f)
|
print(f)
|
||||||
print(f.request.host)
|
print(f.request.host)
|
||||||
json.dump(f.get_state(), sys.stdout, indent=4)
|
json.dump(f.get_state(), sys.stdout, indent=4)
|
||||||
print ""
|
print("")
|
||||||
except flow.FlowReadError as v:
|
except flow.FlowReadError as v:
|
||||||
print "Flow file corrupted. Stopped loading."
|
print "Flow file corrupted. Stopped loading."
|
||||||
|
@ -371,7 +371,7 @@ class TransparentProxy(object):
|
|||||||
if server:
|
if server:
|
||||||
packet.src_addr, packet.src_port = server
|
packet.src_addr, packet.src_port = server
|
||||||
else:
|
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)
|
packet = self.driver.update_packet_checksums(packet)
|
||||||
self.response_handle.send((packet.raw, metadata))
|
self.response_handle.send((packet.raw, metadata))
|
||||||
|
@ -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,
|
unicode strings then pass an optional encoding to the various functions,
|
||||||
like so::
|
like so::
|
||||||
|
|
||||||
>>> print repr(tnetstring.loads("2:\\xce\\xb1,"))
|
>>> print(repr(tnetstring.loads("2:\\xce\\xb1,")))
|
||||||
'\\xce\\xb1'
|
'\\xce\\xb1'
|
||||||
>>>
|
>>>
|
||||||
>>> print repr(tnetstring.loads("2:\\xce\\xb1,","utf8"))
|
>>> print(repr(tnetstring.loads("2:\\xce\\xb1,","utf8")))
|
||||||
u'\u03b1'
|
u'\u03b1'
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -232,7 +232,7 @@ class Settings(RequestHandler):
|
|||||||
self.state.set_intercept(v)
|
self.state.set_intercept(v)
|
||||||
update[k] = v
|
update[k] = v
|
||||||
else:
|
else:
|
||||||
print "Warning: Unknown setting {}: {}".format(k, v)
|
print("Warning: Unknown setting {}: {}".format(k, v))
|
||||||
|
|
||||||
ClientConnection.broadcast(
|
ClientConnection.broadcast(
|
||||||
type="settings",
|
type="settings",
|
||||||
|
Loading…
Reference in New Issue
Block a user