Skip to content
Browse files

fixed country geoloc display

  • Loading branch information...
1 parent e59bfaf commit a89972f723bb3fabf175dd1494f2018acd231a99 @jvehent committed Nov 7, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 postscreen_stats.py
View
8 postscreen_stats.py
@@ -337,6 +337,7 @@ def action_filter(self,filter):
or ip_list[client].actions["BARE NEWLINE"] > 0
or ip_list[client].actions["NON-SMTP COMMAND"] > 0)):
blocked_countries[ip_list[client].geoloc["country_name"]] += 1
+ clients["blocked clients"] += 1
# calculate the average reconnection delay
if clients["reconnections"] > 0:
@@ -398,10 +399,11 @@ def action_filter(self,filter):
print str(Decimal(comeback['>24h'])/dec_cameback * 100).ljust(8) + "|"
if GEOLOC > 0:
- print "\n=== Top 20 Blocked Countries ==="
+ print "\n=== Top 20 Countries of Blocked Clients ==="
from operator import itemgetter
sorted_countries = blocked_countries.items()
sorted_countries.sort(key = itemgetter(1), reverse=True)
for i in range(20):
- print sorted_countries[i]
-
+ if i < len(sorted_countries):
+ country,clients = sorted_countries[i]
+ print clients, country

0 comments on commit a89972f

Please sign in to comment.
Something went wrong with that request. Please try again.