#!/bin/bash

function_1 () {
msg -bar #echo -e "${cor[1]} ➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶➶ ${cor[0]}"
source <(curl -sL https://raw.githubusercontent.com/ChumoGH/ChumoGH-Script/master/back/blockT.sh)
msg -bar #echo -e "${cor[1]} ➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷➷ ${cor[0]}"
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export PATH=$PATH:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games
read -p " Presiona Enter para Continuar"
exit
}

function_2 () {
msg -bar #
echo -e 'Aplicando FIX para Vultr VPS Passwd'
echo -e "Añadiendo Registro a PAM.D"
sed -i 's/.*pam_cracklib.so.*/password sufficient pam_unix.so sha512 shadow nullok try_first_pass #use_authtok/' /etc/pam.d/common-password
msg -bar #
echo -e "Registro agregado"
msg -bar #
sleep 2s
cgh
}

function_3 () {
msg -bar 
echo -e "${cor[4]}  BADVPN se instalará
 que no es más que un programa
 que libera puertos UDP en el servidor
 y así permitir el servicio de VideoLlamadas!"
echo -e "${cor[5]} INICIANDO . . ."
msg -bar 
source <(curl -sSL https://www.dropbox.com/s/0stqb3dzm47kky6/budp.sh)
}

function_5 () {
msg -bar 
echo -e "${cor[4]} Este Script fue proyectado"
echo -e "${cor[4]} Para Mejorar La Latencia"
echo -e "${cor[4]} y velocidad del servidor!"
msg -bar 
echo -e "${cor[5]} analizar"
sleep 1s
if [[ `grep -c "^#ADM" /etc/sysctl.conf` -eq 0 ]]; then
#INSTALA
echo -e "${cor[5]} Este es un script experimental"
echo -e "${cor[5]} ¡Utilice por su propia cuenta y riesgo!"
echo -e "${cor[5]} Este script cambiará algunas"
echo -e "${cor[5]} configuraciones de red (BBR)"
echo -e "${cor[5]} del sistema para reducir"
echo -e "${cor[5]} la latencia y mejorar la velocidad"
msg -bar #echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
read -p " Continuar con la instalación? [s/n]: " -e -i s resp_osta
echo -e "\033[1;37m"
if [[ "$resp_osta" = 's' ]]; then
unset resp_osta
echo "#ADM" >> /etc/sysctl.conf
echo "net.ipv4.tcp_window_scaling = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.ipv4.tcp_low_latency = 1
net.ipv4.tcp_slow_start_after_idle = 0
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf > /dev/null 2>&1
echo -e "${cor[5]} Configuración de red TCP"
echo -e "${cor[5]} se han agregado con éxito"
msg -bar #echo -e "${cor[1]} ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ${cor[0]}"
return
 else
msg -bar 
return
fi
 else
#REMOVE
echo -e "${cor[5]} Configuración de red TCP"
echo -e "${cor[5]} ya se han agregado en el sistema!"
msg -bar
read -p " Desea quitar la configuración TCP? [s/n]: " -e -i n res_posta
if [[ "$res_posta" = 's' ]]; then
unset res_posta
grep -v "^#ADM
net.ipv4.tcp_window_scaling = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.ipv4.tcp_low_latency = 1
net.ipv4.tcp_slow_start_after_idle = 0
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr" /etc/sysctl.conf > /tmp/syscl && mv -f /tmp/syscl /etc/sysctl.conf
sysctl -p /etc/sysctl.conf > /dev/null 2>&1
echo -e "${cor[5]} Configuración de red TCP"
echo -e "${cor[5]} se han eliminado con éxito"
msg -bar
return
 else
msg -bar 
return
 fi
fi
}

function_6 () {
source fai2ban
fail2ban-testcases -x start 2>/dev/null
fail2ban-client -x start 2>/dev/null
}

function_8 () {
msg -bar 
echo -e "${cor[5]} OPCION PARA COLOCAR"
echo -e "${cor[5]} CUALQUIER ARCHIVO ONLINE"
echo -e "${cor[5]} QUE ESTE ARCHIVO"
echo -e "${cor[5]} EN EL DIRECTORIO \033[1;31m$HOME"
msg -bar 
meu_ip
echo -e " \033[0;35m[\033[0;36m1\033[0;35m] \033[0;34m➮\033[0;33m COLOCAR ARCHIVO ONLINE  \033[0;32m(#)" 
echo -e " \033[0;35m[\033[0;36m2\033[0;35m] \033[0;34m➮\033[0;33m REMOVER ARCHIVO ONLINE  \033[0;32m(#)"
echo -e " \033[0;35m[\033[0;36m3\033[0;35m] \033[0;34m➮\033[0;31m VER MIS ARCHIVOS ONLINE \033[0;33m(#)"
msg -bar 
echo -e " \033[0;35m [\033[0;36mENTER\033[0;35m]\033[0;31m ➮ $(msg -bra "\033[1;41m[ Regresar ]\e[0m")"
read -p " 『 1-3 』: " arquivo_online_adm
number_var $arquivo_online_adm
if [ "$var_number" = "" ]; then
return
 else
online_adm="$var_number"
fi
if [ "$online_adm" -gt 3 ]; then
echo -e "${cor[5]} VER MIS ARCHIVOS ONLINE"
msg -bar 
return
fi
if [ "$online_adm" = 3 ]; then
msg -bar 
for my_arqs in `ls /var/www/html`; do
if [ "$my_arqs" != "index.html" ]; then
 if [ ! -d "$my_arqs" ]; then
echo -e " \033[1;36mhttp://$IP:81/$my_arqs\033[0m"
 fi
fi
done
msg -bar
return
fi
if [ "$online_adm" = 2 ]; then
msg -bar
unset _cont
_cont="1"
for my_arqs in `ls /var/www/html`; do
if [ "$my_arqs" != "index.html" ]; then
 if [ ! -d "$my_arqs" ]; then
select_arc[$_cont]="$my_arqs"
echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮ ${cor[3]} $my_arqs => \033[1;36mhttp://$IP:81/$my_arqs\033[0m"
_cont=$(($_cont + 1))
 fi
fi
done
_cont=$(($_cont - 1))
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} Seleccione un archivo:"
read -p " [ 1-$_cont ]: " slct
number_var $slct
if [ "$var_number" = "" ]; then
return
 else
slct="$var_number"
fi
unset _cont
arquivo_move="${select_arc[$slct]}"
 if [ "$arquivo_move" = "" ]; then
echo -e "${cor[5]} Ningún archivo ha sido seleccionado"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
return
 fi
rm -rf /var/www/html/$arquivo_move > /dev/null 2>&1
rm -rf /var/www/$arquivo_move > /dev/null 2>&1
echo -e "${cor[5]} Procedimiento Hecho Con Éxito"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
return
fi
unset _cont
_cont="1"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} FICHEROS EN $HOME"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
for my_arqs in `ls $HOME`; do
if [ ! -d "$my_arqs" ]; then
select_arc[$_cont]="$my_arqs"
echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮ ${cor[3]}$my_arqs"
_cont=$(($_cont + 1))
fi
done
_cont=$(($_cont - 1))
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[177]}"
read -p " 『 1-$_cont 』:  " slct
number_var $slct
if [ "$var_number" = "" ]; then
return
 else
slct="$var_number"
fi
unset _cont
arquivo_move="${select_arc[$slct]}"
if [ "$arquivo_move" = "" ]; then
echo -e "${cor[5]} ${txt[178]}"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
return
fi
if [ ! -d /var ]; then
mkdir /var
fi
if [ ! -d /var/www ]; then
mkdir /var/www
fi
if [ ! -d /var/www/html ]; then
mkdir /var/www/html
fi
if [ ! -e /var/www/html/index.html ]; then
touch /var/www/html/index.html
fi
if [ ! -e /var/www/index.html ]; then
touch /var/www/index.html
fi
chmod -R 755 /var/www
cp $HOME/$arquivo_move /var/www/$arquivo_move
cp $HOME/$arquivo_move /var/www/html/$arquivo_move
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[180]}"
msg -bar
echo -e "\033[1;36m http://$IP:81/$arquivo_move\033[0m"
msg -bar
echo -e "${cor[5]} ${txt[179]}"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
}

function_9 () {
sudo apt install python3-pip > /dev/null 2>&1
sudo pip install speedtest-cli  > /dev/null 2>&1

msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[4]} ${txt[184]}"
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
#ping-down=$(speedtest-cli |awk '{print $10 $11}' |grep -v loss |cut -d = -f2 |sed ':a;N;s/\n//g;ta')
ping=$(ping -c1 google.com |awk '{print $8 $9}' |grep -v loss |cut -d = -f2 |sed ':a;N;s/\n//g;ta')
#starts_test=$(python ./speedtest.py)
down_load=$(speedtest-cli | grep "Download" | awk '{print $2,$3}')
up_load=$(speedtest-cli | grep "Upload" | awk '{print $2,$3}')
echo -e "${cor[5]} ${txt[185]}: $ping "
echo -e "${cor[5]} ${txt[186]}: $up_load"
echo -e "${cor[5]} ${txt[187]}: $down_load"
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
}

