v2ray.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. #!/bin/bash
  2. #25/01/2021 by @Kalix1
  3. clear
  4. clear
  5. SCPdir="/etc/VPS-MX"
  6. SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]] && exit
  7. SCPinst="${SCPdir}/protocolos"&& [[ ! -d ${SCPinst} ]] && exit
  8. declare -A cor=( [0]="\033[1;37m" [1]="\033[1;34m" [2]="\033[1;31m" [3]="\033[1;33m" [4]="\033[1;32m" )
  9. err_fun () {
  10. case $1 in
  11. 1)msg -verm "$(fun_trans "Usuario Nulo")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  12. 2)msg -verm "$(fun_trans "Nombre muy corto (MIN: 2 CARACTERES)")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  13. 3)msg -verm "$(fun_trans "Nombre muy grande (MAX: 5 CARACTERES)")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  14. 4)msg -verm "$(fun_trans "Contraseña Nula")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  15. 5)msg -verm "$(fun_trans "Contraseña muy corta")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  16. 6)msg -verm "$(fun_trans "Contraseña muy grande")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  17. 7)msg -verm "$(fun_trans "Duracion Nula")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  18. 8)msg -verm "$(fun_trans "Duracion invalida utilize numeros")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  19. 9)msg -verm "$(fun_trans "Duracion maxima y de un año")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  20. 11)msg -verm "$(fun_trans "Limite Nulo")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  21. 12)msg -verm "$(fun_trans "Limite invalido utilize numeros")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  22. 13)msg -verm "$(fun_trans "Limite maximo de 999")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  23. 14)msg -verm "$(fun_trans "Usuario Ya Existe")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  24. 15)msg -verm "$(fun_trans "(Solo numeros) GB = Min: 1gb Max: 1000gb")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  25. 16)msg -verm "$(fun_trans "(Solo numeros)")"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  26. 17)msg -verm "$(fun_trans "(Sin Informacion - Para Cancelar Digite CRTL + C)")"; sleep 4s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  27. esac
  28. }
  29. intallv2ray () {
  30. apt install python3-pip -y
  31. source <(curl -sL https://multi.netlify.app/v2ray.sh)
  32. ## Correccion Mail
  33. mailfix=$(cat /dev/urandom | tr -dc '[:alnum:]' | head -c 10)
  34. curl https://get.acme.sh | sh -s email=$mailfix@gmail.com
  35. #
  36. msg -ama "$(fun_trans "Intalado con Exito")!"
  37. USRdatabase="/etc/VPS-MX/RegV2ray"
  38. [[ ! -e ${USRdatabase} ]] && touch ${USRdatabase}
  39. sort ${USRdatabase} | uniq > ${USRdatabase}tmp
  40. mv -f ${USRdatabase}tmp ${USRdatabase}
  41. msg -bar
  42. msg -ne "Enter Para Continuar" && read enter
  43. ${SCPinst}/v2ray.sh
  44. }
  45. protocolv2ray () {
  46. msg -ama "$(fun_trans "Escojer opcion 3 y poner el dominio de nuestra IP")!"
  47. msg -bar
  48. v2ray stream
  49. msg -bar
  50. msg -ne "Enter Para Continuar" && read enter
  51. ${SCPinst}/v2ray.sh
  52. }
  53. dirapache="/usr/local/lib/ubuntn/apache/ver" && [[ ! -d ${dirapache} ]] && exit
  54. tls () {
  55. msg -ama "$(fun_trans "Activar o Desactivar TLS")!"
  56. msg -bar
  57. v2ray tls
  58. msg -bar
  59. msg -ne "Enter Para Continuar" && read enter
  60. ${SCPinst}/v2ray.sh
  61. }
  62. portv () {
  63. msg -ama "$(fun_trans "Cambiar Puerto v2ray")!"
  64. msg -bar
  65. v2ray port
  66. msg -bar
  67. msg -ne "Enter Para Continuar" && read enter
  68. ${SCPinst}/v2ray.sh
  69. }
  70. stats () {
  71. msg -ama "$(fun_trans "Estadisticas de Consumo")!"
  72. msg -bar
  73. v2ray stats
  74. msg -bar
  75. msg -ne "Enter Para Continuar" && read enter
  76. ${SCPinst}/v2ray.sh
  77. }
  78. unistallv2 () {
  79. source <(curl -sL https://multi.netlify.app/v2ray.sh) --remove > /dev/null 2>&1
  80. rm -rf /etc/VPS-MX/RegV2ray > /dev/null 2>&1
  81. echo -e "\033[1;92m V2RAY REMOVIDO OK "
  82. msg -bar
  83. msg -ne "Enter Para Continuar" && read enter
  84. ${SCPinst}/v2ray.sh
  85. }
  86. infocuenta () {
  87. v2ray info
  88. msg -bar
  89. msg -ne "Enter Para Continuar" && read enter
  90. ${SCPinst}/v2ray.sh
  91. }
  92. addusr () {
  93. clear
  94. clear
  95. msg -bar
  96. msg -tit
  97. msg -ama " AGREGAR USUARIO | UUID V2RAY"
  98. msg -bar
  99. ##DAIS
  100. valid=$(date '+%C%y-%m-%d' -d " +31 days")
  101. ##CORREO
  102. MAILITO=$(cat /dev/urandom | tr -dc '[:alnum:]' | head -c 10)
  103. ##ADDUSERV2RAY
  104. UUID=`uuidgen`
  105. sed -i '13i\ \{' /etc/v2ray/config.json
  106. sed -i '14i\ \"alterId": 0,' /etc/v2ray/config.json
  107. sed -i '15i\ \"id": "'$UUID'",' /etc/v2ray/config.json
  108. sed -i '16i\ \"email": "'$MAILITO'@gmail.com"' /etc/v2ray/config.json
  109. sed -i '17i\ \},' /etc/v2ray/config.json
  110. echo ""
  111. while true; do
  112. echo -ne "\e[91m >> Digita un Nombre: \033[1;92m"
  113. read -p ": " nick
  114. nick="$(echo $nick|sed -e 's/[^a-z0-9 -]//ig')"
  115. if [[ -z $nick ]]; then
  116. err_fun 17 && continue
  117. elif [[ "${#nick}" -lt "2" ]]; then
  118. err_fun 2 && continue
  119. elif [[ "${#nick}" -gt "5" ]]; then
  120. err_fun 3 && continue
  121. fi
  122. break
  123. done
  124. echo -e "\e[91m >> Agregado UUID: \e[92m$UUID "
  125. while true; do
  126. echo -ne "\e[91m >> Duracion de UUID (Dias):\033[1;92m " && read diasuser
  127. if [[ -z "$diasuser" ]]; then
  128. err_fun 17 && continue
  129. elif [[ "$diasuser" != +([0-9]) ]]; then
  130. err_fun 8 && continue
  131. elif [[ "$diasuser" -gt "360" ]]; then
  132. err_fun 9 && continue
  133. fi
  134. break
  135. done
  136. #Lim
  137. [[ $(cat /etc/passwd |grep $1: |grep -vi [a-z]$1 |grep -v [0-9]$1 > /dev/null) ]] && return 1
  138. valid=$(date '+%C%y-%m-%d' -d " +$diasuser days") && datexp=$(date "+%F" -d " + $diasuser days")
  139. echo -e "\e[91m >> Expira el : \e[92m$datexp "
  140. ##Registro
  141. echo " $UUID | $nick | $valid " >> /etc/VPS-MX/RegV2ray
  142. Fecha=`date +%d-%m-%y-%R`
  143. cp /etc/VPS-MX/RegV2ray /etc/VPS-MX/v2ray/RegV2ray-"$Fecha"
  144. cp /etc/v2ray/config.json /etc/VPS-MX/v2ray/config.json-"$Fecha"
  145. v2ray restart > /dev/null 2>&1
  146. echo ""
  147. v2ray info > /etc/VPS-MX/v2ray/confuuid.log
  148. lineP=$(sed -n '/'${UUID}'/=' /etc/VPS-MX/v2ray/confuuid.log)
  149. numl1=4
  150. let suma=$lineP+$numl1
  151. sed -n ${suma}p /etc/VPS-MX/v2ray/confuuid.log
  152. echo ""
  153. msg -bar
  154. echo -e "\e[92m UUID AGREGEGADO CON EXITO "
  155. msg -bar
  156. msg -ne "Enter Para Continuar" && read enter
  157. ${SCPinst}/v2ray.sh
  158. }
  159. delusr () {
  160. clear
  161. clear
  162. invaliduuid () {
  163. msg -bar
  164. echo -e "\e[91m UUID INVALIDO \n$(msg -bar)"
  165. msg -ne "Enter Para Continuar" && read enter
  166. ${SCPinst}/v2ray.sh
  167. }
  168. msg -bar
  169. msg -tit
  170. msg -ama " ELIMINAR USUARIO | UUID V2RAY"
  171. msg -bar
  172. echo -e "\e[97m USUARIOS REGISTRADOS"
  173. echo -e "\e[33m$(cat /etc/VPS-MX/RegV2ray|cut -d '|' -f2,1)"
  174. msg -bar
  175. echo -ne "\e[91m >> Digita el UUID a elininar:\n \033[1;92m " && read uuidel
  176. [[ $(sed -n '/'${uuidel}'/=' /etc/v2ray/config.json|head -1) ]] || invaliduuid
  177. lineP=$(sed -n '/'${uuidel}'/=' /etc/v2ray/config.json)
  178. linePre=$(sed -n '/'${uuidel}'/=' /etc/VPS-MX/RegV2ray)
  179. sed -i "${linePre}d" /etc/VPS-MX/RegV2ray
  180. numl1=2
  181. let resta=$lineP-$numl1
  182. sed -i "${resta}d" /etc/v2ray/config.json
  183. sed -i "${resta}d" /etc/v2ray/config.json
  184. sed -i "${resta}d" /etc/v2ray/config.json
  185. sed -i "${resta}d" /etc/v2ray/config.json
  186. sed -i "${resta}d" /etc/v2ray/config.json
  187. v2ray restart > /dev/null 2>&1
  188. msg -bar
  189. msg -ne "Enter Para Continuar" && read enter
  190. ${SCPinst}/v2ray.sh
  191. }
  192. mosusr_kk() {
  193. clear
  194. clear
  195. msg -bar
  196. msg -tit
  197. msg -ama " USUARIOS REGISTRADOS | UUID V2RAY"
  198. msg -bar
  199. # usersss=$(cat /etc/VPS-MX/RegV2ray|cut -d '|' -f1)
  200. # cat /etc/VPS-MX/RegV2ray|cut -d'|' -f3
  201. VPSsec=$(date +%s)
  202. local HOST="/etc/VPS-MX/RegV2ray"
  203. local HOST2="/etc/VPS-MX/RegV2ray"
  204. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  205. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  206. if [[ -z $RETURN ]]; then
  207. echo -e "----- NINGUN USER REGISTRADO -----"
  208. msg -ne "Enter Para Continuar" && read enter
  209. ${SCPinst}/v2ray.sh
  210. else
  211. i=1
  212. echo -e "\e[97m UUID | USER | EXPIRACION \e[93m"
  213. msg -bar
  214. while read hostreturn ; do
  215. DateExp="$(cat /etc/VPS-MX/RegV2ray|grep -w "$hostreturn"|cut -d'|' -f3)"
  216. if [[ ! -z $DateExp ]]; then
  217. DataSec=$(date +%s --date="$DateExp")
  218. [[ "$VPSsec" -gt "$DataSec" ]] && EXPTIME="\e[91m[EXPIRADO]\e[97m" || EXPTIME="\e[92m[$(($(($DataSec - $VPSsec)) / 86400))]\e[97m Dias"
  219. else
  220. EXPTIME="\e[91m[ S/R ]"
  221. fi
  222. usris="$(cat /etc/VPS-MX/RegV2ray|grep -w "$hostreturn"|cut -d'|' -f2)"
  223. local contador_secuencial+="\e[93m$hostreturn \e[97m|\e[93m$usris\e[97m|\e[93m $EXPTIME \n"
  224. if [[ $i -gt 30 ]]; then
  225. echo -e "$contador_secuencial"
  226. unset contador_secuencial
  227. unset i
  228. fi
  229. let i++
  230. done <<< "$IDEUUID"
  231. [[ ! -z $contador_secuencial ]] && {
  232. linesss=$(cat /etc/VPS-MX/RegV2ray | wc -l)
  233. echo -e "$contador_secuencial \n Numero de Registrados: $linesss"
  234. }
  235. fi
  236. msg -bar
  237. msg -ne "Enter Para Continuar" && read enter
  238. ${SCPinst}/v2ray.sh
  239. }
  240. lim_port () {
  241. clear
  242. clear
  243. msg -bar
  244. msg -tit
  245. msg -ama " LIMITAR MB X PORT | UUID V2RAY"
  246. msg -bar
  247. ###VER
  248. estarts () {
  249. VPSsec=$(date +%s)
  250. local HOST="/etc/VPS-MX/v2ray/lisportt.log"
  251. local HOST2="/etc/VPS-MX/v2ray/lisportt.log"
  252. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  253. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  254. if [[ -z $RETURN ]]; then
  255. echo -e "----- NINGUN PUERTO REGISTRADO -----"
  256. msg -ne "Enter Para Continuar" && read enter
  257. ${SCPinst}/v2ray.sh
  258. else
  259. i=1
  260. while read hostreturn ; do
  261. iptables -n -v -L > /etc/VPS-MX/v2ray/data1.log
  262. statsss=$(cat /etc/VPS-MX/v2ray/data1.log|grep -w "tcp spt:$hostreturn quota:"|cut -d' ' -f3,4,5)
  263. gblim=$(cat /etc/VPS-MX/v2ray/lisportt.log|grep -w "$hostreturn"|cut -d'|' -f2)
  264. local contador_secuencial+=" \e[97mPUERTO: \e[93m$hostreturn \e[97m|\e[93m$statsss \e[97m|\e[93m $gblim GB \n"
  265. if [[ $i -gt 30 ]]; then
  266. echo -e "$contador_secuencial"
  267. unset contador_secuencial
  268. unset i
  269. fi
  270. let i++
  271. done <<< "$IDEUUID"
  272. [[ ! -z $contador_secuencial ]] && {
  273. linesss=$(cat /etc/VPS-MX/v2ray/lisportt.log | wc -l)
  274. echo -e "$contador_secuencial \n Puertos Limitados: $linesss"
  275. }
  276. fi
  277. msg -bar
  278. msg -ne "Enter Para Continuar" && read enter
  279. ${SCPinst}/v2ray.sh
  280. }
  281. ###LIM
  282. liport () {
  283. while true; do
  284. echo -ne "\e[91m >> Digite Port a Limitar:\033[1;92m " && read portbg
  285. if [[ -z "$portbg" ]]; then
  286. err_fun 17 && continue
  287. elif [[ "$portbg" != +([0-9]) ]]; then
  288. err_fun 16 && continue
  289. elif [[ "$portbg" -gt "1000" ]]; then
  290. err_fun 16 && continue
  291. fi
  292. break
  293. done
  294. while true; do
  295. echo -ne "\e[91m >> Digite Cantidad de GB:\033[1;92m " && read capgb
  296. if [[ -z "$capgb" ]]; then
  297. err_fun 17 && continue
  298. elif [[ "$capgb" != +([0-9]) ]]; then
  299. err_fun 15 && continue
  300. elif [[ "$capgb" -gt "1000" ]]; then
  301. err_fun 15 && continue
  302. fi
  303. break
  304. done
  305. uml1=1073741824
  306. gbuser="$capgb"
  307. let multiplicacion=$uml1*$gbuser
  308. sudo iptables -I OUTPUT -p tcp --sport $portbg -j DROP
  309. sudo iptables -I OUTPUT -p tcp --sport $portbg -m quota --quota $multiplicacion -j ACCEPT
  310. iptables-save > /etc/iptables/rules.v4
  311. echo ""
  312. echo -e " Port Seleccionado: $portbg | Cantidad de GB: $gbuser"
  313. echo ""
  314. echo " $portbg | $gbuser | $multiplicacion " >> /etc/VPS-MX/v2ray/lisportt.log
  315. msg -bar
  316. msg -ne "Enter Para Continuar" && read enter
  317. ${SCPinst}/v2ray.sh
  318. }
  319. ###RES
  320. resdata () {
  321. VPSsec=$(date +%s)
  322. local HOST="/etc/VPS-MX/v2ray/lisportt.log"
  323. local HOST2="/etc/VPS-MX/v2ray/lisportt.log"
  324. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  325. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  326. if [[ -z $RETURN ]]; then
  327. echo -e "----- NINGUN PUERTO REGISTRADO -----"
  328. return 0
  329. else
  330. i=1
  331. while read hostreturn ; do
  332. iptables -n -v -L > /etc/VPS-MX/v2ray/data1.log
  333. statsss=$(cat /etc/VPS-MX/v2ray/data1.log|grep -w "tcp spt:$hostreturn quota:"|cut -d' ' -f3,4,5)
  334. gblim=$(cat /etc/VPS-MX/v2ray/lisportt.log|grep -w "$hostreturn"|cut -d'|' -f2)
  335. local contador_secuencial+=" \e[97mPUERTO: \e[93m$hostreturn \e[97m|\e[93m$statsss \e[97m|\e[93m $gblim GB \n"
  336. if [[ $i -gt 30 ]]; then
  337. echo -e "$contador_secuencial"
  338. unset contador_secuencial
  339. unset i
  340. fi
  341. let i++
  342. done <<< "$IDEUUID"
  343. [[ ! -z $contador_secuencial ]] && {
  344. linesss=$(cat /etc/VPS-MX/v2ray/lisportt.log | wc -l)
  345. echo -e "$contador_secuencial \n Puertos Limitados: $linesss"
  346. }
  347. fi
  348. msg -bar
  349. while true; do
  350. echo -ne "\e[91m >> Digite Puerto a Limpiar:\033[1;92m " && read portbg
  351. if [[ -z "$portbg" ]]; then
  352. err_fun 17 && continue
  353. elif [[ "$portbg" != +([0-9]) ]]; then
  354. err_fun 16 && continue
  355. elif [[ "$portbg" -gt "1000" ]]; then
  356. err_fun 16 && continue
  357. fi
  358. break
  359. done
  360. invaliduuid () {
  361. msg -bar
  362. echo -e "\e[91m PUERTO INVALIDO \n$(msg -bar)"
  363. msg -ne "Enter Para Continuar" && read enter
  364. ${SCPinst}/v2ray.sh
  365. }
  366. [[ $(sed -n '/'${portbg}'/=' /etc/VPS-MX/v2ray/lisportt.log|head -1) ]] || invaliduuid
  367. gblim=$(cat /etc/VPS-MX/v2ray/lisportt.log|grep -w "$portbg"|cut -d'|' -f3)
  368. sudo iptables -D OUTPUT -p tcp --sport $portbg -j DROP
  369. sudo iptables -D OUTPUT -p tcp --sport $portbg -m quota --quota $gblim -j ACCEPT
  370. iptables-save > /etc/iptables/rules.v4
  371. lineP=$(sed -n '/'${portbg}'/=' /etc/VPS-MX/v2ray/lisportt.log)
  372. sed -i "${linePre}d" /etc/VPS-MX/v2ray/lisportt.log
  373. msg -bar
  374. msg -ne "Enter Para Continuar" && read enter
  375. ${SCPinst}/v2ray.sh
  376. }
  377. ## MENU
  378. echo -ne "\033[1;32m [1] > " && msg -azu "$(fun_trans "LIMITAR DATA x PORT") "
  379. echo -ne "\033[1;32m [2] > " && msg -azu "$(fun_trans "RESETEAR DATA DE PORT") "
  380. echo -ne "\033[1;32m [3] > " && msg -azu "$(fun_trans "VER DATOS CONSUMIDOS") "
  381. echo -ne "$(msg -bar)\n\033[1;32m [0] > " && msg -bra "\e[97m\033[1;41m VOLVER \033[1;37m"
  382. msg -bar
  383. selection=$(selection_fun 3)
  384. case ${selection} in
  385. 1)liport ;;
  386. 2)resdata;;
  387. 3)estarts;;
  388. 0)
  389. ${SCPinst}/v2ray.sh
  390. ;;
  391. esac
  392. }
  393. limpiador_activador () {
  394. unset PIDGEN
  395. PIDGEN=$(ps aux|grep -v grep|grep "limv2ray")
  396. if [[ ! $PIDGEN ]]; then
  397. screen -dmS limv2ray watch -n 21600 limv2ray
  398. else
  399. #killall screen
  400. screen -S limv2ray -p 0 -X quit
  401. fi
  402. unset PID_GEN
  403. PID_GEN=$(ps x|grep -v grep|grep "limv2ray")
  404. [[ ! $PID_GEN ]] && PID_GEN="\e[91m [ DESACTIVADO ] " || PID_GEN="\e[92m [ ACTIVADO ] "
  405. statgen="$(echo $PID_GEN)"
  406. clear
  407. clear
  408. msg -bar
  409. msg -tit
  410. msg -ama " ELIMINAR EXPIRADOS | UUID V2RAY"
  411. msg -bar
  412. echo ""
  413. echo -e " $statgen "
  414. echo ""
  415. msg -bar
  416. msg -ne "Enter Para Continuar" && read enter
  417. ${SCPinst}/v2ray.sh
  418. }
  419. selection_fun () {
  420. local selection="null"
  421. local range
  422. for((i=0; i<=$1; i++)); do range[$i]="$i "; done
  423. while [[ ! $(echo ${range[*]}|grep -w "$selection") ]]; do
  424. echo -ne "\033[1;37m$(fun_trans " ► Selecione una Opcion"): " >&2
  425. read selection
  426. tput cuu1 >&2 && tput dl1 >&2
  427. done
  428. echo $selection
  429. }
  430. PID_GEN=$(ps x|grep -v grep|grep "limv2ray")
  431. [[ ! $PID_GEN ]] && PID_GEN="\e[91m [ DESACTIVADO ] " || PID_GEN="\e[92m [ ACTIVADO ] "
  432. statgen="$(echo $PID_GEN)"
  433. SPR &
  434. msg -bar3
  435. msg -bar
  436. msg -tit
  437. msg -ama "$(fun_trans " INSTALADOR DE V2RAY (PASO A PASO) ")"
  438. msg -bar
  439. ## INSTALADOR
  440. echo -ne "\033[1;32m [1] > " && msg -azu "$(fun_trans "INSTALAR V2RAY") "
  441. echo -ne "\033[1;32m [2] > " && msg -azu "$(fun_trans "CAMBIAR PROTOCOLO") "
  442. echo -ne "\033[1;32m [3] > " && msg -azu "$(fun_trans "ACTIVAR TLS") "
  443. echo -ne "\033[1;32m [4] > " && msg -azu "$(fun_trans "CAMBIAR PUERTO V2RAY")\n$(msg -bar) "
  444. ## CONTROLER
  445. echo -ne "\033[1;32m [5] > " && msg -azu "AGREGAR USUARIO UUID "
  446. echo -ne "\033[1;32m [6] > " && msg -azu "ELIMINAR USUARIO UUID"
  447. echo -ne "\033[1;32m [7] > " && msg -azu "MOSTAR USUARIOS REGISTRADOS"
  448. echo -ne "\033[1;32m [8] > " && msg -azu "INFORMACION DE CUENTAS"
  449. echo -ne "\033[1;32m [9] > " && msg -azu "ESTADISTICAS DE CONSUMO "
  450. echo -ne "\033[1;32m [10] > " && msg -azu "LIMITADOR POR CONSUMO\e[91m ( BETA x PORT )"
  451. echo -ne "\033[1;32m [11] > " && msg -azu "LIMPIADOR DE EXPIRADOS ------- $statgen\n$(msg -bar)"
  452. ## DESISNTALAR
  453. echo -ne "\033[1;32m [12] > " && msg -azu "\033[1;31mDESINSTALAR V2RAY"
  454. echo -ne "$(msg -bar)\n\033[1;32m [0] > " && msg -bra "\e[97m\033[1;41m VOLVER \033[1;37m"
  455. msg -bar
  456. pid_inst () {
  457. [[ $1 = "" ]] && echo -e "\033[1;31m[OFF]" && return 0
  458. unset portas
  459. portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND")
  460. i=0
  461. while read port; do
  462. var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
  463. [[ "$(echo -e ${portas[@]}|grep "$var1 $var2")" ]] || {
  464. portas[$i]="$var1 $var2\n"
  465. let i++
  466. }
  467. done <<< "$portas_var"
  468. [[ $(echo "${portas[@]}"|grep "$1") ]] && echo -e "\033[1;32m[ Servicio Activo ]" || echo -e "\033[1;31m[ Servicio Desactivado ]"
  469. }
  470. echo -e " \e[97mEstado actual: $(pid_inst v2ray)"
  471. msg -bar
  472. # while [[ ${arquivoonlineadm} != @(0|[1-99]) ]]; do
  473. # read -p "Seleccione una Opcion [0-12]: " arquivoonlineadm
  474. # tput cuu1 && tput dl1
  475. # done
  476. selection=$(selection_fun 18)
  477. case ${selection} in
  478. 1)intallv2ray;;
  479. 2)protocolv2ray;;
  480. 3)tls;;
  481. 4)portv;;
  482. 5)addusr;;
  483. 6)delusr;;
  484. 7)mosusr_kk;;
  485. 8)infocuenta;;
  486. 9)stats;;
  487. 10)lim_port;;
  488. 11)limpiador_activador;;
  489. 12)unistallv2;;
  490. 0)exit;;
  491. esac