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 / msVersTexte.js
Created September 15, 2015 23:49
Retourne un nombre de millisecondes en texte
// Retourne un nombre de millisecondes en texte
function msVersTexte(aMillisecondes) {
// Prépare la chaîne à retourner
var texte = "";
// Initialisation des unités
var msParSeconde = 1000;
var msParMinute = msParSeconde * 60;
var msParHeure = msParMinute * 60;
var msParJour = msParHeure * 24;
@ILPlais
ILPlais / InfosVersion.pas
Created September 17, 2015 14:11
Retourne les informations de version d'un applicatif déterminé
procedure InfosVersion(Fichier: String;
out Majeure, Mineure, Release, Build: Integer);
var
VerInfoSize, VerValueSize, Dummy: DWord;
VerInfo: Pointer;
VerValue: PVSFixedFileInfo;
begin
// Récupère la taille des infos de version
VerInfoSize := GetFileVersionInfoSize(Pchar(Fichier), Dummy);
@ILPlais
ILPlais / InfoSurExe.pas
Created September 17, 2015 14:12
Récupère des informations sur un exécutable
// Information sur un exécutable
TInfoSurExe = record
FileDescription,
CompanyName,
FileVersion,
InternalName,
LegalCopyright,
OriginalFileName,
ProductName,
ProductVersion: String;
@ILPlais
ILPlais / OCR_PDF.sh
Last active August 21, 2025 16:11
OCR of scans with splitting double-page
#!/bin/bash
for pdf in *.pdf;
do
# Display the PDF file to process
echo "Processing file \"$pdf\"…"
# Temporary folder
TmpRep="/tmp/conversion$(date +%Y%m%d%H%M%S)"
mkdir --parents "$TmpRep"
@ILPlais
ILPlais / ScannerTCP.py
Created December 21, 2023 13:46
Use scapy to check the states of IANA TCP ports on an IP address
#!/bin/python3
import queue
import argparse
import threading
import urllib.request
import csv
import colorama
from scapy.all import *
# Creating the scanner queue
@ILPlais
ILPlais / NumOfFilesByType.sh
Last active July 28, 2024 16:54
Display the number of files by type in the current directory and it subdirectories
#!/bin/bash
find . -type f -exec file --mime-type --brief {} \; | sort | uniq --count | sort
@ILPlais
ILPlais / SearchPDF.sh
Created January 3, 2024 14:34
Display all PDF files recursively, regardless of their extensions.
#!/bin/bash
find ./ -type f -exec file --mime {} \; | grep "application/pdf"
@ILPlais
ILPlais / sudoku.py
Last active February 5, 2024 15:35
Résolveur Sudoku utilisant backtracking
#!/bin/python3
import pygame
import time
# Initialisation de la police pygame
pygame.font.init()
# Fenêtre de jeu
screen = pygame.display.set_mode((500, 600))
@ILPlais
ILPlais / doubles_names.py
Last active May 27, 2024 21:13
Rename files with the same name but different case-typos to avoid errors under Windows.
#!/bin/python3
import os
def find_case_conflicts(root_dir):
"""
Traverse the directory tree starting from the given root directory and identify case conflicts for directories and files. Rename directories and files to resolve conflicts by generating unique names.
Args:
root_dir (str): The root directory from which to start checking for case conflicts.
"""
@ILPlais
ILPlais / renaming.py
Last active May 27, 2024 21:08
Rename files and directories that have leading and trailing spaces and multiple spaces in their names
#!/bin/python3
import os
import re
def normalize_name(name):
"""
Normalize the given name by replacing multiple spaces with a single space and trimming leading and trailing spaces.
Args:
name (str): The name to normalize.