Do reverse DNS on feeds parsers

This commit is contained in:
Gregory Soutade 2016-01-18 07:33:48 +01:00
parent 5c750e8b0c
commit 519033e474
4 changed files with 19 additions and 8 deletions

View File

@ -1,4 +1,4 @@
v0.3 (20/12/2015) v0.3 (17/01/2016)
** User ** ** User **
Add referers_diff display plugin Add referers_diff display plugin
Add year statistics in month details Add year statistics in month details
@ -15,13 +15,15 @@ v0.3 (20/12/2015)
Add gz files support Add gz files support
Add -z option (don't compress databases) Add -z option (don't compress databases)
Add own search enfines files Add own search enfines files
Do reverse DNS on feeds parsers
** Dev ** ** Dev **
Add istats_diff interface Add istats_diff interface
Sort documentation output Sort documentation output
Add debug traces in robots plugin Add debug traces in robots plugin
Update awstats data Update awstats data
Dont count 'uri' and 'uri/' as differents uri Remove doule // at the end of URL
Remove final slashes for referrers
** Bugs ** ** Bugs **
Forgot <body> tag Forgot <body> tag

14
iwla.py
View File

@ -289,6 +289,13 @@ class IWLA(object):
self.logger.debug("False") self.logger.debug("False")
return False return False
def isValidVisitor(self, hit):
if hit['robot']: return False
if not (conf.count_hit_only_visitors or\
hit['viewed_pages']):
return False
return True
def _appendHit(self, hit): def _appendHit(self, hit):
remote_addr = hit['remote_addr'] remote_addr = hit['remote_addr']
@ -596,11 +603,8 @@ class IWLA(object):
self.valid_visitors = {} self.valid_visitors = {}
for (k,v) in visits.items(): for (k,v) in visits.items():
if v['robot']: continue if self.isValidVisitor(v):
if not (conf.count_hit_only_visitors or\ self.valid_visitors[k] = v
v['viewed_pages']):
continue
self.valid_visitors[k] = v
duplicated_stats['nb_visitors'] = stats['nb_visitors'] = len(self.valid_visitors.keys()) duplicated_stats['nb_visitors'] = stats['nb_visitors'] = len(self.valid_visitors.keys())

View File

@ -64,9 +64,12 @@ class IWLAPostAnalysisReverseDNS(IPlugin):
return True return True
def hook(self): def hook(self):
hits = self.iwla.getValidVisitors() hits = self.iwla.getCurrentVisists()
for (k, hit) in hits.items(): for (k, hit) in hits.items():
if hit.get('dns_analysed', False): continue if hit.get('dns_analysed', False): continue
if not hit['feed_parser'] and\
not self.iwla.isValidVisitor(hit):
continue
try: try:
name, _, _ = socket.gethostbyaddr(k) name, _, _ = socket.gethostbyaddr(k)
hit['remote_addr'] = name.lower() hit['remote_addr'] = name.lower()

View File

@ -107,3 +107,5 @@ dumpHash(\%BrowsersHashIcon, $FIC, 1);
print $FIC "}\n\n"; print $FIC "}\n\n";
close($FIC); close($FIC);
print "Done !\n";