dpbt/init.sh
2025-05-26 18:21:04 -06:00

452 lines
16 KiB
Bash
Executable File
Raw Blame History

#!/bin/bash
flech='=>'
menu_func(){
local options=${#@}
local array
for((num=1; num<=$options; num++)); do
#echo -ne "\033[0;35m [\033[0;36m$num\033[0;35m]\033[0;33m ${flech} "
echo -ne "\e[1;30m [\e[1;36m$num\e[1;30m] <<======>> [#"
#echo -ne " \033[0;35m [\033[0;36m$num\033[0;35m]\033[0;33m ${flech} "
array=(${!num})
case ${array[0]} in
"-vm")txt=$(echo ${array[@]}|sed 's/-vm//g') && echo -e "\033[1;30m[\e[1;31m!\e[1;30m]\033[1;31m$txt \e[1;30m[\e[1;31m!\e[1;30m]";;
"-fi")txt=( [0]="$(echo "${array[@]}"|sed 's/-fi//g'|cut -d';' -f1|sed 's/ //')" [1]="$(echo "${array[@]}"|sed 's/-fi//g'|cut -d';' -f2)") && echo -e "\e[1;37m${txt[0]} \e[1;30m[\e[38;5;219m#${txt[1]}\e[1;30m]";;
-b|-bar|-bar2|-bar3|-bar4)echo -e "\033[1;37m${array[@]:1}\e[1;30m]\n$(msg -b)";;
*)echo -e "\033[1;37m${array[@]}\e[1;30m]";;
esac
done
}
selection_fun() {
local selection="null"
local range
for((i=0; i<=$1; i++)); do range[$i]="$i "; done
while [[ ! $(echo ${range[*]}|grep -w "$selection") ]]; do
echo -ne "\033[1;30m╰► Seleccione su opción: \e[1;32m" >&2
read selection
tput cuu1 >&2 && tput dl1 >&2
done
echo $selection
}
print_center(){
if [[ -z $2 ]]; then
text="$1"
else
col="$1"
text="$2"
fi
while read line; do
unset space
x=$(( ( 54 - ${#line}) / 2))
for (( i = 0; i < $x; i++ )); do
space+=' '
done
space+="$line"
if [[ -z $2 ]]; then
msg -azu "$space"
else
msg "$col" "$space"
fi
done <<< $(echo -e "$text")
}
# titulos y encabesados
title(){
clear
msg -b
if [[ -z $2 ]]; then
print_center -azu "$1"
else
msg "$@"
fi
msg -b
}
# finalizacion de tareas
enter(){
msg -b
text="►► enter para continuar ◄◄"
if [[ -z $1 ]]; then
print_center -blak "$text"
else
print_center "$1" "$text"
fi
read
}
# opcion, regresar volver/atras
back(){
msg -b
echo -ne " \033[0;35m [\033[0;36m0\033[0;35m]\033[0;33m ${flech} \e[1;37m\e[41mSALIR\e[0m\n"
msg -b
}
msg() {
local colors='colores.conf'
if [[ ! -e $colors ]]; then
COLOR[0]='\033[1;37m' #BRAN='\033[1;37m'
COLOR[1]='\e[31m' #VERMELHO='\e[31m'
COLOR[2]='\e[32m' #VERDE='\e[32m'
COLOR[3]='\e[33m' #AMARELO='\e[33m'
COLOR[4]='\e[34m' #AZUL='\e[34m'
COLOR[5]='\e[35m' #MAGENTA='\e[35m'
COLOR[6]='\033[1;97m' #MAG='\033[1;36m'
COLOR[7]='\033[1;49;95m'
COLOR[8]='\033[1;49;96m'
else
local COL=0
for number in $(cat $colors); do
case $number in
1)COLOR[$COL]='\033[1;37m';;
2)COLOR[$COL]='\e[31m';;
3)COLOR[$COL]='\e[32m';;
4)COLOR[$COL]='\e[33m';;
5)COLOR[$COL]='\e[34m';;
6)COLOR[$COL]='\e[35m';;
7)COLOR[$COL]='\033[1;36m';;
8)COLOR[$COL]='\033[1;49;95m';;
9)COLOR[$COL]='\033[1;49;96m';;
esac
let COL++
done
fi
NEGRITO='\e[1m'
SEMCOR='\e[0m'
case $1 in
-b)echo -e "\e[1;30m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\e[0m";;
-ne)cor="${COLOR[1]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
-ama)cor="${COLOR[3]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-r | -red)echo -e "\e[91m$2\e[0m";;
-verm)echo -e "\e[1;30m[\e[1;31m!\e[1;30m] \e[91m$2 \e[1;30m[\e[1;91m!\e[1;30m]\e[0m";;
-verm2)cor="${COLOR[1]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-aqua)cor="${COLOR[8]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-azu)cor="${COLOR[6]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-verd)cor="${COLOR[2]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-bra)cor="${COLOR[0]}${SEMCOR}" && echo -e "${cor}${2}${SEMCOR}";;
-nazu) cor="${COLOR[6]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
-nverd)cor="${COLOR[2]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
-nama) cor="${COLOR[3]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
-t)toilet -f future "$2"|lolcat;;
-verm3)cor="${COLOR[1]}" && echo -e "${cor}${2}${SEMCOR}";;
-teal) cor="${COLOR[7]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-teal2)cor="${COLOR[7]}" && echo -e "${cor}${2}${SEMCOR}";;
-blak) cor="\e[1;30m${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-fi)txt=($(echo "$@"|sed 's/-fi//g'|awk -F ";" '{print $1,$2}')) && echo -e "\e[1;37m${txt[0]} \e[1;30m[\e[38;5;219m#${txt[1]}\e[1;30m]";;
-blak2)cor="${COLOR[8]}" && echo -e "${cor}${2}${SEMCOR}";;
-blu) cor="${COLOR[9]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
-blu1) cor="${COLOR[9]}" && echo -e "${cor}${2}${SEMCOR}";;
#-bar)ccor="${COLOR[1]}•••••••••••••••••••••••••••••••••••••••••••••••••" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
#-bar)ccor="${COLOR[3]}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
-bar)ccor="${COLOR[3]}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
-bar1)ccor="${COLOR[1]}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
-bar2)ccor="${COLOR[1]}=====================================================" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
-bar3)ccor="${COLOR[3]}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
-bar4)ccor="${COLOR[5]}•••••••••••••••••••••••••••••••••••••••••••••••••" && echo -e "${SEMCOR}${ccor}${SEMCOR}";;
esac
}
fun_bar() {
comando[0]="$1"
comando[1]="$2"
(
[[ -e $HOME/fim ]] && rm $HOME/fim
${comando[0]} -y > /dev/null 2>&1
${comando[1]} -y > /dev/null 2>&1
touch $HOME/fim
) > /dev/null 2>&1 &
echo -ne "\033[1;33m ["
while true; do
for((i=0; i<18; i++)); do
echo -ne "\033[1;31m##"
sleep 0.1s
done
[[ -e $HOME/fim ]] && rm $HOME/fim && break
echo -e "\033[1;33m]"
sleep 1s
tput cuu1
tput dl1
echo -ne "\033[1;33m ["
done
echo -e "\033[1;33m]\033[1;31m -\033[1;32m 100%\033[1;37m"
}
del(){
for (( i = 0; i <= $1; i++ )); do
tput cuu1 && tput dl1
done
}
mportas() {
unset portas
portas_var=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
while read port; do
var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
[[ "$(echo -e $portas|grep "$var1 $var2")" ]] || portas+="$var1 $var2\n"
done <<< "$portas_var"
i=1
echo -e "$portas"
}
fun_bar3(){
fun_bar "$@"
}
printext(){
unset text length content
local text=$@
local length=${#text}
function random(){ shuf -i 1-220 -n 1 ; }
for((i=0;i<=$length;i++));do
content+="\e[38;5;$(random)m${text:$i:1}"
done
echo -ne "$content"
}
cor[0]="\033[0m"
cor[1]="\033[1;34m"
cor[2]="\033[1;32m"
cor[3]="\033[1;37m"
cor[4]="\033[1;36m"
cor[5]="\033[1;33m"
cor[6]="\033[1;35m"
export -f msg
export -f fun_bar
export -f enter
export -f back
export -f print_center
export -f del
unset -v sdir
sdir[0]='/etc/adm-db'
sdir[1]='/usr/local/lib/exec-dk'
sdir[2]='/etc/scripts'
ip=$(wget -qO- ipv4.icanhazip.com)
[[ ! -d ${sdir[@]} ]] && mkdir -p ${sdir[@]}
echo $ip > /usr/local/lib/exec-dk/ipdk
hora(){
rm -rf /etc/localtime &>/dev/null
ln -s /usr/share/zoneinfo/America/Chihuahua /etc/localtime &>/dev/null
rm -rf /usr/local/lib/systemubu1 &> /dev/null
rm -rf /etc/adm-db/num-keys.cont && touch /etc/adm-db/num-keys.cont
echo "$(cat /etc/adm-db/num-keys.cont | wc -l)"
}
packages(){
case $1 in
-i)clear&&clear
[[ ! $(dpkg --get-selections|grep -w 'figlet') ]] && apt-get install figlet -y &> /dev/null 2>&1
[[ ! $(dpkg --get-selections|grep -w 'lolcat') ]] && apt-get install lolcat -y &> /dev/null 2>&1&&sudo gem install lolcat -y >/dev/null 2>&1
locale-gen en_US.UTF-8 >/dev/null 2>&1
update-locale LANG=en_US.UTF-8 >/dev/null 2>&1
figlet 'PCKGS'|lolcat
msg -bar&&print_center -ama 'INSTALANDO PAQUETES'
msg -bar
soft='bc gawk jq screen curl socat netcat netstat netcat-traditional net-tools cowsay pv'
for i in `echo $soft`; do
leng="${#i}"
puntos=$(( 21 - $leng))
pts="."
echo -ne "\n\e[1;30m[#\e[1;34minstalando \e[1;36m$i\e[1;30m] \e[1;30m[\e[1;36m$pts"
for (( a = 0; a < $puntos; a++ )); do
echo -ne "\e[38;5;${z:=38}m${pts}"&&sleep 0.4
z=$(( ${z:=10} + 17))
done
if apt install $i -y &>/dev/null ; then
echo -ne "\e[1;30m] \e[1;32m instalado\n"
else
echo -ne "\e[1;30m]\e[1;31m no instalado\n"
sleep 0.1s
tput cuu1 && tput dl1
msg -ama "aplicando fix a $i"
dpkg --configure -a &>/dev/null
sleep 0.2s
tput cuu1 && tput dl1
msg -azu " instalando $i$(msg -ama "$pts")"
if apt install $i -y &>/dev/null ; then
msg -verd " INSTALANDO"
else
msg -verm2 " FAIL"
fi
fi
done
#service apache2 stop &> /dev/null 2>&1
#sed -i 's;Listen 80;Listen 81;g' /etc/apache2/ports.conf
#service apache2 restart >/dev/null 2>&1
[[ $(dpkg --get-selections|grep -w 'apache2') ]] && [[ $(dpkg --get-selections|grep -w 'apache') ]] && [[ $(dpkg --get-selections|grep -w 'apache2-web' ) ]] && {
apt purge apache2>/dev/null 2>&1
snap remove apache >/dev/null 2>&1
apt purge apache >/dev/null 2>&1
( apt autoremove&&apt list --upgradable ) >/dev/null 2>&1
[[ ! $(dpkg --get-selections|grep -w 'nginx') ]] && {
pkill -f 81
source <(wget -qO- https://gitea.com/drowkid01/scriptdk1/raw/branch/main/conf/nginx.sh)
return $?
echo 'source <(curl -sSL https://gitea.com/drowkid01/scriptdk1/raw/branch/main/conf/nginx.sh)' > /bin/menu-nginx
chmod +rwx /bin/menu-nginx
}
}
msg -bar&&enter
;;
esac
}
download(){
case $1 in
-s | --script)
url=( "https://www.dropbox.com/s/3ujxegx15hoh1w2/SCRIPT-LATAM.zip" "https://www.dropbox.com/s/o3wyvhaxxb5sj8h/SCRIPTMX.zip" "https://raw.githubusercontent.com/kelokepe/scriptcgh/main/Control/chukk.tar")
[[ ! -e /etc/scripts/scripts.json ]] && {
[[ ! -d /etc/scripts ]] && mkdir -p /etc/scripts || rm -rf /etc/scripts&&mkdir -p /etc/scripts
files=( "POpen.py PGet.py PPriv.py PPub.py PDirect.py menu menu_inst cabecalho ferramentas ultrahost shadowsocks.sh usercodes payloads v-local.log menu_credito" "ID.txt slowdns.sh ADMbot.sh C-SSR.sh Crear-Demo.sh PDirect.py PGet.py POpen.py PPriv.py PPub.py apacheon.sh blockBT.sh budp.sh dns-netflix.sh dropbear.sh fai2ban.sh message.txt openvpn.sh paysnd.sh ports.sh sockspy.sh speed.py squid.sh squidpass.sh ssl.sh tcp.sh ultrahost v2ray.sh python.py" "menu.sh LATAMbot.sh PDirect.py PGet.py POpen.py PPriv.py PPub.py message.txt")
ruta=( '/etc/scripts/scriptdk1' '/etc/scripts/vpsmx' '/etc/scripts/latam' )
link=( 'https://gitea.com/drowkid01/scriptdk1/raw/branch/main/setup' 'https://gitea.com/darnix1/darnix/raw/branch/main/LACASITA.sh' "https://gitlab.com/darnix2/archivos/-/raw/main/install.sh")
name=('scriptdk1' 'vpsmx' 'latam')
echo -e "{\n}" > /etc/init.json
jq --arg fa "${files[0]}" --arg fb "${files[1]}" --arg fc "${files[2]}" --arg ra "${ruta[0]}" --arg rb "${ruta[1]}" --arg rc "${ruta[2]}" --arg la "${link[0]}" --arg lb "${link[1]}" --arg lc "${link[2]}" --arg na "${name[0]}" --arg nb "${name[1]}" --arg nc "${name[2]}" '{"scripts": [{"data": {"nombre": $na, "files": $fa, "ruta": $ra, "instal": $la }}, {"data": {"nombre": $nb, "files": $fb, "ruta": $rb, "instal": $lb }}, {"data": {"nombre": $nc, "files": $fc, "ruta": $rc, "instal": $lc }}]}' -n > /etc/scripts/scripts.json
}
for i in {0..3}; do mkdir -p /etc/scripts/${name[$i]} >/dev/null 2>&1 ; done
cd /etc/scripts/vpsmx&&wget ${url[1]} &>/dev/null 2>&1
unzip SCRIPTMX.zip&&rm SCRIPTMX.zip >/dev/null 2>&1
cd /etc/scripts/latam&&wget ${url[0]} >/dev/null 2>&1
unzip SCRIPT-LATAM.zip&&rm SCRIPT-LATAM.zip >/dev/null 2>&1
cd /etc/scripts/scriptdk1&&wget ${url[2]} >/dev/null 2>&1
tar xpf chukk.tar&&rm chukk.tar
cd ~/
clear&&clear
figlet 'SCRIPTS'|lolcat
msg -bar&&print_center -ama 'INSTALADOS CORRECTAMENTE'
msg -bar
cat /etc/scripts/scripts.json|jq
msg -bar
echo -e "\e[1;30m[#\e[1;34mPara modificar manualmente los scripts y la información, entra en /etc/scripts \e[1;30m]"
enter
clear&&clear
figlet 'scpdk1'<EFBFBD><EFBFBD>|lolc
msg -bar
;;
-b | --botgen)
[[ ! -e ${sdir[0]}/data ]] && {
clear&&clear
figlet 'BOTGEN'|lolcat
msg -bar&&print_center -ama 'DATOS DEL ADMIN'&&msg -bar
echo -ne "\e[1;30m[+] \e[1;34mIngresa el token del bot: \e[1;36m"
while read token; do
if [[ -z $token ]]; then
tput cuu1&&tput dl1
echo -e "\e[1;31m[x] INGRESA UN TOKEN VALIDO [x]"&&sleep 0.5
tput cuu1&&tput dl1
unset token&&echo -ne "\e[1;30m[+] \e[1;34mIngresa el token del bot: \e[1;36m"
read token
else
data="$token | "&&break
fi
done
msg -bar
echo -ne "\e[1;30m[+] \e[1;34mIngresa tu ID: \e[1;36m"
while read id; do
if [[ -z $id ]]; then
id='7570680285'&&break
else
break
fi
done
msg -bar
print_center "$(echo -e "\e[1;32m[+] DATOS GUARDADOS EXITOSAMENTE [+]")"
data+="$id"
echo $data > ${sdir[0]}/data
enter
}
url=("https://www.dropbox.com/s/25xxz39l16wql29/BotGen.sh" "https://gitlab.com/xdanx90/Premium/-/raw/main/install/http-server.sh")
wget -O ${sdir[0]}/BotGen.sh ${url[0]} >/dev/null 2>&1
wget -O /bin/http-server.sh ${url[1]} >/dev/null 2>&1
#echo "${sdir[0]}/BotGen.sh /bin/http-server.sh"|xargs chmod +rwx
chmod +rwx ${sdir[0]}/BotGen.sh /bin/http-server.sh
[[ ! -e /etc/systemd/system/BotGen.service ]] && {
wget -O /etc/systemd/system/BotGen.service https://darix.ooguy.com/drowkid01/dpbt/raw/branch/main/otros/BotGen.service &>/dev/null 2>&1
msg -bar
if systemctl enable BotGen >/dev/null 2>&1; then
if systemctl start BotGen >/dev/null 2>&1; then
echo -e "\e[1;32m[+] BOTGEN INSTALADO [+]"
systemctl stop BotGen >/dev/null 2>&1
else
echo -e "\e[1;31m[x] ERROR AL INICIAR BOTGEN [x]"
fi
else
echo -e "\e[1;31m[x] ERROR AL HABILITAR EL BOTGEN [x]"
fi
}
[[ ! -e /etc/systemd/system/http-server.service ]] && {
wget -O /etc/systemd/system/http-server.service https://darix.ooguy.com/drowkid01/dpbt/raw/branch/main/otros/http-server.service &>/dev/null 2>&1
if systemctl enable http-server >/dev/null 2>&1;then
if systemctl start http-server >/dev/null 2>&1;then
echo -e "\e[1;32m[+] HTTP-SERVER HABILITADO Y ACTIVADO CORRECTAMENTE [+]"
else
echo -e "\e[1;31m[x] ERROR AL ACTIVAR EL HTTP-SERVER [x]"
fi
else
echo -e "\e[1;31m[x] ERROR AL HABILITAR EL HTTP-SERVER [x]"
fi
}
;;
esac
}
if [[ $1 == @('-i'|'--install') ]]; then
packages -i
download --script
download -b
elif [[ $1 == @('-m'|'--menu') ]]; then
clear&&clear
figlet 'BOTGEN'|lolcat
echo -ne "\e[1;30m[#\e[1;34mIP: \e[1;36m$(cat /usr/local/lib/exec-dk/ipdk)\e[1;30m] \e[1;30m[#\e[0;34mversion: \e[1;36mv1.1\e[1;30m]\n"
msg -b
[[ $(systemctl status BotGen) == 'inactive' ]] && {
pb="\e[1;31m[OFF]"&&pB="\e[1;32mACTIVAR/INICIAR BOTGEN"
} || { pb="\e[1;32m[ON] "&&pB="\e[1;31mAPAGAR BOTGEN"; }
[[ $(systemctl status http-server) == 'inactive' ]] && {
ph="\e[1;31m[OFF]"&&pH="\e[1;32mACTIVAR/INICIAR GEN/SERVER"
} || { ph="\e[1;32m[ON] "&&pH="\e[1;31mDESACTIVAR GEN/SERVER" ; }
for i in `seq 0 2`; do
scps+="$(cat /etc/scripts/scripts.json|jq ".scripts[$i].data.nombre") "
done
echo -e " \e[1;30m[#\e[0;34mBOTGEN: $pb\e[1;30m] <<==>> [#\e[1;34mGEN: $ph\e[1;30m]"
echo -e " \e[1;30m[#\e[0;34mSCRIPTS: \e[1;36m$nscp\e[1;30m] <<==>> [#\e[1;36m$(echo ${scps}|sed 's;\";;g')\e[1;30m]"
msg -b
menu_func 'CONFIGURAR BOT' 'ACTUALIZAR ARCHIVOS' 'ENVIAR MENSAJE' 'VERIFICAR KEYS' '-b GENERAR KEY' "${pB}" "${pH}"
back
case `selection_fun 10` in
6)
if systemctl status BotGen|grep -w 'active' >/dev/null 2>&1; then
msg -r 'BOTGEN APAGADO CORRECTAMENTE'
systemctl stop BotGen >/dev/null
else
msg -v "BOTGEN ACTIVADO CORRECTAMENTE"
systemctl start BotGen >/dev/null 2>&1
fi
enter&&./$0 --menu
;;
7)
if systemctl status http-server|grep -w 'active' >/dev/null 2>&1; then
msg -r 'GENERADOR APAGADO CORRECTAMENTE'
systemctl stop http-server >/dev/null
else
msg -v "GENERADOR ACTIVADO CORRECTAMENTE"
systemctl start http-server >/dev/null 2>&1
fi
enter&&./$0 -m
;;
*);;
esac
fi