[Netfilter] do not ignore RETRY_WINDOW

This commit is contained in:
FreddleSpl0it 2023-12-11 11:38:48 +01:00
parent 340980bdd0
commit 86fa8634ee
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -167,8 +167,12 @@ def ban(address):
if not net in bans: if not net in bans:
bans[net] = {'attempts': 0, 'last_attempt': 0, 'ban_counter': 0} bans[net] = {'attempts': 0, 'last_attempt': 0, 'ban_counter': 0}
current_attempt = time.time()
if current_attempt - bans[net]['last_attempt'] > RETRY_WINDOW:
bans[net]['attempts'] = 0
bans[net]['attempts'] += 1 bans[net]['attempts'] += 1
bans[net]['last_attempt'] = time.time() bans[net]['last_attempt'] = current_attempt
if bans[net]['attempts'] >= MAX_ATTEMPTS: if bans[net]['attempts'] >= MAX_ATTEMPTS:
cur_time = int(round(time.time())) cur_time = int(round(time.time()))