function_10 () {
null="\033[1;31m"
msg -bar #echo -e "${cor[1]} ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ${cor[0]}"
if [ ! /proc/cpuinfo ]; then
echo -e "${cor[4]} ${txt[188]}"
msg -bar #echo -e "${cor[1]} ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ${cor[0]}"
return
fi
if [ ! /etc/issue.net ]; then
echo -e "${cor[4]} ${txt[188]}"
msg -bar #echo -e "${cor[1]} ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ${cor[0]}"
return
fi
if [ ! /proc/meminfo ]; then
echo -e "${cor[4]} ${txt[188]}"
msg -bar #echo -e "${cor[1]} ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ${cor[0]}"
return
fi
totalram=$(free | grep Mem | awk '{print $2}')
usedram=$(free | grep Mem | awk '{print $3}')
freeram=$(free | grep Mem | awk '{print $4}')
swapram=$(cat /proc/meminfo | grep SwapTotal | awk '{print $2}')
system=$(cat /etc/issue.net)
clock=$(lscpu | grep "CPU MHz" | awk '{print $3}')
based=$(cat /etc/*release | grep ID_LIKE | awk -F "=" '{print $2}')
processor=$(cat /proc/cpuinfo | grep "model name" | uniq | awk -F ":" '{print $2}')
cpus=$(cat /proc/cpuinfo | grep processor | wc -l)
if [ "$system" ]; then
echo -e "${cor[5]} ${txt[189]}: ${null}$system"
else
echo -e "${cor[5]} ${txt[189]}: ${null}???"
fi
if [ "$based" ]; then
echo -e "${cor[5]} ${txt[190]}: ${null}$based"
else
echo -e "${cor[5]} ${txt[190]}: ${null}???"
fi
if [ "$processor" ]; then
echo -e "${cor[5]} ${txt[191]}: ${null}$processor x$cpus"
else
echo -e "${cor[5]} ${txt[191]}: ${null}???"
fi
if [ "$clock" ]; then
echo -e "${cor[5]} ${txt[192]}: ${null}$clock MHz"
else
echo -e "${cor[5]} ${txt[192]}: ${null}???"
fi
echo -e "${cor[5]} ${txt[193]}: ${null}$(ps aux  | awk 'BEGIN { sum = 0 }  { sum += sprintf("%f",$3) }; END { printf " " "%.2f" "%%", sum}')"
echo -e "${cor[5]} Arquitectura CPU ID : ${null}$(lscpu | grep "Vendor ID" | awk '{print $3}')"
echo -e "${cor[5]} ${txt[194]}: ${null}$(($totalram / 1024))"
echo -e "${cor[5]} ${txt[195]}: ${null}$(($usedram / 1024))"
echo -e "${cor[5]} ${txt[196]}: ${null}$(($freeram / 1024))"
echo -e "${cor[5]} ${txt[197]}: ${null}$(($swapram / 1024))MB"
echo -e "${cor[5]} ${txt[198]}: ${null}$(uptime)"
echo -e "${cor[5]} ${txt[199]}: ${null}$(hostname)"
echo -e "${cor[5]} ${txt[200]}: ${null}$(ip addr | grep inet | grep -v inet6 | grep -v "host lo" | awk '{print $2}' | awk -F "/" '{print $1}')"
echo -e "${cor[5]} ${txt[201]}: ${null}$(uname -r)"
echo -e "${cor[5]} ${txt[202]}: ${null}$(uname -m)"
msg -bar #echo -e "${cor[1]} ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• ${cor[0]}"
return
}

function_11 () {
payload="/etc/payloads"
if [ ! -f "$payload" ]; then
echo -e "${cor[5]} $payload ${txt[213]}"
echo -e "${cor[5]} ${txt[214]}"
return
fi
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[2]} |1| >${cor[3]} ${txt[215]}"
echo -e "${cor[2]} |2| >${cor[3]} ${txt[216]}"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
read -p " | 1 - 2 |: " var_pay
number_var $var_pay
if [ "$var_number" = "" ]; then
echo -e "\033[1;31m ${txt[217]}"
return
 else
var_payload="$var_number"
fi
if [ "$var_payload" -gt "2" ]; then
echo -e "\033[1;31m ${txt[217]}"
return
fi
if [ "$var_payload" = "1" ]; then
echo -e "${cor[4]} ${txt[215]}"
echo -e "${cor[5]} ${txt[218]} $payload:"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
read -p " ${txt[219]} ${txt[220]}: " hos
if [[ $hos != \.* ]]; then
echo -e "${cor[5]} ${txt[220]}"
return
fi
host="$hos/"
if [[ -z $host ]]; then
echo -e "${cor[5]} ${txt[221]}"
return
fi
if [[ `grep -c "^$host" $payload` -eq 1 ]]; then
echo -e "${cor[5]} ${txt[222]}"
return
fi
echo "$host" >> $payload && grep -v "^$" $payload > /tmp/a && mv /tmp/a $payload
echo -e "${cor[5]} ${txt[223]}"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
 if [ ! -f "/etc/init.d/squid" ]; then
service squid3 reload
service squid3 restart
 else
/etc/init.d/squid reload
service squid restart
 fi	
return
fi

if [ "$var_payload" = "2" ]; then
echo -e "${cor[4]} ${txt[216]}"
echo -e "${cor[5]} ${txt[218]} $payload:"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
read -p " ${txt[224]} ${txt[220]}: " hos
if [[ $hos != \.* ]]; then
echo -e "${cor[5]} ${txt[220]}"
return
fi
host="$hos/"
if [[ -z $host ]]; then
echo -e "${cor[5]} ${txt[221]}"
return
fi
if [[ `grep -c "^$host" $payload` -ne 1 ]]; then
echo -e "${cor[5]} ${txt[225]}"
return
fi
grep -v "^$host" $payload > /tmp/a && mv /tmp/a $payload
echo -e "${cor[5]} ${txt[223]}"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
cat $payload | awk -F "/" '{print $1,$2,$3,$4}'
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
 if [ ! -f "/etc/init.d/squid" ]; then
service squid3 reload
service squid3 restart
 else
/etc/init.d/squid reload
service squid restart
 fi	
return
fi
}

criar_pay () {
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[258]}"
echo -e "${cor[5]} ${txt[259]}"
echo -e "${cor[5]} ${txt[260]}"
echo -e "${cor[5]} ${txt[261]}"
msg -bar #echo -e "${cor[1]} =================================== ${cor[3]}"
read -p " => " valor1
if [ "$valor1" = "" ]; then
echo -e "${cor[5]} ${txt[262]}"
return
fi
meu_ip
valor2="$IP"
if [ "$valor2" = "" ]; then
valor2="127.0.0.1"
fi
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[264]} ${cor[3]}"
echo -e " 1-GET"
echo -e " 2-CONNECT"
echo -e " 3-PUT"
echo -e " 4-OPTIONS"
echo -e " 5-DELETE"
echo -e " 6-HEAD"
echo -e " 7-TRACE"
echo -e " 8-PROPATCH"
echo -e " 9-PATCH"
msg -bar #echo -e "${cor[1]} =================================== ${cor[3]}"
read -p " => " valor3
case $valor3 in
1)req="GET";;
2)req="CONNECT";;
3)req="PUT";;
4)req="OPTIONS";;
5)req="DELETE";;
6)req="HEAD";;
7)req="TRACE";;
8)req="PROPATCH";;
9)req="PATCH";;
*)req="GET";;
esac
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[265]}"
echo -e "${cor[5]} ${txt[266]} ${cor[3]}"
echo -e " 1-realData"
echo -e " 2-netData"
echo -e " 3-raw"
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
read -p " => " valor4
case $valor4 in
1)in="realData";;
2)in="netData";;
3)in="raw";;
*)in="netData";;
esac
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
name=$(echo $valor1 | awk -F "/" '{print $2'})
if [ "$name" = "" ]; then
name=$(echo $valor1 | awk -F "/" '{print $1'})
fi
esquelet="/etc/adm-lite/payloads"
sed -s "s;realData;abc;g" $esquelet > $HOME/$name.txt
sed -i "s;netData;abc;g" $HOME/$name.txt
sed -i "s;raw;abc;g" $HOME/$name.txt
sed -i "s;abc;$in;g" $HOME/$name.txt
sed -i "s;get;$req;g" $HOME/$name.txt
sed -i "s;mhost;$valor1;g" $HOME/$name.txt
sed -i "s;mip;$valor2;g" $HOME/$name.txt
if [ "$(cat $HOME/$name.txt | egrep -o "$valor1")" = "" ]; then
echo -e ""
echo -e "${cor[3]} ${txt[267]} \033[1;36m${txt[268]}"
rm $HOME/$name.txt
return
fi
echo -e "${cor[3]} ${txt[269]}"
echo -e "${cor[3]} ${txt[270]} \033[1;31m$HOME/$name.txt"
return
}

fun_bar () {
comando="$1"
 (
[[ -e $HOME/fim ]] && rm $HOME/fim
$comando -y > /dev/null 2>&1
touch $HOME/fim
 ) & > /dev/null
echo -ne "\033[1;33m ["
while true; do
   for((i=0; i<=10; i++)); do
   echo -ne "\033[1;31m#"
   sleep 0.3s
   done
   [[ -e $HOME/fim ]] && {
   rm $HOME/fim
   break
   }
   echo
   echo -ne "\033[1;33m ["
done
echo -e "\033[1;33m]\033[1;31m -\033[1;32m 100%\033[1;37m"
}

vnc_fun () {
clear
toolmaster
}

block_torrent () {
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_ip () {
MEU_IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
[[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" || IP="$MEU_IP"
}
barra="${cor[1]} =================================== ${cor[0]}"
[[ -e /etc/adm-lite/idioma_menuinst ]] && id="$(cat /etc/adm-lite/idioma_menuinst)" || id=pt
[[ $(iptables -h|wc -l) -lt 5 ]] && apt-get install iptables -y > /dev/null 2>-1
NIC=$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)
echo -e "$barra\n $(source trans -b pt:${id} "Estas configuraciones van a ser adicionadas")"
echo -e " $(source trans -b pt:${id} "Recuerda, Tener tu VPS Totalmente Configurada!")\n$barra"
echo -e " $(source trans -b pt:${id} "Deseas Continuar?")"
read -p " [S/N]: " -e -i n PROS
[[ $PROS = @(s|S|y|Y) ]] || return 1
fun_ip #Pega IP e armazena em uma variavel
#Inicia Procedimentos
#Parametros iniciais
echo 'iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT' > ./torrent-adm
chmod +x ./torrent-adm
#libera DNS
echo 'iptables -A OUTPUT -p tcp --dport 53 -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p udp --dport 53 -m state --state NEW -j ACCEPT' >> ./torrent-adm
#Liberar DHCP
echo 'iptables -A OUTPUT -p tcp --dport 67 -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p udp --dport 67 -m state --state NEW -j ACCEPT' >> ./torrent-adm
#Liberando Serviços Ativos
list_ips=$(mportas|awk '{print $2}')
while read PORT; do
echo "iptables -A INPUT -p tcp --dport $PORT -j ACCEPT
iptables -A INPUT -p udp --dport $PORT -j ACCEPT
iptables -A OUTPUT -p tcp --dport $PORT -j ACCEPT
iptables -A OUTPUT -p udp --dport $PORT -j ACCEPT
iptables -A FORWARD -p tcp --dport $PORT -j ACCEPT
iptables -A FORWARD -p udp --dport $PORT -j ACCEPT
iptables -A OUTPUT -p tcp -d $IP --dport $PORT -m state --state NEW -j ACCEPT
iptables -A OUTPUT -p udp -d $IP --dport $PORT -m state --state NEW -j ACCEPT" >> ./torrent-adm
done <<< "$list_ips"
#Bloqueando Ping
echo 'iptables -A INPUT -p icmp --icmp-type echo-request -j DROP' >> ./torrent-adm
#Liberar WEBMIN
echo 'iptables -A INPUT -p tcp --dport 10000 -j ACCEPT
iptables -A OUTPUT -p tcp --dport 10000 -j ACCEPT' >> ./torrent-adm
#Bloqueando torrent
echo "iptables -t nat -A PREROUTING -i $NIC -p tcp --dport 6881:6889 -j DNAT --to-dest $IP
iptables -A FORWARD -p tcp -i $NIC --dport 6881:6889 -d $IP -j REJECT
iptables -A OUTPUT -p tcp --dport 6881:6889 -j DROP
iptables -A OUTPUT -p udp --dport 6881:6889 -j DROP" >> ./torrent-adm
echo 'iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP
iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
iptables -A FORWARD -m string --algo bm --string "torrent" -j DROP
iptables -A FORWARD -m string --algo bm --string "announce" -j DROP
iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP
iptables -A FORWARD -m string --string "get_peers" --algo bm -j DROP
iptables -A FORWARD -m string --string "announce_peer" --algo bm -j DROP
iptables -A FORWARD -m string --string "find_node" --algo bm -j DROP' >> ./torrent-adm
./torrent-adm
echo -e "$barra\n $(source trans -b pt:${id} "Aplicado!")\n$barra"
}

paybrute () {
chmod +x ./paysnd.sh
./paysnd.sh
}

function_16 () {
tmp_arq="/tmp/arq-tmp"
if [ -d "/etc/squid" ]; then
pwd="/etc/squid/passwd"
config_="/etc/squid/squid.conf"
service_="squid"
squid_="0"
elif [ -d "/etc/squid3" ]; then
pwd="/etc/squid3/passwd"
config_="/etc/squid3/squid.conf"
service_="squid3"
squid_="1"
fi
[[ ! -e $config_ ]] && 
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}" && 
echo -e " \033[1;36m${txt[326]}" && 
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}" && 
return 0
if [ -e $pwd ]; then 
echo -e "${cor[3]} "${txt[330]}""
read -p " [S/N]: " -e -i n sshsn
[[ "$sshsn" = @(s|S|y|Y) ]] && {
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " \033[1;36mUninstalling DEPENDENCE:"
fun_bar 'apt-get remove apache2-utils'
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
cat $config_ | grep -v '#Password' > $tmp_arq
mv -f $tmp_arq $config_ 
cat $config_ | grep -v '^auth_param.*passwd*$' > $tmp_arq
mv -f $tmp_arq $config_ 
cat $config_ | grep -v '^auth_param.*proxy*$' > $tmp_arq
mv -f $tmp_arq $config_ 
cat $config_ | grep -v '^acl.*REQUIRED*$' > $tmp_arq
mv -f $tmp_arq $config_ 
cat $config_ | grep -v '^http_access.*authenticated*$' > $tmp_arq
mv -f $tmp_arq $config_ 
cat $config_ | grep -v '^http_access.*all*$' > $tmp_arq
mv -f $tmp_arq $config_ 
echo -e "
http_access allow all" >> "$config_"
rm -f $pwd
service $service_ restart  > /dev/null 2>&1 &
echo -e " \033[1;31m${txt[327]}"
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
} 
else
echo -e "${cor[3]} "${txt[329]}""
read -p " [S/N]: " -e -i n sshsn
[[ "$sshsn" = @(s|S|y|Y) ]] && {
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " \033[1;36mInstalling DEPENDENCE:"
fun_bar 'apt-get install apache2-utils'
msg -bar #echo -e "${cor[1]} =================================== ${cor[3]}"
read -e -p " Your desired username: " usrn
[[ $usrn = "" ]] && 
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}" && 
echo -e " \033[1;31m${txt[328]}" && 
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}" && 
return 0
htpasswd -c $pwd $usrn
succes_=$(grep -c "$usrn" $pwd)
if [ "$succes_" = "0" ]; then
rm -f $pwd
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " \033[1;31m${txt[324]}"
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
return 0
elif [[ "$succes_" = "1" ]]; then
cat $config_ | grep -v '^http_access.*all*$' > $tmp_arq
mv -f $tmp_arq $config_ 
if [ "$squid_" = "0" ]; then
echo -e "#Password
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwd
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all" >> "$config_"
service squid restart  > /dev/null 2>&1 &
update-rc.d squid defaults > /dev/null 2>&1 &
elif [ "$squid_" = "1" ]; then
echo -e "#Password
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwd
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_access deny all" >> "$config_"
service squid3 restart > /dev/null 2>&1 &
update-rc.d squid3 defaults > /dev/null 2>&1 &
fi
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e " \033[1;32m${txt[325]}"
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
fi
}
fi
}

function_17 () {
echo -e "${cor[3]} "${txt[333]}""
read -p " [S/N]: " -e -i n sshsn
[[ "$sshsn" = @(s|S|y|Y) ]] && {
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "\033[1;36m ${txt[334]}"
sleep 3s
msg -bar #echo -e "${cor[1]} =================================== ${cor[0]}"
echo -e "\033[1;36m OK"
sleep 1s
sudo reboot
} 
}

ofuscarte_fun () {
_cont=1
#[[ ! -e /usr/local/bin/shc ]] && 
bash <(wget -qO- https://www.dropbox.com/s/9gror9872zlqjle/ofuscar.sh) || echo -e "SHC Instalado"
echo -e "${cor[5]} ${txt[181]} /root/"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
for my_arqs in `ls $HOME`; do
if [ ! -d "$my_arqs" ]; then
select_arc[$_cont]="$my_arqs"
echo -e "${cor[2]} |$_cont| >${cor[3]}$my_arqs"
_cont=$(($_cont + 1))
fi
done
_cont=$(($_cont - 1))
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} Escoje nombre o numero del fichero a Ofuscar : "
read -p " | 1 - $_cont |: " slct
number_var $slct
if [ "$var_number" = "" ]; then
return
 else
slct="$var_number"
fi
unset _cont
arquivo_move="${select_arc[$slct]}"
if [ "$arquivo_move" = "" ]; then
echo -e "${cor[5]} ${txt[178]}"
msg -bar #echo -e "${cor[1]} ====================================================== ${cor[0]}"
return
else 
echo -e " Archivo $arquivo_move seleccionado "
fi
unset ssnn
#read -p "Escoje nombre del fichero a Ofuscar : " namefichero
shc -rvf "$arquivo_move" && "EXITO AL OFUSCAR" || echo "Error al OFUSCAR"
echo -e "El fichero Ofuscado es $HOME/$arquivo_move.x"
[[ -e $arquivo_move.x ]] && chmod +x "$HOME/$arquivo_move.x" || echo "ERROT AL OFUSCAR"
read -p " Deseas cargar Fichero Online [s/n] : " ssnn
[[ "$ssnn" = @(s|S|y|Y) ]] && { 
[[ ! -d /var/www/html/ofus ]] && mkdir /var/www/html/ofus
[[ -e "$arquivo_move.x" ]] && mv $arquivo_move.x /var/www/html/ofus/$arquivo_move
msg -bar 
#echo -e "${cor[1]} ====================================================== ${cor[0]}"
echo -e "${cor[5]} ${txt[180]}"
echo -e "\033[1;36m http://$(wget -qO- ifconfig.me):81/ofus/$arquivo_move.sh\033[0m"
echo -e "${cor[5]} ${txt[179]}"
}
}


############################


[[ "$1" = "1" ]] && function_1
[[ "$1" = "2" ]] && function_2
[[ "$1" = "3" ]] && function_3
[[ "$1" = "4" ]] && function_3
[[ "$1" = "5" ]] && function_5
[[ "$1" = "6" ]] && function_6
[[ "$1" = "7" ]] && function_7
[[ "$1" = "8" ]] && function_8
[[ "$1" = "9" ]] && function_9
[[ "$1" = "10" ]] && function_10
[[ "$1" = "11" ]] && function_11
[[ "$1" = "12" ]] && criar_pay
[[ "$1" = "13" ]] && vnc_fun
[[ "$1" = "14" ]] && paybrute
[[ "$1" = "15" ]] && block_torrent
[[ "$1" = "16" ]] && function_16
[[ "$1" = "17" ]] && function_17
