Feat: import de la machine à casser!

This commit is contained in:
Bertrand Benjamin 2022-12-01 06:53:22 +01:00
commit df3cf53696
4 changed files with 1272 additions and 0 deletions

70
Vagrantfile vendored Normal file
View File

@ -0,0 +1,70 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "debian/bullseye64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.network "public_network"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# SHELL
config.vm.provision :shell, path: "bootstrap.sh"
end

70
bootstrap.sh Normal file
View File

@ -0,0 +1,70 @@
#!/usr/bin/bash
USER1="3M"
PASS1="donttouchthesky"
USER2="Franklin"
PASS2="j<3chocol4tl3sb0nb0nset"
ROOTPASS="Iam4h4k3r"
VAGRANTPASS="zekzek"
# 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 /vagrant/site/index.html /var/www/html/
cp /vagrant/site/hacker.css /var/www/html/
# Users
echo "vagrant:$VAGRANTPASS" | chpasswd
echo "root:$ROOTPASS" | chpasswd
echo "Change vagrant and 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

966
site/hacker.css Normal file

File diff suppressed because one or more lines are too long

166
site/index.html Normal file
View File

@ -0,0 +1,166 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Try to hack me if you can!</title>
<link href="hacker.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Mon site pour devenir maître du monde</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">CLICK ME!!!<span class="caret"></span> </a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Ooh un lien</a></li>
<li><a href="#">Un autre</a></li>
<li><a href="#">Mais ya toujours rien derrière</a></li>
<li class="divider"></li>
<li class="dropdown-header">Quoi que...</li>
<li><a href="#">Alors?</a></li>
<li><a href="#">Hein?</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<!-- Jumbotron -->
<div class="jumbotron">
<h1>3M</h1>
<p>Je suis 3M (moi maître du monde)</p>
<p>Ceci est mon antre. Un coin secret où je cache tous mes projets démoniaques.</p>
<div class="col-sm-6">
<a href="#" class="btn btn-success">Mou</a>
<a href="#" class="btn btn-warning">Ha</a>
<a href="#" class="btn btn-primary">Ha</a>
</div>
</div>
<div class="row tall-row">
<div class="col-lg-12">
<h1>Projets en cours</h1>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Infiltrer la NASA</h3>
<div class="progress progress-striped">
<div class="progress-bar" style="width: 15%"></div>
</div>
<h3> Craquer le secret de la pierre philosophale </h3>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-info" style="width: 30%"></div>
</div>
<h3> Résoudre N = NP</h3>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-success" style="width: 45%"></div>
</div>
<h3> Réussir mon prochain devoir d'info </h3>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-warning" style="width: 60%"></div>
</div>
<h3> Ne pas oublier mes affaires </h3>
<div class="progress progress-striped active">
<div class="progress-bar progress-bar-warning" style="width: 10%"></div>
</div>
</div>
</div>
<!-- Wells -->
<div class="row tall-row">
<div class="col-lg-12">
<h1>Ce que les gens disent de moi</h1>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="well well-lg">
C'est un être incroyable.
</div>
</div>
<div class="col-md-4">
<div class="well well-lg">
Rien ne peut le dépasser.
</div>
</div>
<div class="col-md-4">
<div class="well well-lg">
Impossible de l'attaquer
</div>
</div>
</div>
<!-- Alerts -->
<div class="row tall-row">
<div class="col-lg-12">
<h2>Alerts</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-dismissible alert-warning">
<button type="button" class="close">×</button>
<h4>Warning!</h4>
<p>Vous faites quoi ici?</p>
</div>
<div class="row">
<div class="col-lg-4">
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close">×</button>
Partez vous n'avez il y a rien à voir.
</div>
</div>
<div class="col-lg-4">
<div class="alert alert-dismissible alert-success">
<button type="button" class="close">×</button>
De toute façon vous ne trouverez <strong>jamais </strong> comment je m'appelle.
</div>
</div>
</div>
</div>
</div>
</div>
<!--
Ne pas oublier... Pour le connecter à ma machine
ssh <nom d'utilisateur>@<IP de la machine>
Heureusement que personne ne viendra regarder ici.
Ma maman ma toujours dit qu'il fallait signer son travail.
Franklin
-->
</body>
</html>