diff options
author | Maximilian Hils <git@maximilianhils.com> | 2020-02-02 18:34:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-02 18:34:43 +0100 |
commit | fdc0864b2df5db9c1afdb425e98aec066996c194 (patch) | |
tree | 5f38e1dbaccf4a99928a1f84f8686ded0e753077 | |
parent | 7f7838eba9bd4f7ceeb97744c544b68a42d7b5ea (diff) | |
parent | bfcd3ff6ea90285b9a4c8fbcac7a08c281a5387e (diff) | |
download | mitmproxy-fdc0864b2df5db9c1afdb425e98aec066996c194.tar.gz mitmproxy-fdc0864b2df5db9c1afdb425e98aec066996c194.tar.bz2 mitmproxy-fdc0864b2df5db9c1afdb425e98aec066996c194.zip |
Merge pull request #3801 from mitmproxy/issue-3794
Improve command detection heuristics
-rw-r--r-- | mitmproxy/command.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py index bfec47e1..49cb959e 100644 --- a/mitmproxy/command.py +++ b/mitmproxy/command.py @@ -149,9 +149,10 @@ class CommandManager: if not i.startswith("__"): o = getattr(addon, i) try: - is_command = hasattr(o, "command_name") + # hasattr is not enough, see https://github.com/mitmproxy/mitmproxy/issues/3794 + is_command = isinstance(getattr(o, "command_name", None), str) except Exception: - pass # hasattr may raise if o implements __getattr__. + pass # getattr may raise if o implements __getattr__. else: if is_command: try: |