Hack_explo/bootstrap.sh

77 lines
2.0 KiB
Bash

#!/usr/bin/bash
USER1="3M"
PASS1="donttouchthesky"
USER2="Franklin"
PASS2="j<3chocol4tl3sb0nb0ns"
ROOTPASS="Iam4h4k3r"
if id vagrant &>/dev/null; then
VAGRANTPASS="zekzek"
echo "vagrant:$VAGRANTPASS" | chpasswd
echo "Change vagrant password"
websiteloc=/vagrant/site
else
websiteloc=./site
fi
# Ce qu'il ne faut surtout pas faire normalement
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
sed -i 's/#PubkeyAuthentication/PubkeyAuthentication/g' /etc/ssh/sshd_config
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
systemctl restart sshd.service
echo "authorised PasswordAuthentication"
# Web site
apt-get update
apt-get install -y apache2 tree pwgen
echo "Install appache"
rm -rf /var/www/html/*
mkdir -p /var/www/html/
cp $websiteloc/index.html /var/www/html/
cp $websiteloc/hacker.css /var/www/html/
# Users
echo "root:$ROOTPASS" | chpasswd
echo "Change root password"
rm -r /home/$USER1
rm -r /home/$USER2
userdel $USER1
userdel $USER2
useradd -m -s /usr/bin/bash -p $(openssl passwd -crypt $PASS1) $USER1
useradd -m -s /usr/bin/bash -p $(openssl passwd -crypt $PASS2) $USER2
# Construction des dossiers perso
mkdir /home/3M/.secrets
echo $PASS2 > /home/3M/.secrets/mdp_autre_utilisateur.txt
echo $ROOTPASS > /home/3M/mdp_root.txt
mkdir /home/3M/{butins,en_cours,autres}
mkdir -p /home/3M/en_cours/cible_{1..100}
touch /home/3M/en_cours/cible_{1..100}/rapport.txt
pwgen 20 1 > /home/3M/butins/mpd_chef_etablissement.txt
pwgen 20 1 > /home/3M/butins/backdoor_M_Bertrand.txt
pwgen 20 1 > /home/3M/butins/mpd_du_pere_noel
pwgen 20 1 >> /home/3M/butins/mpd_du_pere_noel
pwgen 20 1 >> /home/3M/butins/mpd_du_pere_noel
touch /home/3M/autres/{liste_pere_noel,comptabilite_petite_souris,peluches_preferees}.txt
chown $USER1 /home/3M/ -R
chmod 744 /home/3M/ -R
chown $USER2 /home/3M/mdp_root.txt
chmod 700 /home/3M/mdp_root.txt
# Point final
echo "Félicitation! Vous êtes de véritables hackers" > /root/bravo.txt
# Point final
ip addr