aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/command.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2020-01-27 22:44:36 +0100
committerGitHub <noreply@github.com>2020-01-27 22:44:36 +0100
commitbfcd3ff6ea90285b9a4c8fbcac7a08c281a5387e (patch)
treee2d4e8fc1dedec9ecf05b06c2eaa9219df0187de /mitmproxy/command.py
parent66fe6530631bae9371401f5a86cf4be797107e5c (diff)
downloadmitmproxy-bfcd3ff6ea90285b9a4c8fbcac7a08c281a5387e.tar.gz
mitmproxy-bfcd3ff6ea90285b9a4c8fbcac7a08c281a5387e.tar.bz2
mitmproxy-bfcd3ff6ea90285b9a4c8fbcac7a08c281a5387e.zip
improve command detection heuristics
this fixes #3794
Diffstat (limited to 'mitmproxy/command.py')
-rw-r--r--mitmproxy/command.py5
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: