Skip to content

Instantly share code, notes, and snippets.

@deepfryed
Created December 5, 2010 01:37
Show Gist options
  • Save deepfryed/728676 to your computer and use it in GitHub Desktop.
Save deepfryed/728676 to your computer and use it in GitHub Desktop.
block fucking script kiddies
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
@deepfryed
Copy link
Author

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