Skip to content

Instantly share code, notes, and snippets.

@maxp
Created January 11, 2012 06:17
Show Gist options
  • Save maxp/1593333 to your computer and use it in GitHub Desktop.
Save maxp/1593333 to your computer and use it in GitHub Desktop.
ddos filter
tcpdump -v -n -w attack.log dst port 80 -c 250
tcpdump -nr attack.log |awk '{print $3}' \
|grep -oE '[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}' |sort |uniq -c |sort -rn |head -20
#!/bin/bash
BLOCKDB="ips.txt"
IPS=$(grep -Ev "^#" $BLOCKDB)
for i in $IPS
do
iptables -A INPUT -s $i -j DROP
#.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment