iwla

iwla Commit Details

Date:2014-11-24 21:42:57 (6 years 7 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:d5db763b48b02f0f24e760e83368738c73b2475a
Parents: 549c0e5d973d1cd1ed2eab70ade49fe59feb742d
Message:Rework conf in plugins

Changes:
Miplugin.py (3 diffs)
Miwla.py (1 diff)
Mplugins/display/top_visitors.py (1 diff)
Mplugins/post_analysis/reverse_dns.py (1 diff)
Mplugins/post_analysis/top_visitors.py (1 diff)
Mplugins/pre_analysis/robots.py (1 diff)
Mplugins/pre_analysis/soutade.py (1 diff)

File differences

iplugin.py
22
33
44
5
6
7
8
9
105
116
12
7
138
14
159
1610
1711
......
2418
2519
2620
27
28
29
30
31
32
3321
3422
3523
......
5846
5947
6048
61
49
6250
6351
6452
import inspect
import traceback
import default_conf as conf
import conf as _
conf.__dict__.update(_.__dict__)
del _
class IPlugin(object):
def __init__(self, iwla, conf):
def __init__(self, iwla):
self.iwla = iwla
self.conf = conf
self.requires = []
self.API_VERSION = 1
self.ANALYSIS_CLASS = 'HTTP'
return False
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
print 'No plugin defined in %s' % (plugin_path)
continue
plugin = classes[0](iwla, conf)
plugin = classes[0](iwla)
plugin_name = plugin.__class__.__name__
if not plugin.isValid(iwla.ANALYSIS_CLASS, iwla.API_VERSION):
iwla.py
4242
4343
4444
45
46
47
48
49
50
4551
4652
4753
conf.POST_HOOK_DIRECTORY : conf.post_analysis_hooks,
conf.DISPLAY_HOOK_DIRECTORY : conf.display_hooks}
def getConfValue(self, key, default):
if not key in dir(conf):
return default
else:
return conf.__dict__[key]
def _clearVisits(self):
self.current_analysis = {
'days_stats' : {},
plugins/display/top_visitors.py
55
66
77
8
9
8
9
1010
1111
1212
from display import *
class IWLADisplayTopVisitors(IPlugin):
def __init__(self, iwla, conf):
super(IWLADisplayTopVisitors, self).__init__(iwla, conf)
def __init__(self, iwla):
super(IWLADisplayTopVisitors, self).__init__(iwla)
self.API_VERSION = 1
self.requires = ['IWLAPostAnalysisTopVisitors']
plugins/post_analysis/reverse_dns.py
44
55
66
7
8
7
8
99
1010
1111
12
12
1313
1414
1515
from iplugin import IPlugin
class IWLAPostAnalysisReverseDNS(IPlugin):
def __init__(self, iwla, conf):
super(IWLAPostAnalysisReverseDNS, self).__init__(iwla, conf)
def __init__(self, iwla):
super(IWLAPostAnalysisReverseDNS, self).__init__(iwla)
self.API_VERSION = 1
def load(self):
timeout = self.getConfValue('reverse_dns_timeout', 0.5)
timeout = self.iwla.getConfValue('reverse_dns_timeout', 0.5)
socket.setdefaulttimeout(timeout)
return True
plugins/post_analysis/top_visitors.py
22
33
44
5
6
5
6
77
88
99
from iplugin import IPlugin
class IWLAPostAnalysisTopVisitors(IPlugin):
def __init__(self, iwla, conf):
super(IWLAPostAnalysisTopVisitors, self).__init__(iwla, conf)
def __init__(self, iwla):
super(IWLAPostAnalysisTopVisitors, self).__init__(iwla)
self.API_VERSION = 1
def hook(self, iwla):
plugins/pre_analysis/robots.py
66
77
88
9
10
9
10
1111
1212
1313
from awstats_robots_data import awstats_robots
class IWLAPreAnalysisRobots(IPlugin):
def __init__(self, iwla, conf):
super(IWLAPreAnalysisRobots, self).__init__(iwla, conf)
def __init__(self, iwla):
super(IWLAPreAnalysisRobots, self).__init__(iwla)
self.API_VERSION = 1
def load(self):
plugins/pre_analysis/soutade.py
77
88
99
10
11
10
11
1212
1313
1414
class IWLAPreAnalysisSoutade(IPlugin):
def __init__(self, iwla, conf):
super(IWLAPreAnalysisSoutade, self).__init__(iwla, conf)
def __init__(self, iwla):
super(IWLAPreAnalysisSoutade, self).__init__(iwla)
self.API_VERSION = 1
def load(self):

Archive Download the corresponding diff file

Branches

Tags