From e018797ede7d4645630987da4f0c084b964d35c5 Mon Sep 17 00:00:00 2001 From: Alban Diquet Date: Sun, 21 Sep 2014 15:04:36 -0700 Subject: [PATCH] Fix plugin imports on Linux pt4 --- plugins/PluginChromeSha1Deprecation.py | 5 ++--- plugins/__init__.py | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/PluginChromeSha1Deprecation.py b/plugins/PluginChromeSha1Deprecation.py index ce98b32a..b9f4ed26 100644 --- a/plugins/PluginChromeSha1Deprecation.py +++ b/plugins/PluginChromeSha1Deprecation.py @@ -32,9 +32,8 @@ from utils.SSLyzeSSLConnection import create_sslyze_connection from nassl.SslClient import ClientCertificateRequested -# We have to import it this way or PluginCertInfo gets detected twice by SSLyze on Linux -import plugins.PluginCertInfo -from plugins.PluginCertInfo import MOZILLA_STORE_PATH + +from plugins.PluginCertInfo import MOZILLA_STORE_PATH, PluginCertInfo ROOT_CERTS = [] diff --git a/plugins/__init__.py b/plugins/__init__.py index 56b85879..086f8f06 100644 --- a/plugins/__init__.py +++ b/plugins/__init__.py @@ -57,6 +57,10 @@ def __init__(self): # Check every declaration in that module for name in dir(module): obj = getattr(module, name) + if name not in module.__name__: + # Plugins have to have the same class name as their module name + # This prevents Plugin B from being detected twice when there is a Plugin A that imports Plugin B + continue if inspect.isclass(obj): # A class declaration was found in that module