Skip to content

Instantly share code, notes, and snippets.

View ljamel's full-sized avatar
🎯
Focusing

ljamel ljamel

🎯
Focusing
View GitHub Profile
docker run -d -v /:/host/ -p 2225:22 dockette/ssh bash -c "\
adduser -D -s /bin/bash cours && \
echo 'cours:abc' | chpasswd && \
adduser -D -s /bin/bash stagiaire && \
echo 'stagiaire:azerty' | chpasswd && \
echo 'FLAG h0tel_du_t3mp' > /home/stagiaire/flag.txt && \
chmod 600 /home/stagiaire/flag.txt && \
chown stagiaire:stagiaire /home/stagiaire/flag.txt && \
echo 'stagiaire:azer' > /home/cours/note.txt && \
chmod 600 /tmp/note.txt && \
#!/bin/bash
set -e
# Supprime ancien container si existant
docker rm -f ldap-ctf 2>/dev/null || true
Création du serveur ldap crateldap.sh
# Lance OpenLDAP
docker run -d --name ldap-ctf -p 389:389 \
-e LDAP_ORGANISATION="CTF LDAP" \
#!/bin/bash
set -e
if [[ $EUID -ne 0 ]]; then
echo "Ce script doit être exécuté en tant que root."
exit 1
fi
#!/bin/bash
# Demander à l'utilisateur de saisir les variables nécessaires
read -p "Entrez le nom de votre sous-domaine (par exemple, sub.localhost) : " SUBDOMAIN
read -p "Entrez le nom de votre domaine principal (par exemple, localhost) : " DOMAIN
# Définir les autres variables en fonction des entrées utilisateur
WEB_ROOT="/var/www/$SUBDOMAIN/public_html"
APACHE_CONF="/etc/apache2/sites-available/$SUBDOMAIN.conf"
HOSTS_FILE="/etc/hosts"
#!/bin/bash
#creation de sous domaine
SUBDOMAIN="sub.example.org"
WEB_ROOT="/var/www/$SUBDOMAIN/"
APACHE_CONF="/etc/apache2/sites-available/$SUBDOMAIN.conf"
mkdir -p $WEB_ROOT
mkdir /var/www/$SUBDOMAIN
@ljamel
ljamel / wsa.sh
Last active June 3, 2023 18:50
simple web SIEM bash
#!/bin/bash
# Chemin du fichier de journalisation Apache
logfile="/var/log/apache2/access.log.1"
# Liste des pages sensibles pour détecter les attaques
sensitive_pages=("admin.php" "phpmyadmin" ".env")
#codes_errors=("404" "403" "500" "400")
# Analyse du fichier de journalisation
@ljamel
ljamel / lamp.sh
Last active May 24, 2023 18:24
Install and configure LAMP
#!/bin/bash
echo -e "\n\nUpdating Apt Packages and upgrading latest patches\n"
sudo apt-get update -y && sudo apt-get upgrade -y || dnf update -y && sudo yum upgrade -y
echo -e "\n\nInstalling Apache2 Web server\n"
sudo apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 -y || dnf install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 -y
echo -e "\n\nInstalling PHP & Requirements\n"
sudo apt-get install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php7.0-mcrypt php7.0-mysql -y || dnf install libapache2-mod-php7.0 php7.0 php7.0-common php7.0-curl php7.0-dev php7.0-gd php-pear php7.0-mcrypt php7.0-mysql -y
@ljamel
ljamel / .sh
Created November 24, 2022 22:34
Deploy multi users in linux serveur
#!/bin/bash
declare -a tableau=( "martin" "john" "connor" )
i=${!tableau[@]}
for i in $i
do
#sudo useradd ${tableau[$i]}
#sudo passwd -f -u ${tableau[$i]}
echo "bonjour ${tableau[$i]}"
mdp=$(openssl rand -base64 9)
echo -e "$mdp" | passwd ${tableau[$i]}