Skip to content

Instantly share code, notes, and snippets.

@twinge
Created July 22, 2011 17:32
Show Gist options
  • Save twinge/1099922 to your computer and use it in GitHub Desktop.
Save twinge/1099922 to your computer and use it in GitHub Desktop.
#!/bin/sh
netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq > /tmp/ips.txt;for IP in `cat /tmp/ips.txt`; do iptables -A INPUT -s $IP -j DROP;done;service iptables save;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment