Created
December 5, 2010 01:37
-
-
Save deepfryed/728676 to your computer and use it in GitHub Desktop.
block fucking script kiddies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for ip in `sudo cat /var/log/auth.log | grep "invalid user .* from" | sed 's/^.*invalid user \([0-9a-zA-Z_\-]\+\) from \([0-9.]\+\).*$/\1\t\2/' | cut -f2 | sort -u`; do echo iptables -A INPUT -s $ip/32 -p tcp -j REJECT; done | xargs sudo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
collateral damage ? :P
other alternaitve is to,
flush tables, read log, block ips, truncate log, sleep n minutes, repeat. you can make it more sophisticated by used memcached. but all that would be overkill.