mirror of
https://github.com/jpec/fail2ban-report.git
synced 2024-12-21 21:12:13 +01:00
fix: unknown IP shouldn't crash
This commit is contained in:
parent
420af736c6
commit
d4d6e70cb9
1 changed files with 5 additions and 2 deletions
|
@ -40,8 +40,11 @@ def get_nb_ban_by_country(data, f_country):
|
|||
reader = geoip2.database.Reader(f_country)
|
||||
d = {}
|
||||
for ip, date in data:
|
||||
response = reader.country(ip)
|
||||
country = response.country.name
|
||||
try:
|
||||
response = reader.country(ip)
|
||||
country = response.country.name
|
||||
except:
|
||||
country = "n/c"
|
||||
if country in d.keys():
|
||||
d[country] += 1
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue