Skip to content

Instantly share code, notes, and snippets.

@mpenick
Created October 2, 2014 16:24
Show Gist options
  • Save mpenick/12f074bf3ec990976ca2 to your computer and use it in GitHub Desktop.
Save mpenick/12f074bf3ec990976ca2 to your computer and use it in GitHub Desktop.
#!/bin/bash
while true
do
r=$(( ( RANDOM % 100 ) + 1 ))
if [[ "$r" -gt "0" && "$r" -lt "11" ]]; then
echo "dropping 192.168.1.112"
iptables -A INPUT -d 192.168.1.112 -p tcp --destination-port 9042 -j DROP
elif [[ "$r" -gt "10" && "$r" -lt "21" ]]; then
echo "dropping 192.168.1.113"
iptables -A INPUT -d 192.168.1.113 -p tcp --destination-port 9042 -j DROP
else
echo "flushing"
iptables -F
fi
s=$(( ( RANDOM % 30 ) + 1 ))
echo "sleeping for $s"
sleep $s
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment