From af7d97a5aa2862515064d304bff0062241dddec9 Mon Sep 17 00:00:00 2001 From: gnaggnoyil Date: Sat, 25 Mar 2017 06:03:49 +0800 Subject: [PATCH] enable autoban.py to always ignore ips given in whilelist option --- utils/autoban.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/autoban.py b/utils/autoban.py index c7af0a5..17c158b 100755 --- a/utils/autoban.py +++ b/utils/autoban.py @@ -33,12 +33,16 @@ if __name__ == '__main__': parser.add_argument('-c', '--count', default=3, type=int, help='with how many failure times it should be ' 'considered as an attack') + parser.add_argument('-wl', '--whitelist', action='append', + help='whiltelist ip that shall not be banned.') config = parser.parse_args() ips = {} banned = set() for line in sys.stdin: if 'can not parse header when' in line: ip = line.split()[-1].split(':')[-2] + if ip in config.whitelist: + continue if ip not in ips: ips[ip] = 1 print(ip)