1
0

install-Of.sh 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. #!/bin/bash
  2. module="$(pwd)/module"
  3. rm -rf ${module}
  4. wget -O ${module} "https://raw.githubusercontent.com/rudi9999/Herramientas/main/module/module" &>/dev/null
  5. [[ ! -e ${module} ]] && exit
  6. chmod +x ${module} &>/dev/null
  7. source ${module}
  8. CTRL_C(){
  9. rm -rf ${module}; exit
  10. }
  11. trap "CTRL_C" INT TERM EXIT
  12. ADMRufu="/etc/ADMRufu" && [[ ! -d ${ADMRufu} ]] && mkdir ${ADMRufu}
  13. ADM_inst="${ADMRufu}/install" && [[ ! -d ${ADM_inst} ]] && mkdir ${ADM_inst}
  14. SCPinstal="$HOME/install"
  15. rm -rf /etc/localtime &>/dev/null
  16. ln -s /usr/share/zoneinfo/America/Argentina/Tucuman /etc/localtime &>/dev/null
  17. rm $(pwd)/$0 &> /dev/null
  18. stop_install(){
  19. title "INSTALACION CANCELADA"
  20. exit
  21. }
  22. time_reboot(){
  23. print_center -ama "REINICIANDO VPS EN $1 SEGUNDOS"
  24. REBOOT_TIMEOUT="$1"
  25. while [ $REBOOT_TIMEOUT -gt 0 ]; do
  26. print_center -ne "-$REBOOT_TIMEOUT-\r"
  27. sleep 1
  28. : $((REBOOT_TIMEOUT--))
  29. done
  30. reboot
  31. }
  32. os_system(){
  33. system=$(cat -n /etc/issue |grep 1 |cut -d ' ' -f6,7,8 |sed 's/1//' |sed 's/ //')
  34. distro=$(echo "$system"|awk '{print $1}')
  35. case $distro in
  36. Debian)vercion=$(echo $system|awk '{print $3}'|cut -d '.' -f1);;
  37. Ubuntu)vercion=$(echo $system|awk '{print $2}'|cut -d '.' -f1,2);;
  38. esac
  39. }
  40. repo(){
  41. link="https://raw.githubusercontent.com/rudi9999/ADMRufu/main/Repositorios/$1.list"
  42. case $1 in
  43. 8|9|10|11|16.04|18.04|20.04|20.10|21.04|21.10|22.04)wget -O /etc/apt/sources.list ${link} &>/dev/null;;
  44. esac
  45. }
  46. dependencias(){
  47. soft="sudo bsdmainutils zip unzip ufw curl python python3 python3-pip openssl screen cron iptables lsof nano at mlocate gawk grep bc jq curl npm nodejs socat netcat netcat-traditional net-tools cowsay figlet lolcat"
  48. for i in $soft; do
  49. leng="${#i}"
  50. puntos=$(( 21 - $leng))
  51. pts="."
  52. for (( a = 0; a < $puntos; a++ )); do
  53. pts+="."
  54. done
  55. msg -nazu " instalando $i$(msg -ama "$pts")"
  56. if apt install $i -y &>/dev/null ; then
  57. msg -verd "INSTALL"
  58. else
  59. msg -verm2 "FAIL"
  60. sleep 2
  61. tput cuu1 && tput dl1
  62. print_center -ama "aplicando fix a $i"
  63. dpkg --configure -a &>/dev/null
  64. sleep 2
  65. tput cuu1 && tput dl1
  66. msg -nazu " instalando $i$(msg -ama "$pts")"
  67. if apt install $i -y &>/dev/null ; then
  68. msg -verd "INSTALL"
  69. else
  70. msg -verm2 "FAIL"
  71. fi
  72. fi
  73. done
  74. }
  75. ofus () {
  76. unset server
  77. server=$(echo ${txt_ofuscatw}|cut -d':' -f1)
  78. unset txtofus
  79. number=$(expr length $1)
  80. for((i=1; i<$number+1; i++)); do
  81. txt[$i]=$(echo "$1" | cut -b $i)
  82. case ${txt[$i]} in
  83. ".")txt[$i]="*";;
  84. "*")txt[$i]=".";;
  85. "_")txt[$i]="@";;
  86. "@")txt[$i]="_";;
  87. #"1")txt[$i]="@";;
  88. #"@")txt[$i]="1";;
  89. #"2")txt[$i]="?";;
  90. #"?")txt[$i]="2";;
  91. #"4")txt[$i]="%";;
  92. #"%")txt[$i]="4";;
  93. "-")txt[$i]="K";;
  94. "K")txt[$i]="-";;
  95. "1")txt[$i]="f";;
  96. "2")txt[$i]="e";;
  97. "3")txt[$i]="d";;
  98. "4")txt[$i]="c";;
  99. "5")txt[$i]="b";;
  100. "6")txt[$i]="a";;
  101. "7")txt[$i]="9";;
  102. "8")txt[$i]="8";;
  103. "9")txt[$i]="7";;
  104. "a")txt[$i]="6";;
  105. "b")txt[$i]="5";;
  106. "c")txt[$i]="4";;
  107. "d")txt[$i]="3";;
  108. "e")txt[$i]="2";;
  109. "f")txt[$i]="1";;
  110. esac
  111. txtofus+="${txt[$i]}"
  112. done
  113. echo "$txtofus" | rev
  114. }
  115. function_verify () {
  116. permited=$(curl -sSL "https://raw.githubusercontent.com/rudi9999/Control/master/Control-IP")
  117. [[ $(echo $permited|grep "${IP}") = "" ]] && {
  118. clear
  119. msg -bar
  120. print_center -verm2 "¡LA IP $(wget -qO- ipv4.icanhazip.com) NO ESTA AUTORIZADA!"
  121. print_center -ama "CONTACTE A @Rufu99"
  122. msg -bar
  123. rm ${ADMRufu}
  124. [[ -e $HOME/lista-arq ]] && rm $HOME/lista-arq
  125. exit
  126. } || {
  127. ### INTALAR VERCION DE SCRIPT
  128. ver=$(curl -sSL "https://raw.githubusercontent.com/rudi9999/ADMRufu/main/vercion")
  129. echo "$ver" > ${ADMRufu}/vercion
  130. }
  131. }
  132. fun_ip(){
  133. 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)
  134. MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
  135. [[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" || IP="$MEU_IP"
  136. }
  137. verificar_arq(){
  138. unset ARQ
  139. case $1 in
  140. menu|menu_inst.sh|tool_extras.sh|chekup.sh)ARQ="${ADMRufu}";;
  141. *)ARQ="${ADM_inst}";;
  142. esac
  143. mv -f ${SCPinstal}/$1 ${ARQ}/$1
  144. chmod +x ${ARQ}/$1
  145. }
  146. error_fun(){
  147. msg -bar3
  148. print_center -verm "ERROR de enlace VPS<-->GENERADOR"
  149. msg -bar3
  150. [[ -d ${SCPinstal} ]] && rm -rf ${SCPinstal}
  151. exit
  152. }
  153. post_reboot(){
  154. echo 'wget -O /root/install.sh "https://raw.githubusercontent.com/rudi9999/ADMRufu/main/install.sh"; clear; sleep 2; chmod +x /root/install.sh; /root/install.sh --continue' >> /root/.bashrc
  155. title "INSTALADOR ADMRufu"
  156. print_center -ama "La instalacion continuara\ndespues del reinicio!!!"
  157. msg -bar
  158. }
  159. install_start(){
  160. title "INSTALADOR ADMRufu"
  161. print_center -ama "A continuacion se actualizaran los paquetes\ndel systema. Esto podria tomar tiempo,\ny requerir algunas preguntas\npropias de las actualizaciones."
  162. msg -bar3
  163. msg -ne " Desea continuar? [S/N]: "
  164. read opcion
  165. [[ "$opcion" != @(s|S) ]] && stop_install
  166. title "INSTALADOR ADMRufu"
  167. os_system
  168. repo "${vercion}"
  169. apt update -y; apt upgrade -y
  170. }
  171. install_continue(){
  172. os_system
  173. title "INSTALADOR ADMRufu"
  174. print_center -ama "$distro $vercion"
  175. print_center -verd "INSTALANDO DEPENDENCIAS"
  176. msg -bar3
  177. dependencias
  178. msg -bar3
  179. print_center -azu "Removiendo paquetes obsoletos"
  180. apt autoremove -y &>/dev/null
  181. sleep 2
  182. tput cuu1 && tput dl1
  183. print_center -ama "si algunas de las dependencias falla!!!\nal terminar, puede intentar instalar\nla misma manualmente usando el siguiente comando\napt install nom_del_paquete"
  184. enter
  185. }
  186. while :
  187. do
  188. case $1 in
  189. -s|--start)install_start && post_reboot && time_reboot "15";;
  190. -c|--continue)rm /root/install.sh &> /dev/null
  191. sed -i '/Rufu/d' /root/.bashrc
  192. install_continue
  193. break;;
  194. -u|--update)install_start
  195. install_continue
  196. break;;
  197. *)exit;;
  198. esac
  199. done
  200. title "INSTALADOR ADMRufu"
  201. fun_ip
  202. while [[ ! $Key ]]; do
  203. echo -e " $(msg -verm3 "╭╼╼╼╼╼╼╼╼╼╼╼╼╼╼╼╼[")$(msg -azu "INGRESA TU KEY")$(msg -verm3 "]")"
  204. echo -ne " $(msg -verm3 "╰╼")\033[37;1m>\e[32m\e[1m "
  205. read Key
  206. done
  207. msg -bar3
  208. msg -ne " Verificando Key: "
  209. cd $HOME
  210. wget -O $HOME/lista-arq $(ofus "$Key")/$IP > /dev/null 2>&1 && msg -verd "Key Completa" || {
  211. msg -verm2 "Key Invalida"
  212. msg -bar
  213. [[ -e $HOME/lista-arq ]] && rm $HOME/lista-arq
  214. exit
  215. }
  216. msg -bar3
  217. IP=$(ofus "$Key" | 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}') && echo "$IP" > /usr/bin/vendor_code
  218. sleep 1s
  219. function_verify
  220. if [[ -e $HOME/lista-arq ]] && [[ ! $(cat $HOME/lista-arq|grep "KEY INVALIDA!") ]]; then
  221. msg -verd " INSTALANDO SCRIPT ADMRufu... $(msg -ama "[Proyect by @Rufu99]")"
  222. REQUEST=$(ofus "$Key"|cut -d'/' -f2)
  223. [[ ! -d ${SCPinstal} ]] && mkdir ${SCPinstal}
  224. msg -nama "Descarga de archivos... "
  225. for arqx in $(cat $HOME/lista-arq); do
  226. wget --no-check-certificate -O ${SCPinstal}/${arqx} ${IP}:81/${REQUEST}/${arqx} > /dev/null 2>&1 && {
  227. verificar_arq "${arqx}"
  228. } || {
  229. msg -verm2 "fallida!!!"
  230. sleep 2s
  231. error_fun
  232. }
  233. done
  234. msg -verd "completa!!!"
  235. sleep 2s
  236. rm $HOME/lista-arq
  237. [[ -d ${SCPinstal} ]] && rm -rf ${SCPinstal}
  238. rm -rf /usr/bin/menu
  239. rm -rf /usr/bin/adm
  240. rm -rf /usr/bin/ADMRufu
  241. echo "${ADMRufu}/menu" > /usr/bin/menu && chmod +x /usr/bin/menu
  242. echo "${ADMRufu}/menu" > /usr/bin/adm && chmod +x /usr/bin/adm
  243. echo "${ADMRufu}/menu" > /usr/bin/ADMRufu && chmod +x /usr/bin/ADMRufu
  244. sed -i '/Rufu/d' /root/bash.bashrc
  245. [[ -z $(echo $PATH|grep "/usr/games") ]] && echo 'if [[ $(echo $PATH|grep "/usr/games") = "" ]]; then PATH=$PATH:/usr/games; fi' >> /etc/bash.bashrc
  246. echo '[[ $UID = 0 ]] && screen -dmS up /etc/ADMRufu/chekup.sh' >> /etc/bash.bashrc
  247. echo 'v=$(cat /etc/ADMRufu/vercion)' >> /etc/bash.bashrc
  248. echo '[[ -e /etc/ADMRufu/new_vercion ]] && up=$(cat /etc/ADMRufu/new_vercion) || up=$v' >> /etc/bash.bashrc
  249. echo -e "[[ \$(date '+%s' -d \$up) -gt \$(date '+%s' -d \$(cat /etc/ADMRufu/vercion)) ]] && v2=\"Nueva Vercion disponible: \$v >>> \$up\" || v2=\"Script Vercion: \$v\"" >> /etc/bash.bashrc
  250. echo '[[ -e "/etc/ADMRufu/tmp/message.txt" ]] && mess1="$(less /etc/ADMRufu/tmp/message.txt)"' >> /etc/bash.bashrc
  251. echo '[[ -z "$mess1" ]] && mess1="@Rufu99"' >> /etc/bash.bashrc
  252. echo 'clear && echo -e "\n$(figlet -f big.flf " ADMRufu")\n RESELLER : $mess1 \n\n Para iniciar ADMRufu escriba: menu \n\n $v2\n\n"|lolcat' >> /etc/bash.bashrc
  253. update-locale LANG=en_US.UTF-8 LANGUAGE=en
  254. clear
  255. title "-- ADMRufu INSTALADO --"
  256. else
  257. [[ -e $HOME/lista-arq ]] && rm $HOME/lista-arq
  258. clear
  259. msg -bar
  260. print_center -verm2 "KEY INVALIDA"
  261. msg -bar
  262. print_center -ama "Esta key no es valida o ya fue usada"
  263. print_center -ama "Contacta con @Rufu99"
  264. msg -bar
  265. rm -rf ${module}
  266. exit
  267. fi
  268. mv -f ${module} /etc/ADMRufu/module
  269. time_reboot "10"