Compare commits

...

5 Commits

Author SHA1 Message Date
Gregory Soutade
db9009bb28 Update AWStats data (v7.9) 2024-03-05 16:41:31 +01:00
Gregory Soutade
e2210f3eab Update geo ip misc plugin 2024-02-15 10:55:59 +01:00
Gregory Soutade
9db72f41fd Don't analyze referer for non viewed hits/pages 2024-02-15 10:55:38 +01:00
Gregory Soutade
0464a3d8e7 Generate HTML part in dry run mode (but don't write it to disk) 2024-02-15 10:55:04 +01:00
Gregory Soutade
b9566beb80 Set lang value in generated HTML page 2024-02-15 10:54:52 +01:00
8 changed files with 25 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -59,7 +59,7 @@ compress_output_files = ['html', 'css', 'js']
locales_path = './locales'
# Default locale (english)
locale = 'en_EN'
locale = 'en'
# Don't keep requests of all visitors into database
keep_requests = False

View File

@ -365,20 +365,20 @@ class DisplayHTMLPage(object):
self.logger.debug('Write %s' % (filename))
f = codecs.open(filename, 'w', 'utf-8')
f.write(u'<!DOCTYPE html>')
f.write(u'<html>')
f.write(u'<head>')
f.write(u'<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />')
f.write(u'<link rel="icon" type="image/png" href="/resources/icon/favicon.png"/>')
f.write(u'<!DOCTYPE html>\n')
f.write(u'<html lang="{}">\n'.format(self.iwla.getConfValue('locale', 'en')))
f.write(u'<head>\n')
f.write(u'<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>\n')
f.write(u'<link rel="icon" type="image/png" href="/resources/icon/favicon.png"/>\n')
for css in self.css_path:
f.write(u'<link rel="stylesheet" href="/%s"/>' % (css))
f.write(u'<link rel="stylesheet" href="/%s"/>\n' % (css))
if self.title:
f.write(u'<title>%s</title>' % (self.title))
f.write(u'</head><body>')
f.write(u'<title>%s</title>\n' % (self.title))
f.write(u'</head><body>\n')
for block in self.blocks:
block.build(f, filters=filters)
if displayVersion:
f.write(u'<div style="text-align:center;width:100%%">Generated by <a href="%s">IWLA %s</a></div>' %
f.write(u'<div style="text-align:center;width:100%%">Generated by <a href="%s">IWLA %s</a></div>\n' %
("http://indefero.soutade.fr/p/iwla", self.iwla.getVersion()))
f.write(u'</body></html>')
f.close()

View File

@ -605,11 +605,11 @@ class IWLA(object):
break
def _generateDisplay(self):
if self.args.dry_run or\
self.args.disable_display: return
if self.args.disable_display: return
self._generateDisplayDaysStats()
self._callPlugins(conf.DISPLAY_HOOK_DIRECTORY)
self._generateDisplayWholeMonthStats()
if self.args.dry_run: return
self.display.build(conf.DISPLAY_ROOT)
self._compressFiles(conf.DISPLAY_ROOT)

View File

@ -24,7 +24,7 @@ import json
def geoiplookup(ip):
http = urllib3.PoolManager()
r = http.request('GET', f'https://api.geoiplookup.net/?query={ip}&json=true')
r = http.request('GET', f'http://ip-api.com/json/{ip}')
if r.status != 200:
raise Exception(r)

View File

@ -85,8 +85,8 @@ class IWLADisplayFilterUsers(IPlugin):
isp = location.get('isp', '')
str_location = ''
city = location.get('city', unknown)
country = location.get('countryname', unknown)
if location.get('city', '') or location.get('countryname'):
country = location.get('country', unknown)
if location.get('city', '') or location.get('country', ''):
str_location = f'{city}/{country}'
if isp:
if str_location: str_location += '<br/>'

View File

@ -59,7 +59,9 @@ class IWLADisplayVisitorIP(IPlugin):
def processIP(self, host_name, ip):
host_name = host_name.replace(ip, 'IP')
# IPv4
ip = ip.replace('.', '-')
# IPv6
ip = ip.replace(':', '-')
host_name = host_name.replace(ip, 'IP')
ip = ip.replace('-', '')

View File

@ -136,6 +136,7 @@ class IWLAPostAnalysisReferers(IPlugin):
for r in super_hit['requests'][::-1]:
if not self.iwla.isValidForCurrentAnalysis(r): break
if not r['http_referer']: continue
if not self.iwla.hasBeenViewed(r): continue
uri = r['extract_referer']['extract_uri']
if self.own_domain_re.match(uri): continue