Skip to content

Instantly share code, notes, and snippets.

View zar3bski's full-sized avatar
🦾
Learning Rust

zar3bski zar3bski

🦾
Learning Rust
View GitHub Profile
#!/bin/sh
#
# Sets LUKS decrypt over SSH on Debian 12 using dropbear-initramfs
#
# 1. run this script providing the allowed SSH keys as args
# ./unlock-luks-with-dropbear.sh '<allowed_pub_key>' '<allowed_pub_key>'
# 2. reboot the system
# 3. ssh <ip of your server> -p 2222 : you should get the 'Please unlock disk' prompt
if [ -z "$1" ]; then
@zar3bski
zar3bski / dolibarr-openid-provisioning.sql
Last active April 3, 2025 21:30
Set OIDC parameters programmatically for Dolibarr v.17.0.4 official docker image
/*
If it is possible to set `openid_connect` as one of the authentication options in `/var/www/html/conf/conf.php`
```php
<?php
...
$dolibarr_main_authentication = 'openid_connect,dolibarr';
...
```
providing the variables in the interface is a pain in the a**, especially in docker environments

Soit A, B, C tel que A XOR B = C. La fonction inversive de XOR est également un XOR => A XOR C = B. Autrement dit, si on a c (le message chiffré) et A (la clef), appliquer XOR permet de retrouver B (le message en clair). Problème nous n'avons pas la clef. En revanche, nous savons qu'elle consiste en une répétition d'une chaine de 4 bytes

key = os.urandom(4) * 20

et nous connaissons les 4 premiers caractères du message en clair: FCSC. La solution consiste alors à chercher une combinaison de bytes tels que <combinaison_de_bytes> XOR <debut_du message_chiffre> = FCSC. La répétition 20 de cette combinaison est notre key. L'utiliser pour déchiffrer le message.

@zar3bski
zar3bski / locator.py
Last active May 4, 2021 15:54
Determine local ipv4 / ipv6 witout any system dependence nor any webservices
from dns.resolver import Resolver
import logging
import argparse
logging.basicConfig(level=logging.INFO)
class Locator(Resolver):
"""A robust way to identify your public ipv4 / ipv6 without any system dependence
usage:
@zar3bski
zar3bski / .gitlab-ci.yml
Created March 13, 2020 13:52
build PDF documentation from README.md [gitlab]
build_doc:
stage: build
image: pandoc/latex:2.9.2
script:
- echo "---" >> headers.md
- "echo 'title: '${CI_PROJECT_TITLE} >> headers.md"
- "echo 'date: '$(date +'%m/%d/%Y') >> headers.md"
- "echo 'header-includes: |' >> headers.md"
- echo " \usepackage{fancyhdr}" >> headers.md
- echo " \pagestyle{fancy}" >> headers.md
@zar3bski
zar3bski / create_db_and_users.sh
Created February 4, 2020 19:56
Initiate multiple database Postgresql Docker
#!/bin/sh
if [ -n "$POSTGRES_DBS" ]; then
IFS=\|
for s in $POSTGRES_DBS ; do
pass=$(echo "$s" | sed 's/.*->//');
user=$(echo "$s" | sed 's/->.*//');
db=$user"_db";
psql --username "$POSTGRES_USER" <<-EOSQL