Update conf management
This commit is contained in:
16
iplugin.py
16
iplugin.py
@@ -2,10 +2,16 @@ import importlib
|
||||
import inspect
|
||||
import traceback
|
||||
|
||||
import default_conf as conf
|
||||
import conf as _
|
||||
conf.__dict__.update(_.__dict__)
|
||||
del _
|
||||
|
||||
class IPlugin(object):
|
||||
|
||||
def __init__(self, iwla):
|
||||
def __init__(self, iwla, conf):
|
||||
self.iwla = iwla
|
||||
self.conf = conf
|
||||
self.requires = []
|
||||
self.API_VERSION = 1
|
||||
self.ANALYSIS_CLASS = 'HTTP'
|
||||
@@ -19,6 +25,12 @@ class IPlugin(object):
|
||||
|
||||
return True
|
||||
|
||||
def getConfValue(self, key, default):
|
||||
if not key in dir(self.conf):
|
||||
return default
|
||||
else:
|
||||
return self.conf.__dict__[key]
|
||||
|
||||
def getRequirements(self):
|
||||
return self.requires
|
||||
|
||||
@@ -46,7 +58,7 @@ def preloadPlugins(plugins, iwla):
|
||||
print 'No plugin defined in %s' % (plugin_path)
|
||||
continue
|
||||
|
||||
plugin = classes[0](iwla)
|
||||
plugin = classes[0](iwla, conf)
|
||||
plugin_name = plugin.__class__.__name__
|
||||
|
||||
if not plugin.isValid(iwla.ANALYSIS_CLASS, iwla.API_VERSION):
|
||||
|
Reference in New Issue
Block a user