X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/624df40f43cc4131b823fbef218fd0c08d6400b2..1d8e2961f0527a548989c1e38bb062f2f9e5877e:/utils/cron_ipanalyse.py diff --git a/utils/cron_ipanalyse.py b/utils/cron_ipanalyse.py index 40afa2b8..66d122cd 100755 --- a/utils/cron_ipanalyse.py +++ b/utils/cron_ipanalyse.py @@ -9,6 +9,7 @@ import re import os import sys +import subprocess from datetime import datetime, timedelta from collections import defaultdict @@ -30,9 +31,11 @@ BLACKLIST = '' UA_BLOCKLIST = () # time before a automatically blocked IP is allowed back -BLOCKCOOLOFF_PERIOD=timedelta(hours=1) +BLOCKCOOLOFF_DELTA=timedelta(hours=1) # quiet time before an IP is released from the bulk pool -BULKCOOLOFF_PERIOD=timedelta(minutes=15) +BULKCOOLOFF_DELTA=timedelta(minutes=15) +# time to check if new accesses appear despite being blocked +BLOCKCHECK_DELTA=timedelta(minutes=1) BULKLONG_LIMIT=8000 BULKSHORT_LIMIT=2000 @@ -50,18 +53,22 @@ MAX_BULK_IPS=85 try: with open(BASEDIR + "/settings/ip_blocks.conf") as f: code = compile(f.read(), BASEDIR + "/settings/ip_blocks.conf", 'exec') - exec(code, global_vars, local_vars) + exec(code) except IOError: pass BLOCK_LIMIT = BLOCK_LOWER +time_regex = r'(?P\d\d)/(?P[A-Za-z]+)/(?P\d\d\d\d):(?P\d\d):(?P\d\d):(?P\d\d) [+-]\d\d\d\d' -format_pat= re.compile('(?P[(\d\.)]+) - - \[(?P