-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbanner-root.sh
More file actions
executable file
·62 lines (56 loc) · 1.74 KB
/
Copy pathbanner-root.sh
File metadata and controls
executable file
·62 lines (56 loc) · 1.74 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
#!/bin/bash
# garantir disparo apenas no root
[[ $- != *i* ]] && return
# Variavel para fortune randomico
FORTUNE_POOLS=(computers linux ubuntu debian)
RANDOM_POOL=${FORTUNE_POOLS[$RANDOM % ${#FORTUNE_POOLS[@]}]}
FORTUNE_MSG=$(fortune -s "$RANDOM_POOL" 2>/dev/null | sed '/^$/d' | head -n 4 | sed 's/[[:space:]]*$//')
# Fallback se vier vazio
if [ -z "$FORTUNE_MSG" ]; then
FORTUNE_MSG=$(fortune -s 2>/dev/null | sed '/^$/d' | head -n 4 | sed 's/[[:space:]]*$//')
fi
#BANNER para o root
echo ""
echo " ___-------------------------------------+++"
figlet -f slant "barhamutt"
echo " __--------------------------------------+"
echo ""
echo " [*] Hacking session start"
echo " [*] Trust, but verify"
echo " [*] Privilege: $(id -u | awk '{print $1==0?"root":"user"}')"
echo ""
echo "$FORTUNE_MSG"
echo ""
# cowsay quando sair do root
trap 'cowsay -f tux -W 25 "Root session closed. Back to userland."' EXIT
# ------------------------------------------------------------
# Root Session Banner
#
# Script em Bash que exibe um banner personalizado ao iniciar
# uma sessão interativa como root.
#
# O banner mostra:
# - Identificação da sessão root
# - Mensagens Personalizadas
# - Uma citação aleatória usando fortune
#
# Ao finalizar a sessão root, o script exibe uma mensagem
# usando cowsay indicando o retorno ao usuário normal.
#
# Dependências:
# - figlet
# - cowsay
# - fortune
# - bancos fortune (linux, debian, ubuntu, computers)
#
# Como usar:
# 1. Salve o script (ex:~/.banner-root.sh)
# 2. Edite o arquivo /root/.bashrc
# 3. Adicione:
# source "/caminho/.banner-root.sh"
#
# Assim o banner será executado automaticamente ao abrir
# uma sessão interativa como root.
#
# Autor: barhamutt
# ------------------------------------------------------------