diff --git a/app/funct.py b/app/funct.py index ea2edda1..4e7575dc 100644 --- a/app/funct.py +++ b/app/funct.py @@ -942,9 +942,9 @@ def show_haproxy_log(serv, rows=10, waf='0', grep=None, hour='00', minut='00', h elif service == 'apache': apache_log_path = sql.get_setting('apache_log_path') - if serv == 'haproxy-wi.access.log': + if serv == 'roxy-wi.access.log': cmd = "cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act) - elif serv == 'haproxy-wi.error.log': + elif serv == 'roxy-wi.error.log': cmd = "cat %s| awk '$4>\"%s:00\" && $4<\"%s:00\"' |tail -%s %s %s" % (apache_log_path+"/"+serv, date, date1, rows, grep_act, exgrep_act) elif serv == 'fail2ban.log': cmd = "cat %s| awk -F\"/|:\" '$3>\"%s:00\" && $3<\"%s:00\"' |tail -%s %s %s" % ("/var/log/"+serv, date, date1, rows, grep_act, exgrep_act) diff --git a/app/options.py b/app/options.py index 2fa2c152..2710cf0c 100644 --- a/app/options.py +++ b/app/options.py @@ -1394,7 +1394,12 @@ if form.getvalue('installwaf'): if form.getvalue('update_haproxy_wi'): service = form.getvalue('service') - services = ['roxy-wi-checker', 'roxy-wi', 'roxy-wi-keep_alive', 'roxy-wi-smon', 'roxy-wi-metrics'] + services = ['roxy-wi-checker', + 'roxy-wi', + 'roxy-wi-keep_alive', + 'roxy-wi-smon', + 'roxy-wi-metrics', + 'roxy-wi-portscanner'] if service not in services: print('error: ' + service + ' is not part of Roxy-WI') sys.exit() diff --git a/app/sql.py b/app/sql.py index e69bd994..1f535e97 100644 --- a/app/sql.py +++ b/app/sql.py @@ -2924,20 +2924,23 @@ def delete_alert_history(keep_interval: int, service: str): con.close() -def delete_portscanner_history(keep_interval: int, service: str): +def delete_portscanner_history(keep_interval: int): con, cur = get_cur() + if mysql_enable == '1': - sql = """ delete from port_scanner_history where date < now() - INTERVAL %s day and service = '%s'""" % (keep_interval, service) + sql = """ delete from port_scanner_history where date < now() - INTERVAL %s day""" % keep_interval else: - sql = """ delete from port_scanner_history where date < datetime('now', '-%s days') and service = '%s'""" % (keep_interval, service) + sql = """ delete from port_scanner_history where date < datetime('now', '-%s days')""" % keep_interval + try: cur.execute(sql) con.commit() except sqltool.Error as e: funct.out_error(e) con.rollback() - cur.close() - con.close() + finally: + cur.close() + con.close() def select_port_scanner_history(serv): diff --git a/app/templates/ajax/load_telegram.html b/app/templates/ajax/load_telegram.html index 53d52a3c..bb484af9 100644 --- a/app/templates/ajax/load_telegram.html +++ b/app/templates/ajax/load_telegram.html @@ -14,7 +14,7 @@ {% endif %}