Skip to content

Instantly share code, notes, and snippets.

View ILPlais's full-sized avatar
👨‍🏫
In cyber-security training

PLAIS Lionel ILPlais

👨‍🏫
In cyber-security training
View GitHub Profile
@ILPlais
ILPlais / CryptPDF.sh
Created January 14, 2026 14:13
Encrypt an existing PDF without display passwords in the command-line
#!/bin/bash
echo -e "User password:"
read -s user_pw
echo -e "Owner password:"
read -s owner_pw
echo
qpdf --encrypt "$user_pw" "$owner_pw" 256 -- "$1" "$2"
unset user_pw owner_pw
@ILPlais
ILPlais / SimpleLogArchiver.sh
Created October 5, 2025 15:47
Simplified script to archive all old logs into a single archive
#!/bin/bash
# Simplified script to archive all old logs into a single archive
LOG_DIR="."
ARCHIVE_NAME="archive.7z"
PATTERN="????-??-??T??-??-?? - *.txt"
# Deadline: more than 30 days ago (example)
#CUTOFF_DATE=$(date --date="30 days ago" +%s)
@ILPlais
ILPlais / FilesDecode.py
Last active September 16, 2025 12:27
Decodes HTML entities (both hexadecimal and decimal) in filenames
import os
import re
import html
def decode_html_entities(text):
"""
Decodes hexadecimal and decimal HTML entities in text
"""
# Decode standard HTML entities (like &, <, etc.)
text = html.unescape(text)
@ILPlais
ILPlais / Backup_VM_OVA.cmd
Created August 11, 2025 15:31
VirtualBox VM Backup Batch
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
COLOR 02
TITLE VM Backup...
ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
ECHO º Information retrieval... º
ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
ECHO.
REM VM name
@ILPlais
ILPlais / ConvertFLAC2MP3.sh
Last active August 19, 2025 00:53
Convert all the FLAC files in MP3 using FFmpeg
#!/bin/bash
# Find all .flac files recursively
find . -name "*.flac" -type f | while IFS= read -r f; do
# Generates the name of the corresponding MP3 file
mp3_file="${f%.flac}.mp3"
# Check if the MP3 file already exists
if [[ ! -f "$mp3_file" ]]; then
echo "Conversion: $f -> $mp3_file"
@ILPlais
ILPlais / overall-risk.html
Created May 7, 2025 22:13
Displays a dynamically editable gauge
<!DOCTYPE html>
<html>
<head>
<title>Overall Risk</title>
<style>
body {
background-color: white;
height: 100%;
margin: 10%;
display: flex;
@ILPlais
ILPlais / GetLocalGroupName.cmd
Last active January 26, 2025 23:25
Batch script to retrieve local user group names independent of system language under Windows
@ECHO OFF
SETLOCAL EnableDelayedExpansion
REM Usage: GetLocalGroupName.cmd [SID]
REM If there is no parameter, display the list of local groups
REM If there is a parameter, use it as the SID
REM If there is no parameter, display the list of local groups
IF [%1] == [] (
ECHO Choice from the English name the local group to get on this system:
@ILPlais
ILPlais / FinalNumbers.py
Last active January 26, 2025 15:35
Remove the numbers at the ends of files when they are between parenthesis
#!/bin/python3
import os
import re
def remove_numbers_from_names(directory):
for root, _, files in os.walk(directory):
for filename in files:
# Check if filename is a directory
if os.path.isfile(filename):
# Extract the file name without the extension
@ILPlais
ILPlais / RemoveUselessBytes.py
Last active December 25, 2024 23:12
Remove useless bytes from a file
#!/bin/python3
import os
import argparse
from pathlib import Path
def remove_useless_bytes(file_path, file_destination_path, num_bytes_to_remove):
# Check if the file exists
if not file_path.exists():
print(f"File {file_path} does not exist")
return
@ILPlais
ILPlais / MiseEnForme.py
Created October 1, 2024 12:14
Corrige les erreurs typographiques courantes dans un fichier texte français
#!/usr/bin/env python3
import re
import argparse
import sys
def corriger_texte(texte):
# Espace insécable Unicode
espace_insecable = '\u00A0'
# Correction des espaces avant la ponctuation