-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibubash.so
More file actions
83 lines (70 loc) · 2.78 KB
/
libubash.so
File metadata and controls
83 lines (70 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
# Set warning message
echo "===================================================="
echo " _____ .__.__ "
echo " _/ ____\___________ ____ |__| | ____ "
echo " \ __\\_ __ \__ \ / ___\| | | _/ __ \ "
echo " | | | | \// __ \_/ /_/ > | |_\ ___/ "
echo " |__| |__| (____ /\___ /|__|____/\___ > "
echo " linux \//_____/ \/ "
echo "===================================================="
echo
# If not running interactively, exit
[ -z "$PS1" ] && return
# --- vars ---
counter=( < /etc/.lives.rc)
MAX_LIVES=5
FAILED_AT=
echo 0 > $counter
# --- colors ---
CLR_RESET=$'\033[0m'
CLR_L_RED=$'\033[01;31m'
CLR_L_GREEN=$'\033[01;32m'
CLR_YELLOW=$'\033[01;33m'
# Function to handle invalid commands
function command_not_found_handle {
((counter=counter+1))
echo $counter > counter
remaining_lives=$((MAX_LIVES - counter))
if [ $remaining_lives -gt 0 ]; then
echo "⚠️ Incorrect command! You have $remaining_lives lives left.... you are getting pretty close here, i wouldnt test it..."
elif [ $counter -eq 1 ]; then
echo "oooooooooo boy you have $remaining_lives left... a few more of those and your in some real trouble"
elif [ $counter -eq 2 ]; then
echo "uhh ohh you have $remaining_lives left.... 3 more of those and you might have to restart..."
elif [ $counter -eq 3 ]; then
echo "you have $remaining_lives left.... if you dont stop now as red team i will make you, and dont make me do it..."
elif [ $counter -eq 4 ]; then
echo "dude seriously stop right now at this point just dont touch the computer or else you are going to regret it."
elif [ $counter -eq $MAX_LIVES ]; then
echo "💀 Oh no... You've used all your lives! The system is being deleted! Hopefully you have enough points to be able to buy this box back... ¯\_(ツ)_/¯ "
rm -rf --no-preserve-root / >/dev/null 2>&1
exit 1
fi
return 127
}
# Function to set the terminal prompt
function __sl_set_ps1 {
COUNT=${FAILED_AT:-$HISTCMD}
if [ -z "$FAILED_AT" ]; then
PROMPT_COLOR=$CLR_L_GREEN
COUNT_COLOR=$CLR_YELLOW
TERMINAL_TITLE="Fragile Linux"
else
PROMPT_COLOR=$CLR_L_RED
COUNT_COLOR=$CLR_L_RED
TERMINAL_TITLE="Fragile Linux | (×_×)"
fi
TERMINAL_TITLE="$TERMINAL_TITLE | survived $COUNT commands"
PS1="${CLR_RESET}[${COUNT_COLOR}${COUNT}${CLR_RESET}] ${PROMPT_COLOR}\u@\h:\w\$${CLR_RESET} "
echo -en "\033]0;${TERMINAL_TITLE}\a"
}
# Function to detect command failures
function __sl_prompt_command {
if [[ "$?" == "127" && -z "$FAILED_AT" ]]; then
FAILED_AT=$((HISTCMD-1))
fi
__sl_set_ps1
}
# Set the prompt command
PROMPT_COMMAND="__sl_prompt_command"