mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-01-12 22:48:54 +08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a1ca53689 | ||
|
|
d0c27c76af | ||
|
|
b72f3ee568 | ||
|
|
2fcc0458d1 | ||
|
|
fb1d2a8c89 | ||
|
|
6b524c9054 | ||
|
|
ffe7eb94f1 |
@@ -19,7 +19,7 @@ class ClientPlayback:
|
||||
def configure(self, options, updated):
|
||||
if "client_replay" in updated:
|
||||
if options.client_replay:
|
||||
ctx.log.info(options.client_replay)
|
||||
ctx.log.info("Client Replay: {}".format(options.client_replay))
|
||||
try:
|
||||
flows = flow.read_flows_from_paths(options.client_replay)
|
||||
except exceptions.FlowReadException as e:
|
||||
|
||||
@@ -285,9 +285,6 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
self.logbuffer.pop(0)
|
||||
self.logbuffer.set_focus(len(self.logbuffer) - 1)
|
||||
|
||||
def add_log(self, e, level):
|
||||
signals.add_log(e, level)
|
||||
|
||||
def sig_call_in(self, sender, seconds, callback, args=()):
|
||||
def cb(*_):
|
||||
return callback(*args)
|
||||
@@ -668,11 +665,10 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
)
|
||||
|
||||
def process_flow(self, f):
|
||||
should_intercept = any(
|
||||
[
|
||||
self.state.intercept and flowfilter.match(self.state.intercept, f) and not f.request.is_replay,
|
||||
f.intercepted,
|
||||
]
|
||||
should_intercept = (
|
||||
self.state.intercept and flowfilter.match(self.state.intercept, f)
|
||||
and not f.request.is_replay
|
||||
and f.reply.state == "handled"
|
||||
)
|
||||
if should_intercept:
|
||||
f.intercept(self)
|
||||
@@ -703,9 +699,13 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
super(ConsoleMaster, self).tcp_message(f)
|
||||
message = f.messages[-1]
|
||||
direction = "->" if message.from_client else "<-"
|
||||
self.add_log("{client} {direction} tcp {direction} {server}".format(
|
||||
signals.add_log("{client} {direction} tcp {direction} {server}".format(
|
||||
client=repr(f.client_conn.address),
|
||||
server=repr(f.server_conn.address),
|
||||
direction=direction,
|
||||
), "info")
|
||||
self.add_log(strutils.bytes_to_escaped_str(message.content), "debug")
|
||||
signals.add_log(strutils.bytes_to_escaped_str(message.content), "debug")
|
||||
|
||||
@controller.handler
|
||||
def log(self, evt):
|
||||
signals.add_log(evt.msg, evt.level)
|
||||
|
||||
@@ -12,6 +12,7 @@ from mitmproxy import builtins
|
||||
from mitmproxy import controller
|
||||
from mitmproxy import exceptions
|
||||
from mitmproxy import flow
|
||||
from mitmproxy import flowfilter
|
||||
from mitmproxy import options
|
||||
from mitmproxy.web import app
|
||||
from netlib.http import authentication
|
||||
@@ -180,8 +181,12 @@ class WebMaster(flow.FlowMaster):
|
||||
self.shutdown()
|
||||
|
||||
def _process_flow(self, f):
|
||||
if self.state.intercept and self.state.intercept(
|
||||
f) and not f.request.is_replay:
|
||||
should_intercept = (
|
||||
self.state.intercept and flowfilter.match(self.state.intercept, f)
|
||||
and not f.request.is_replay
|
||||
and f.reply.state == "handled"
|
||||
)
|
||||
if should_intercept:
|
||||
f.intercept(self)
|
||||
return f
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import (absolute_import, print_function, division)
|
||||
|
||||
IVERSION = (0, 18, 1)
|
||||
IVERSION = (0, 18, 2)
|
||||
VERSION = ".".join(str(i) for i in IVERSION)
|
||||
PATHOD = "pathod " + VERSION
|
||||
MITMPROXY = "mitmproxy " + VERSION
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[flake8]
|
||||
max-line-length = 140
|
||||
max-complexity = 25
|
||||
ignore = E251,C901
|
||||
ignore = E251,C901,W503
|
||||
exclude = mitmproxy/contrib/*,test/mitmproxy/data/*
|
||||
builtins = file,open,basestring,xrange,unicode,long,cmp
|
||||
|
||||
|
||||
Reference in New Issue
Block a user