1
0
2024-08-14 19:39:49 +01:00

59 lines
2.3 KiB
Bash

#!/bin/bash
###########################################################################################
# Debian Bookworm VPS Hardening Setup Script V5.0.768.2024.08.08 #
###########################################################################################
# Copyright (c) 2019 - 2024, Marc Weidner, Centurion Intelligence Consulting Agency #
# https://coresecret.eu/ #
# Licensed under the EUROPEAN UNION PUBLIC LICENCE v. 1.2 https://eupl.eu/1.2/en/ #
###########################################################################################
# https://keys.openpgp.org/vks/v1/by-fingerprint/A6D46A56AE17A185AB0F6DB77095A8A13CBE0FA3 #
# Fingerprint A6D4 6A56 AE17 A185 AB0F 6DB7 7095 A8A1 3CBE 0FA3 ## valid till: 01.01.2031 #
###########################################################################################
# Module: exdo_loop #
###########################################################################################
# shellcheck disable=SC2129 disable=SC2162
set -o errexit # Exit if a command fails.
set -o nounset # Exit if an unset variable is used.
set -o pipefail # Exit if a pipeline fails.
set -o noclobber # Prevent output redirection ">", ">&", "<>" from overwriting existing files.
set +o history # Temporarily turn off history, to avoid sensitive information leakage.
exdo_loop() {
local MSG_ONE="$1"
local DOT_WEIGHT="${2:-1}" # Ratio ".":"+"
local PLS_WEIGHT="${3:-1}" # Ratio "+":"."
local DOT_COLOR="${4:-92}" # Default: bright-green
local PLS_COLOR="${5:-95}" # Default: bright-magenta
local INTERVAL="${6:-0.1}" # Default: 0.1 seconds
local LINE_WIDTH="$(tput cols)"
local COUNTER=0
local PID="$!"
while ps "$PID" &> /dev/null; do
local RAND=$((RANDOM % (DOT_WEIGHT + PLS_WEIGHT)))
if (( RAND < DOT_WEIGHT )); then
echo -ne "\e[${DOT_COLOR}m.\e[0m"
else
echo -ne "\e[${PLS_COLOR}m+\e[0m"
fi
COUNTER=$((COUNTER + 1))
if [[ $COUNTER -eq $LINE_WIDTH ]]; then
echo -ne "\r"
COUNTER=0
fi
sleep "$INTERVAL"
done
echo ""
wait "$PID"
date >>"$LOG_INS"
echo -e "\033[32m++++ ++++ ++++ ++++ ++++ ++++ ++ '$MSG_ONE'. \033[0m" | tee -a "$LOG_INS"
}