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 hidden or 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 |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Interesting approach. Although, what if they are just on a dsl connection like me? You block that IP permanently? Tomorrow when my router locks up and I get a new IP, someone gets assigned my old one and is blocked automatically, for doing nothing.