mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
restrict -e to mitmproxy only (not mitmdump)
This commit is contained in:
parent
14db30080f
commit
aefb30ea60
@ -161,7 +161,6 @@ def get_common_options(options):
|
|||||||
anticache = options.anticache,
|
anticache = options.anticache,
|
||||||
anticomp = options.anticomp,
|
anticomp = options.anticomp,
|
||||||
client_replay = options.client_replay,
|
client_replay = options.client_replay,
|
||||||
eventlog = options.eventlog,
|
|
||||||
kill = options.kill,
|
kill = options.kill,
|
||||||
no_server = options.no_server,
|
no_server = options.no_server,
|
||||||
refresh_server_playback = not options.norefresh,
|
refresh_server_playback = not options.norefresh,
|
||||||
@ -196,11 +195,6 @@ def common_options(parser):
|
|||||||
action="store", type = str, dest="confdir", default='~/.mitmproxy',
|
action="store", type = str, dest="confdir", default='~/.mitmproxy',
|
||||||
help = "Configuration directory. (~/.mitmproxy)"
|
help = "Configuration directory. (~/.mitmproxy)"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
"-e",
|
|
||||||
action="store_true", dest="eventlog",
|
|
||||||
help="Show event log."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-n",
|
"-n",
|
||||||
action="store_true", dest="no_server",
|
action="store_true", dest="no_server",
|
||||||
|
@ -69,7 +69,7 @@ class BodyPile(urwid.Pile):
|
|||||||
else:
|
else:
|
||||||
self.widget_list[1].header = self.inactive_header
|
self.widget_list[1].header = self.inactive_header
|
||||||
key = None
|
key = None
|
||||||
elif key == "v":
|
elif key == "e":
|
||||||
self.master.toggle_eventlog()
|
self.master.toggle_eventlog()
|
||||||
key = None
|
key = None
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ class Options(object):
|
|||||||
"anticache",
|
"anticache",
|
||||||
"anticomp",
|
"anticomp",
|
||||||
"client_replay",
|
"client_replay",
|
||||||
"eventlog",
|
|
||||||
"keepserving",
|
"keepserving",
|
||||||
"kill",
|
"kill",
|
||||||
"no_server",
|
"no_server",
|
||||||
@ -66,7 +65,6 @@ class DumpMaster(flow.FlowMaster):
|
|||||||
self.o = options
|
self.o = options
|
||||||
self.anticache = options.anticache
|
self.anticache = options.anticache
|
||||||
self.anticomp = options.anticomp
|
self.anticomp = options.anticomp
|
||||||
self.eventlog = options.eventlog
|
|
||||||
self.showhost = options.showhost
|
self.showhost = options.showhost
|
||||||
self.refresh_server_playback = options.refresh_server_playback
|
self.refresh_server_playback = options.refresh_server_playback
|
||||||
|
|
||||||
@ -142,9 +140,9 @@ class DumpMaster(flow.FlowMaster):
|
|||||||
return flows
|
return flows
|
||||||
|
|
||||||
def add_event(self, e, level="info"):
|
def add_event(self, e, level="info"):
|
||||||
if self.eventlog:
|
#FIXME refactor_loglevel
|
||||||
print >> self.outfile, e
|
print >> self.outfile, e
|
||||||
self.outfile.flush()
|
self.outfile.flush()
|
||||||
|
|
||||||
def indent(self, n, t):
|
def indent(self, n, t):
|
||||||
l = str(t).strip().split("\n")
|
l = str(t).strip().split("\n")
|
||||||
|
@ -15,9 +15,10 @@ class ScriptContext:
|
|||||||
Logs an event.
|
Logs an event.
|
||||||
|
|
||||||
How this is handled depends on the front-end. mitmdump will display
|
How this is handled depends on the front-end. mitmdump will display
|
||||||
events if the eventlog flag ("-e") was passed. mitmproxy sends
|
events if the v flag ("-e") was passed. mitmproxy sends
|
||||||
output to the eventlog for display ("v" keyboard shortcut).
|
output to the eventlog for display ("e" keyboard shortcut).
|
||||||
"""
|
"""
|
||||||
|
#FIXME refactor_loglevel
|
||||||
self._master.add_event(*args, **kwargs)
|
self._master.add_event(*args, **kwargs)
|
||||||
|
|
||||||
def duplicate_flow(self, f):
|
def duplicate_flow(self, f):
|
||||||
|
@ -23,6 +23,11 @@ if __name__ == '__main__':
|
|||||||
action="store", dest="palette",
|
action="store", dest="palette",
|
||||||
help="Select color palette: " + ", ".join(palettes.palettes.keys())
|
help="Select color palette: " + ", ".join(palettes.palettes.keys())
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-e",
|
||||||
|
action="store_true", dest="eventlog",
|
||||||
|
help="Show event log."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
group = parser.add_argument_group(
|
group = parser.add_argument_group(
|
||||||
|
@ -127,7 +127,7 @@ class TestDumpMaster:
|
|||||||
|
|
||||||
def test_basic(self):
|
def test_basic(self):
|
||||||
for i in (1, 2, 3):
|
for i in (1, 2, 3):
|
||||||
assert "GET" in self._dummy_cycle(1, "~s", "", verbosity=i, eventlog=True)
|
assert "GET" in self._dummy_cycle(1, "~s", "", verbosity=i)
|
||||||
assert "GET" in self._dummy_cycle(1, "~s", "\x00\x00\x00", verbosity=i)
|
assert "GET" in self._dummy_cycle(1, "~s", "\x00\x00\x00", verbosity=i)
|
||||||
assert "GET" in self._dummy_cycle(1, "~s", "ascii", verbosity=i)
|
assert "GET" in self._dummy_cycle(1, "~s", "ascii", verbosity=i)
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ class TestDumpMaster:
|
|||||||
def test_script(self):
|
def test_script(self):
|
||||||
ret = self._dummy_cycle(
|
ret = self._dummy_cycle(
|
||||||
1, None, "",
|
1, None, "",
|
||||||
scripts=[tutils.test_data.path("scripts/all.py")], verbosity=0, eventlog=True
|
scripts=[tutils.test_data.path("scripts/all.py")], verbosity=0
|
||||||
)
|
)
|
||||||
assert "XCLIENTCONNECT" in ret
|
assert "XCLIENTCONNECT" in ret
|
||||||
assert "XSERVERCONNECT" in ret
|
assert "XSERVERCONNECT" in ret
|
||||||
|
Loading…
Reference in New Issue
Block a user