1
0

v2ray.sh 20 KB

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