From ba99137d81edb5bae0b4dea6503731d2b44f56b8 Mon Sep 17 00:00:00 2001 From: petroskaridis Date: Fri, 5 Feb 2021 13:23:28 +0000 Subject: [PATCH] Add 'DDOS Attack/worker_ddos_firewall.sh' --- DDOS Attack/worker_ddos_firewall.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 DDOS Attack/worker_ddos_firewall.sh diff --git a/DDOS Attack/worker_ddos_firewall.sh b/DDOS Attack/worker_ddos_firewall.sh new file mode 100644 index 0000000..dcb76c6 --- /dev/null +++ b/DDOS Attack/worker_ddos_firewall.sh @@ -0,0 +1,22 @@ +sudo apt update +sudo apt upgrade -y +#Find worker1 IP +worker1=$(ifconfig|grep inet|sed -n lp|awk "{print \$2}") +clear +sudo iptables -F +echo "2 sec ICMP packet sniffing" +sleep 2s +sudo timeout 2s tcpdump -i eth0 icmp $worker1 +sleep 2s +echo "New iptables rules" +#clean iptables rules from previous script runs +sudo iptables -X +sudo iptables -N icmp_flood +sudo iptables -A INPUT -p icmp -j icmp_flood +#limit icmp_flood to 1 packets per second +sudo iptables -A icmp_flood -m limit --limit 1/s --limit-burst 3 -j RETURN +sudo iptables -A icmp_flood -j DROP +sleep 2s +echo "2 sec ICMP packet sniffing after iptables config" +sleep 2s +sudo timeout 2s tcpdump -i eth0 icmp $worker1 \ No newline at end of file