diff options
-rw-r--r-- | mitmproxy/addons/command_history.py | 10 | ||||
-rw-r--r-- | mitmproxy/command.py | 2 | ||||
-rw-r--r-- | mitmproxy/tools/_main.py | 3 | ||||
-rw-r--r-- | mitmproxy/tools/console/commander/commander.py | 4 | ||||
-rw-r--r-- | mitmproxy/utils/debug.py | 1 |
5 files changed, 5 insertions, 15 deletions
diff --git a/mitmproxy/addons/command_history.py b/mitmproxy/addons/command_history.py index 113af213..9b1fd7f1 100644 --- a/mitmproxy/addons/command_history.py +++ b/mitmproxy/addons/command_history.py @@ -1,14 +1,9 @@ import collections -import copy import os import typing -import mitmproxy.options -import mitmproxy.types - from mitmproxy import command from mitmproxy import ctx -from mitmproxy.tools.console.commander.commander import CommandBuffer class CommandHistory: @@ -66,13 +61,12 @@ class CommandHistory: if self.index == -1: ret = '' elif self.index < self.last_index: - self.index = self.index + 1 + self.index = self.index + 1 ret = self.saved_commands[self.index] else: self.index = -1 ret = '' - return ret @command.command("command_history.prev") @@ -112,7 +106,7 @@ class CommandHistory: self.filtered_index = 0 else: self.filter = command - _filtered_commands = [c for c in self.saved_commands if c.startswith(command)] + _filtered_commands = [c for c in self.saved_commands if c.startswith(command)] self.filtered_commands = collections.deque(_filtered_commands) if command not in self.filtered_commands: diff --git a/mitmproxy/command.py b/mitmproxy/command.py index 23c39594..48f9051e 100644 --- a/mitmproxy/command.py +++ b/mitmproxy/command.py @@ -100,7 +100,7 @@ class Command: def prepare_args(self, args: typing.Sequence[str]) -> inspect.BoundArguments: try: bound_arguments = self.signature.bind(*args) - except TypeError as v: + except TypeError: expected = f'Expected: {str(self.signature.parameters)}' received = f'Received: {str(args)}' raise exceptions.CommandError(f"Command argument mismatch: \n\t{expected}\n\t{received}") diff --git a/mitmproxy/tools/_main.py b/mitmproxy/tools/_main.py index 581498ff..3e6933b9 100644 --- a/mitmproxy/tools/_main.py +++ b/mitmproxy/tools/_main.py @@ -77,7 +77,6 @@ def run( arg_check.check() sys.exit(1) - try: opts.set(*args.setoptions, defer=True) opts.confdir = os.path.expanduser(opts.confdir) @@ -95,9 +94,7 @@ def run( print("-R is used for specifying replacements.\n" "To use mitmproxy in reverse mode please use --mode reverse:SPEC instead") - try: - optmanager.load_paths( opts, os.path.join(opts.confdir, "config.yaml"), diff --git a/mitmproxy/tools/console/commander/commander.py b/mitmproxy/tools/console/commander/commander.py index c59c7f83..99533cfa 100644 --- a/mitmproxy/tools/console/commander/commander.py +++ b/mitmproxy/tools/console/commander/commander.py @@ -1,8 +1,5 @@ import abc -import collections -import copy import typing -import os import urwid from urwid.text_layout import calc_coords @@ -14,6 +11,7 @@ import mitmproxy.types from mitmproxy import command_lexer + class Completer: @abc.abstractmethod def cycle(self, forward: bool = True) -> str: diff --git a/mitmproxy/utils/debug.py b/mitmproxy/utils/debug.py index e36a50a4..282db927 100644 --- a/mitmproxy/utils/debug.py +++ b/mitmproxy/utils/debug.py @@ -10,6 +10,7 @@ from OpenSSL import SSL from mitmproxy import version + def remote_debug(host='localhost', port=4444): import remote_pdb remote_pdb.RemotePdb(host, port).set_trace() |