Skip to content

Commit

Permalink
flush autoban output
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-chen committed May 3, 2015
1 parent e898f92 commit ea7a3e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/autoban.py
Expand Up @@ -42,10 +42,12 @@
if ip not in ips:
ips[ip] = 1
print(ip)
sys.stdout.flush()
else:
ips[ip] += 1
if ip not in banned and ips[ip] >= config.count:
banned.add(ip)
cmd = 'iptables -A INPUT -s %s -j DROP' % ip
print(cmd, file=sys.stderr)
sys.stderr.flush()
os.system(cmd)

0 comments on commit ea7a3e1

Please sign in to comment.