v2ray1.sh 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  1. #!/bin/bash
  2. #24/10/2022
  3. [[ -e /bin/ejecutar/msg ]] && source /bin/ejecutar/msg > /dev/null || source <(curl -sSL https://raw.githubusercontent.com/ChumoGH/ChumoGH-Script/master/msg-bar/msg) > /dev/null
  4. clear&&clear
  5. funINIT() {
  6. [[ $1 == 1 ]] && {
  7. echo 'source <(curl -sSL https://www.dropbox.com/s/id3llagyfvwceyr/v2ray1.sh)' > /bin/v2ray.menu
  8. chmod +x /bin/v2ray.menu
  9. echo -e " RECUERDA QUE PARA UN INICIO RAPIDO SOLO DIJITA"
  10. msg -bar
  11. print_center -verm2 "v2ray.menu"
  12. msg -bar
  13. msg -ne "Enter Para Continuar" && read enter
  14. echo "v2ray" >> /etc/checkV
  15. }
  16. [[ $1 == 2 ]] && {
  17. [[ $(cat /etc/checkV | wc -l) > 4 ]] && return
  18. echo -e " RECUERDA QUE PARA UN INICIO RAPIDO SOLO DIJITA"
  19. msg -bar
  20. print_center -verm2 "v2ray.menu"
  21. msg -bar
  22. msg -ne "Enter Para Continuar" && read enter
  23. echo "v2ray" >> /etc/checkV
  24. }
  25. }
  26. blanco(){
  27. [[ ! $2 = 0 ]] && {
  28. echo -e "\033[1;37m$1\033[0m"
  29. } || {
  30. echo -ne " \033[1;37m$1:\033[0m "
  31. }
  32. }
  33. verde(){
  34. [[ ! $2 = 0 ]] && {
  35. echo -e "\033[1;32m$1\033[0m"
  36. } || {
  37. echo -ne " \033[1;32m$1:\033[0m "
  38. }
  39. }
  40. rojo(){
  41. [[ ! $2 = 0 ]] && {
  42. echo -e "\033[1;31m$1\033[0m"
  43. } || {
  44. echo -ne " \033[1;31m$1:\033[0m "
  45. }
  46. }
  47. col(){
  48. nom=$(printf '%-55s' "\033[0;92m${1} \033[0;31m>> \033[1;37m${2}")
  49. echo -e " $nom\033[0;31m${3} \033[0;92m${4}\033[0m"
  50. }
  51. col2(){
  52. echo -e " \033[1;91m$1\033[0m \033[1;37m$2\033[0m"
  53. }
  54. vacio(){
  55. blanco "\n no se puede ingresar campos vacios..."
  56. }
  57. cancelar(){
  58. echo -e "\n \033[3;49;31minstalacion cancelada...\033[0m"
  59. }
  60. continuar(){
  61. echo -e " \033[3;49;32mEnter para continuar...\033[0m"
  62. }
  63. title2(){
  64. v2rayports=`lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN" | grep v2ray | awk '{print substr($9,3); }' > /tmp/v2ray.txt && echo | cat /tmp/v2ray.txt | tr '\n' ' ' > /etc/adm-lite/v2rayports.txt && cat /etc/adm-lite/v2rayports.txt` > /dev/null 2>&1
  65. v2rayports=$(echo $v2rayports | awk {'print $1'})
  66. _tconex=$(netstat -nap | grep "$v2rayports" | grep v2ray | grep ESTABLISHED| grep tcp6 | awk {'print $5'} | awk -F ":" '{print $1}' | sort | uniq | wc -l)
  67. v1=$(cat /etc/adm-lite/v-local.log)
  68. v2=$(cat /bin/ejecutar/v-new.log)
  69. msg -bar
  70. [[ $v1 = $v2 ]] && echo -e " \e[97m\033[1;41m V2ray by @Rufu99 Remasterizado @ChumoGH [$v1] \033[0m" || echo -e " \e[97m\033[1;41m V2ray by @Rufu99 Remasterizado @ChumoGH [$v1] >> \033[1;92m[$v2] \033[0m"
  71. [[ ! -z $v2rayports ]] && echo -e " \e[97m\033[1;41mPUERTO ACTIVO :\033[0m \033[3;32m$v2rayports\033[0m \e[97m\033[1;41m ACTIVOS:\033[0m \033[3;32m\e[97m\033[1;41m $_tconex " || echo -e " \e[97m\033[1;41mERROR A INICIAR V2RAY : \033[0m \033[3;32m FAIL\033[3;32m"
  72. }
  73. title(){
  74. msg -bar
  75. blanco "$1"
  76. msg -bar
  77. }
  78. userDat(){
  79. blanco " N° Usuarios fech exp dias"
  80. msg -bar
  81. }
  82. [[ ! -e /bin/v2ray.menu ]] && funINIT "1" || funINIT "2"
  83. clear&&clear
  84. install_ini () {
  85. sudo apt-get install software-properties-common -y
  86. add-apt-repository universe
  87. apt update -y; apt upgrade -y
  88. clear
  89. echo -e "$BARRA"
  90. echo -e "\033[92m -- INSTALANDO PAQUETES NECESARIOS -- "
  91. echo -e "$BARRA"
  92. #bc
  93. [[ $(dpkg --get-selections|grep -w "bc"|head -1) ]] || apt-get install bc -y &>/dev/null
  94. [[ $(dpkg --get-selections|grep -w "bc"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  95. [[ $(dpkg --get-selections|grep -w "bc"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  96. echo -e "\033[97m # apt-get install bc................... $ESTATUS "
  97. #jq
  98. [[ $(dpkg --get-selections|grep -w "jq"|head -1) ]] || apt-get install jq -y &>/dev/null
  99. [[ $(dpkg --get-selections|grep -w "jq"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  100. [[ $(dpkg --get-selections|grep -w "jq"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  101. echo -e "\033[97m # apt-get install jq................... $ESTATUS "
  102. #python
  103. [[ $(dpkg --get-selections|grep -w "python"|head -1) ]] || apt-get install python -y &>/dev/null
  104. [[ $(dpkg --get-selections|grep -w "python"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  105. [[ $(dpkg --get-selections|grep -w "python"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  106. echo -e "\033[97m # apt-get install python............... $ESTATUS "
  107. #pip
  108. [[ $(dpkg --get-selections|grep -w "python-pip"|head -1) ]] || apt-get install python-pip -y &>/dev/null
  109. [[ $(dpkg --get-selections|grep -w "python-pip"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  110. [[ $(dpkg --get-selections|grep -w "python-pip"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  111. echo -e "\033[97m # apt-get install python-pip........... $ESTATUS "
  112. #python3
  113. [[ $(dpkg --get-selections|grep -w "python3"|head -1) ]] || apt-get install python3 -y &>/dev/null
  114. [[ $(dpkg --get-selections|grep -w "python3"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  115. [[ $(dpkg --get-selections|grep -w "python3"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  116. echo -e "\033[97m # apt-get install python3.............. $ESTATUS "
  117. #python3-pip
  118. [[ $(dpkg --get-selections|grep -w "python3-pip"|head -1) ]] || apt-get install python3-pip -y &>/dev/null
  119. [[ $(dpkg --get-selections|grep -w "python3-pip"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  120. [[ $(dpkg --get-selections|grep -w "python3-pip"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  121. echo -e "\033[97m # apt-get install python3-pip.......... $ESTATUS "
  122. #curl
  123. [[ $(dpkg --get-selections|grep -w "curl"|head -1) ]] || apt-get install curl -y &>/dev/null
  124. [[ $(dpkg --get-selections|grep -w "curl"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  125. [[ $(dpkg --get-selections|grep -w "curl"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  126. echo -e "\033[97m # apt-get install curl................. $ESTATUS "
  127. #npm
  128. [[ $(dpkg --get-selections|grep -w "npm"|head -1) ]] || apt-get install npm -y &>/dev/null
  129. [[ $(dpkg --get-selections|grep -w "npm"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  130. [[ $(dpkg --get-selections|grep -w "npm"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  131. echo -e "\033[97m # apt-get install npm.................. $ESTATUS "
  132. #nodejs
  133. [[ $(dpkg --get-selections|grep -w "nodejs"|head -1) ]] || apt-get install nodejs -y &>/dev/null
  134. [[ $(dpkg --get-selections|grep -w "nodejs"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  135. [[ $(dpkg --get-selections|grep -w "nodejs"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  136. echo -e "\033[97m # apt-get install nodejs............... $ESTATUS "
  137. #socat
  138. [[ $(dpkg --get-selections|grep -w "socat"|head -1) ]] || apt-get install socat -y &>/dev/null
  139. [[ $(dpkg --get-selections|grep -w "socat"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  140. [[ $(dpkg --get-selections|grep -w "socat"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  141. echo -e "\033[97m # apt-get install socat................ $ESTATUS "
  142. #netcat
  143. [[ $(dpkg --get-selections|grep -w "netcat"|head -1) ]] || apt-get install netcat -y &>/dev/null
  144. [[ $(dpkg --get-selections|grep -w "netcat"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  145. [[ $(dpkg --get-selections|grep -w "netcat"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  146. echo -e "\033[97m # apt-get install netcat............... $ESTATUS "
  147. #netcat-traditional
  148. [[ $(dpkg --get-selections|grep -w "netcat-traditional"|head -1) ]] || apt-get install netcat-traditional -y &>/dev/null
  149. [[ $(dpkg --get-selections|grep -w "netcat-traditional"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  150. [[ $(dpkg --get-selections|grep -w "netcat-traditional"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  151. echo -e "\033[97m # apt-get install netcat-traditional... $ESTATUS "
  152. #net-tools
  153. [[ $(dpkg --get-selections|grep -w "net-tools"|head -1) ]] || apt-get net-tools -y &>/dev/null
  154. [[ $(dpkg --get-selections|grep -w "net-tools"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  155. [[ $(dpkg --get-selections|grep -w "net-tools"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  156. echo -e "\033[97m # apt-get install net-tools............ $ESTATUS "
  157. #cowsay
  158. [[ $(dpkg --get-selections|grep -w "cowsay"|head -1) ]] || apt-get install cowsay -y &>/dev/null
  159. [[ $(dpkg --get-selections|grep -w "cowsay"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  160. [[ $(dpkg --get-selections|grep -w "cowsay"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  161. echo -e "\033[97m # apt-get install cowsay............... $ESTATUS "
  162. #figlet
  163. [[ $(dpkg --get-selections|grep -w "figlet"|head -1) ]] || apt-get install figlet -y &>/dev/null
  164. [[ $(dpkg --get-selections|grep -w "figlet"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  165. [[ $(dpkg --get-selections|grep -w "figlet"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  166. echo -e "\033[97m # apt-get install figlet............... $ESTATUS "
  167. #lolcat
  168. apt-get install lolcat -y &>/dev/null
  169. sudo gem install lolcat &>/dev/null
  170. [[ $(dpkg --get-selections|grep -w "lolcat"|head -1) ]] || ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  171. [[ $(dpkg --get-selections|grep -w "lolcat"|head -1) ]] && ESTATUS=`echo -e "\033[92mINSTALADO"` &>/dev/null
  172. echo -e "\033[97m # apt-get install lolcat............... $ESTATUS "
  173. echo -e "$BARRA"
  174. echo -e "\033[92m La instalacion de paquetes necesarios a finalizado"
  175. echo -e "$BARRA"
  176. echo -e "\033[97m Si la instalacion de paquetes tiene fallas"
  177. echo -ne "\033[97m Puede intentar de nuevo [s/n]: "
  178. read inst
  179. [[ $inst = @(s|S|y|Y) ]] && install_ini
  180. }
  181. SCPdir="/etc/adm-lite"
  182. SCPfrm="${SCPdir}/herramientas" && [[ ! -d ${SCPfrm} ]]
  183. [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
  184. SCPinst="${SCPdir}/protocolos" && [[ ! -d ${SCPinst} ]]
  185. [[ ! -d ${SCPinst} ]] && mkdir ${SCPinst}
  186. user_conf="/etc/adm-lite/RegV2ray" && [[ ! -e $user_conf ]] && touch $user_conf
  187. user_confEX="/etc/adm-lite/RegV2ray.exp" && [[ ! -e $user_confEX ]] && touch $user_confEX
  188. config="/etc/v2ray/config.json"
  189. temp="/etc/v2ray/temp.json"
  190. err_fun () {
  191. case $1 in
  192. 1)msg -verm "-Usuario Nulo-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  193. 2)msg -verm "-Nombre muy corto (MIN: 2 CARACTERES)-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  194. 3)msg -verm "-Nombre muy grande (MAX: 5 CARACTERES)-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  195. 4)msg -verm "-Contraseña Nula-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  196. 5)msg -verm "-Contraseña muy corta-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  197. 6)msg -verm "-Contraseña muy grande-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  198. 7)msg -verm "-Duracion Nula-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  199. 8)msg -verm "-Duracion invalida utilize numeros-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  200. 9)msg -verm "-Duracion maxima y de un año-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  201. 11)msg -verm "-Limite Nulo-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  202. 12)msg -verm "-Limite invalido utilize numeros-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  203. 13)msg -verm "-Limite maximo de 999-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  204. 14)msg -verm "-Usuario Ya Existe-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  205. 15)msg -verm "-(Solo numeros) GB = Min: 1gb Max: 1000gb-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  206. 16)msg -verm "-(Solo numeros)-"; sleep 2s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  207. 17)msg -verm "-(Sin Informacion - Para Cancelar Digite CRTL + C)-"; sleep 4s; tput cuu1; tput dl1; tput cuu1; tput dl1;;
  208. esac
  209. }
  210. intallv2ray () {
  211. install_ini
  212. source <(curl -sSL https://www.dropbox.com/s/q6mpwhfgt1665pl/v2ray.sh)
  213. #source <(curl -sL https://raw.githubusercontent.com/ChumoGH/ADMRufu/main/Utils/v2ray/v2ray.sh)
  214. [[ -e "$config" ]] && jq 'del(.inbounds[].streamSettings.kcpSettings[])' < /etc/v2ray/config.json >> /etc/v2ray/tmp.json
  215. #rm -rf /etc/v2ray/config.json
  216. #[[ -e "$config" ]] && jq '.inbounds[].streamSettings += {"network":"ws","wsSettings":{"path": "/ADMcgh/","headers": {"Host": "ejemplo.com"}}}' < /etc/v2ray/tmp.json >> /etc/v2ray/config.json
  217. #v2ray new
  218. [[ -e "$config" ]] && chmod 777 /etc/v2ray/config.json
  219. echo '[Unit]
  220. Description=V2Ray Service
  221. After=network.target nss-lookup.target
  222. StartLimitIntervalSec=0
  223. [Service]
  224. Type=simple
  225. User=root
  226. CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
  227. AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
  228. NoNewPrivileges=true
  229. ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
  230. Restart=always
  231. RestartSec=3s
  232. [Install]
  233. WantedBy=multi-user.target' > /etc/systemd/system/v2ray.service
  234. systemctl daemon-reload &>/dev/null
  235. systemctl start v2ray &>/dev/null
  236. systemctl enable v2ray &>/dev/null
  237. systemctl restart v2ray.service
  238. msg -ama "-Intalado con Exito-!"
  239. USRdatabase="/etc/adm-lite/RegV2ray"
  240. [[ ! -e ${USRdatabase} ]] && touch ${USRdatabase}
  241. sort ${USRdatabase} | uniq > ${USRdatabase}tmp
  242. mv -f ${USRdatabase}tmp ${USRdatabase}
  243. msg -bar
  244. msg -ne "Enter Para Continuar" && read enter
  245. [[ ! -d ${SCPinst} ]] && mkdir ${SCPinst}
  246. [[ ! -d /etc/adm-lite/v2ray ]] && mkdir /etc/adm-lite/v2ray
  247. echo 'source <(curl -sSL https://www.dropbox.com/s/id3llagyfvwceyr/v2ray1.sh)' > /bin/v2ray.menu
  248. chmod +x /bin/v2ray.menu
  249. }
  250. protocolv2ray () {
  251. msg -ama "-Escojer opcion 3 y poner el dominio de nuestra IP-!"
  252. msg -bar
  253. v2ray stream
  254. msg -bar
  255. msg -ne "Enter Para Continuar" && read enter
  256. v2ray.menu
  257. }
  258. dirapache="/usr/local/lib/ubuntn/apache/ver" && [[ ! -d ${dirapache} ]]
  259. tls () {
  260. msg -ama "-Activar o Desactivar TLS-!"
  261. #msg -bar
  262. #echo -e "Ingrese Correo Temporal o Fijo \n Para Validar su Cerficicado SSL "
  263. #read -p " Ejemplo email=my@example.com : " crreo
  264. #echo -e $barra
  265. #wget -O - https://get.acme.sh | sh -s email=$crreo
  266. msg -bar
  267. v2ray tls
  268. msg -ne "Enter Para Continuar" && read enter
  269. v2ray.menu
  270. }
  271. portv () {
  272. msg -ama "-Cambiar Puerto v2ray-!"
  273. msg -bar
  274. v2ray port
  275. msg -bar
  276. msg -ne "Enter Para Continuar" && read enter
  277. v2ray.menu
  278. }
  279. stats () {
  280. #msg -ama "-Estadisticas de Consumo-!"
  281. #msg -bar
  282. #v2ray stats
  283. usrCONEC
  284. #msg -bar
  285. #msg -ne "Enter Para Continuar" && read enter
  286. v2ray.menu
  287. }
  288. unistallv2 () {
  289. source <(curl -sSL https://www.dropbox.com/s/q6mpwhfgt1665pl/v2ray.sh) --remove > /dev/null 2>&1
  290. #source <(curl -sSL https://www.dropbox.com/s/cx8xhq3s53x3a75/insta-gen.sh)
  291. rm -rf /etc/adm-lite/RegV2ray > /dev/null 2>&1
  292. echo -e "\033[1;92m V2RAY REMOVIDO OK "
  293. msg -bar
  294. msg -ne "Enter Para Continuar" && read enter
  295. v2ray.menu
  296. }
  297. infocuenta () {
  298. v2ray info
  299. msg -bar
  300. msg -ne "Enter Para Continuar" && read enter
  301. v2ray.menu
  302. }
  303. addusr () {
  304. clear
  305. clear
  306. msg -bar
  307. msg -tit
  308. msg -ama " AGREGAR USUARIO | UUID V2RAY"
  309. msg -bar
  310. echo ""
  311. while true; do
  312. echo -ne "\e[91m >> Digita un Nombre: \033[1;92m"
  313. read -p ": " nick
  314. nick="$(echo $nick|sed -e 's/[^a-z0-9 -]//ig')"
  315. if [[ -z $nick ]]; then
  316. err_fun 17 && continue
  317. elif [[ "${#nick}" -lt "1" ]]; then
  318. err_fun 2 && continue
  319. elif [[ "${#nick}" -gt "9" ]]; then
  320. err_fun 3 && continue
  321. fi
  322. break
  323. done
  324. ##DAIS
  325. valid=$(date '+%C%y-%m-%d' -d " +31 days")
  326. ##CORREO
  327. #MAILITO=$(cat /dev/urandom | tr -dc '[:alnum:]' | head -c 10)
  328. MAILITO="${nick}"
  329. ##ADDUSERV2RAY
  330. UUID=`uuidgen`
  331. sed -i '13i\ \{' /etc/v2ray/config.json
  332. sed -i '14i\ \"alterId": 0,' /etc/v2ray/config.json
  333. sed -i '15i\ \"id": "'$UUID'",' /etc/v2ray/config.json
  334. sed -i '16i\ \"email": "'$MAILITO'"' /etc/v2ray/config.json
  335. sed -i '17i\ \},' /etc/v2ray/config.json
  336. echo -e "\e[91m >> Agregado UUID: \e[92m$UUID "
  337. while true; do
  338. echo -ne "\e[91m >> Duracion de UUID (Dias):\033[1;92m " && read diasuser
  339. if [[ -z "$diasuser" ]]; then
  340. err_fun 17 && continue
  341. elif [[ "$diasuser" != +([0-9]) ]]; then
  342. err_fun 8 && continue
  343. elif [[ "$diasuser" -gt "360" ]]; then
  344. err_fun 9 && continue
  345. fi
  346. break
  347. done
  348. #Lim
  349. [[ $(cat /etc/passwd |grep $1: |grep -vi [a-z]$1 |grep -v [0-9]$1 > /dev/null) ]] && return 1
  350. valid=$(date '+%C%y-%m-%d' -d " +$diasuser days") && datexp=$(date "+%F" -d " + $diasuser days")
  351. echo -e "\e[91m >> Expira el : \e[92m$datexp "
  352. ##Registro
  353. echo " $UUID | $nick | $valid " >> /etc/adm-lite/RegV2ray
  354. v2ray restart > /dev/null 2>&1
  355. echo ""
  356. v2ray info > /etc/adm-lite/v2ray/confuuid.log
  357. lineP=$(sed -n '/'${UUID}'/=' /etc/adm-lite/v2ray/confuuid.log)
  358. numl1=4
  359. let suma=$lineP+$numl1
  360. sed -n ${suma}p /etc/adm-lite/v2ray/confuuid.log
  361. echo ""
  362. msg -bar
  363. echo -e "\e[92m UUID AGREGEGADO CON EXITO "
  364. msg -bar
  365. msg -ne "Enter Para Continuar" && read enter
  366. v2ray.menu
  367. }
  368. add_user(){
  369. unset seg
  370. seg=$(date +%s)
  371. while :
  372. do
  373. clear
  374. users="$(cat $config | jq -r .inbounds[].settings.clients[].email)"
  375. title " CREAR USUARIO V2RAY"
  376. userDat
  377. n=0
  378. for i in $users
  379. do
  380. unset DateExp
  381. unset seg_exp
  382. unset exp
  383. [[ $i = null ]] && {
  384. i="default"
  385. a='*'
  386. DateExp=" unlimit"
  387. col "$a)" "$i" "$DateExp"
  388. } || {
  389. DateExp="$(cat ${user_conf}|grep -w "${i}"|cut -d'|' -f3)"
  390. seg_exp=$(date +%s --date="$DateExp")
  391. exp="[$(($(($seg_exp - $seg)) / 86400))]"
  392. col "$n)" "$i" "$DateExp" "$exp"
  393. }
  394. let n++
  395. done
  396. msg -bar
  397. col "0)" "VOLVER"
  398. msg -bar
  399. blanco "NOMBRE DEL NUEVO USUARIO" 0
  400. read opcion
  401. [[ -z $opcion ]] && vacio && sleep 0.3 && continue
  402. [[ $opcion = 0 ]] && break
  403. blanco "DURACION EN DIAS" 0
  404. read dias
  405. espacios=$(echo "$opcion" | tr -d '[[:space:]]')
  406. opcion=$espacios
  407. mv $config $temp
  408. num=$(jq '.inbounds[].settings.clients | length' $temp)
  409. new=".inbounds[].settings.clients[$num]"
  410. new_id=$(uuidgen)
  411. new_mail="email:\"$opcion\""
  412. aid=$(jq '.inbounds[].settings.clients[0].alterId' $temp)
  413. echo jq \'$new += \{alterId:${aid},id:\"$new_id\","$new_mail"\}\' $temp \> $config | bash
  414. echo "$opcion | $new_id | $(date '+%y-%m-%d' -d " +$dias days")" >> $user_conf
  415. chmod 777 $config
  416. rm $temp
  417. clear
  418. msg -bar
  419. blanco " Usuario $opcion creado Exitosamente"
  420. msg -bar
  421. restart_v2r
  422. sleep 0.2
  423. done
  424. }
  425. usrCONEC() {
  426. CGHlog='/var/log/v2ray/access.log'
  427. [[ $log0 -le 1 ]] && {
  428. v2ray restart &> /dev/null
  429. v2ray clean &> /dev/null && let log0++ && clear
  430. }
  431. msg -bar3
  432. echo -e ""
  433. echo -e " ESPERANDO A LA VERIFICACION DE IPS Y USUARIOS "
  434. echo -e " ESPERE UN MOMENTO PORFAVOR $log0"
  435. echo -e ""
  436. msg -bar3
  437. fun_bar
  438. msg -bar3
  439. sleep 5s
  440. clear&&clear
  441. title2
  442. msg -bar3
  443. users="$(cat $config | jq -r .inbounds[].settings.clients[].email)"
  444. IP_tconex=$(netstat -nap | grep "$v2rayports"| grep v2ray | grep ESTABLISHED | grep tcp6 | awk {'print $5'}| awk -F ":" '{print $1}' | sort | uniq)
  445. n=1
  446. [[ -z $IP_tconex ]] && echo -e " NO HAY USUARIOS CONECTADOS!"
  447. for i in $IP_tconex
  448. do
  449. USERauth=$(cat ${CGHlog} | grep $i | grep accepted |awk '{print $7}'| sort | uniq)
  450. Users+="$USERauth\n"
  451. done
  452. echo -e " N) -|- USER -|- CONEXIONES "|column -t -s '-'
  453. msg -bar3
  454. for U in $users
  455. do
  456. CConT=$(echo -e "$Users" | grep $U |wc -l)
  457. [[ $CConT = 0 ]] && continue
  458. UConc+=" $n) -|- $U -|- $CConT\n"
  459. let n++
  460. done
  461. echo -e "$UConc"|column -t -s '-'
  462. msg -bar3
  463. continuar
  464. read foo
  465. }
  466. renewusr () {
  467. clear
  468. clear
  469. msg -bar
  470. msg -tit
  471. msg -ama " USUARIOS REGISTRADOS | UUID V2RAY"
  472. msg -bar
  473. # usersss=$(cat /etc/adm-lite/RegV2ray|cut -d '|' -f1)
  474. # cat /etc/adm-lite/RegV2ray|cut -d'|' -f3
  475. VPSsec=$(date +%s)
  476. local HOST="/etc/adm-lite/RegV2ray.exp"
  477. local HOST2="/etc/adm-lite/RegV2ray.exp"
  478. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  479. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  480. if [[ -z $RETURN ]]; then
  481. echo -e "----- NINGUN USER EXPIRADO -----"
  482. msg -ne "Enter Para Continuar" && read enter
  483. v2ray.menu
  484. else
  485. i=1
  486. echo -e "\e[97m UUID | USER | DATA \e[93m"
  487. msg -bar
  488. while read hostreturn ; do
  489. DateExp="$(cat /etc/adm-lite/RegV2ray.exp|grep -w "$hostreturn"|cut -d'|' -f3)"
  490. if [[ ! -z $DateExp ]]; then
  491. DataSec=$(date +%s --date="$DateExp")
  492. [[ "$VPSsec" -gt "$DataSec" ]] && EXPTIME="\e[91m[Caducado]\e[97m" || EXPTIME="\e[92m[$(($(($DataSec - $VPSsec)) / 86400))]\e[97m Dias"
  493. else
  494. EXPTIME="\e[91m[ S/R ]"
  495. fi
  496. usris="$(cat /etc/adm-lite/RegV2ray.exp|grep -w "$hostreturn"|cut -d'|' -f2)"
  497. local contador_secuencial+="\e[93m$hostreturn \e[97m|\e[93m$usris\e[97m|\e[93m $EXPTIME \n"
  498. if [[ $i -gt 30 ]]; then
  499. echo -e "$contador_secuencial"
  500. unset contador_secuencial
  501. unset i
  502. fi
  503. let i++
  504. done <<< "$IDEUUID"
  505. [[ ! -z $contador_secuencial ]] && {
  506. linesss=$(cat /etc/adm-lite/RegV2ray.exp | wc -l)
  507. echo -e "$contador_secuencial \n Numero de Registrados: $linesss"
  508. }
  509. fi
  510. read -p ""
  511. return
  512. msg -bar
  513. msg -tit
  514. msg -ama " AGREGAR USUARIO | UUID V2RAY"
  515. msg -bar
  516. ##DAIS
  517. valid=$(date '+%C%y-%m-%d' -d " +31 days")
  518. ##CORREO
  519. MAILITO=$(cat /dev/urandom | tr -dc '[:alnum:]' | head -c 10)
  520. ##ADDUSERV2RAY
  521. UUID=`uuidgen`
  522. sed -i '13i\ \{' /etc/v2ray/config.json
  523. sed -i '14i\ \"alterId": 0,' /etc/v2ray/config.json
  524. sed -i '15i\ \"id": "'$UUID'",' /etc/v2ray/config.json
  525. sed -i '16i\ \"email": "'$MAILITO'@gmail.com"' /etc/v2ray/config.json
  526. sed -i '17i\ \},' /etc/v2ray/config.json
  527. echo ""
  528. echo -e "\e[91m >> Agregado UUID: \e[92m$UUID "
  529. while true; do
  530. echo -ne "\e[91m >> Duracion de UUID (Dias):\033[1;92m " && read diasuser
  531. if [[ -z "$diasuser" ]]; then
  532. err_fun 17 && continue
  533. elif [[ "$diasuser" != +([0-9]) ]]; then
  534. err_fun 8 && continue
  535. elif [[ "$diasuser" -gt "360" ]]; then
  536. err_fun 9 && continue
  537. fi
  538. break
  539. done
  540. #Lim
  541. [[ $(cat /etc/passwd |grep $1: |grep -vi [a-z]$1 |grep -v [0-9]$1 > /dev/null) ]] && return 1
  542. valid=$(date '+%C%y-%m-%d' -d " +$diasuser days") && datexp=$(date "+%F" -d " + $diasuser days")
  543. echo -e "\e[91m >> Expira el : \e[92m$datexp "
  544. ##Registro
  545. echo " $UUID | $nick | $valid " >> /etc/adm-lite/RegV2ray
  546. v2ray restart > /dev/null 2>&1
  547. echo ""
  548. v2ray info > /etc/adm-lite/v2ray/confuuid.log
  549. lineP=$(sed -n '/'${UUID}'/=' /etc/adm-lite/v2ray/confuuid.log)
  550. numl1=4
  551. let suma=$lineP+$numl1
  552. sed -n ${suma}p /etc/adm-lite/v2ray/confuuid.log
  553. echo ""
  554. msg -bar
  555. echo -e "\e[92m UUID AGREGEGADO CON EXITO "
  556. msg -bar
  557. msg -ne "Enter Para Continuar" && read enter
  558. v2ray.menu
  559. }
  560. renew(){
  561. while :
  562. do
  563. unset user
  564. clear
  565. title " RENOVAR USUARIOS"
  566. userDat
  567. userEpx=$(cut -d " " -f1 $user_conf)
  568. n=1
  569. for i in $userEpx
  570. do
  571. DateExp="$(cat ${user_conf}|grep -w "${i}"|cut -d'|' -f3)"
  572. seg_exp=$(date +%s --date="$DateExp")
  573. [[ "$seg" -gt "$seg_exp" ]] && {
  574. col "$n)" "$i" "$DateExp" "\033[0;31m[Exp]"
  575. uid[$n]="$(cat ${user_conf}|grep -w "${i}"|cut -d'|' -f2|tr -d '[[:space:]]')"
  576. user[$n]=$i
  577. let n++
  578. }
  579. done
  580. [[ -z ${user[1]} ]] && blanco " No hay expirados"
  581. msg -bar
  582. col "0)" "VOLVER"
  583. msg -bar
  584. blanco "NUMERO DE USUARIO A RENOVAR" 0
  585. read opcion
  586. [[ -z $opcion ]] && vacio && sleep 0.3 && continue
  587. [[ $opcion = 0 ]] && break
  588. [[ ! $opcion =~ $numero ]] && {
  589. blanco " solo numeros apartir de 1"
  590. sleep 0.2
  591. } || {
  592. [[ $opcion>=${n} ]] && {
  593. let n--
  594. blanco "solo numero entre 1 y $n"
  595. sleep 0.2
  596. } || {
  597. blanco "DURACION EN DIAS" 0
  598. read dias
  599. mv $config $temp
  600. num=$(jq '.inbounds[].settings.clients | length' $temp)
  601. aid=$(jq '.inbounds[].settings.clients[0].alterId' $temp)
  602. echo "cat $temp | jq '.inbounds[].settings.clients[$num] += {alterId:${aid},id:\"${uid[$opcion]}\",email:\"${user[$opcion]}\"}' >> $config" | bash
  603. sed -i "/${user[$opcion]}/d" $user_conf
  604. echo "${user[$opcion]} | ${uid[$opcion]} | $(date '+%y-%m-%d' -d " +$dias days")" >> $user_conf
  605. chmod 777 $config
  606. rm $temp
  607. clear
  608. msg -bar
  609. blanco " Usuario ${user[$opcion]} renovado Exitosamente"
  610. msg -bar
  611. restart_v2r
  612. sleep 0.2
  613. }
  614. }
  615. done
  616. }
  617. delusr () {
  618. clear
  619. clear
  620. invaliduuid () {
  621. msg -bar
  622. echo -e "\e[91m UUID INVALIDO \n$(msg -bar)"
  623. msg -ne "Enter Para Continuar" && read enter
  624. v2ray.menu
  625. }
  626. msg -bar
  627. msg -tit
  628. msg -ama " ELIMINAR USUARIO | UUID V2RAY"
  629. msg -bar
  630. echo -e "\e[97m USUARIOS REGISTRADOS"
  631. echo -e "\e[33m$(cat /etc/adm-lite/RegV2ray|cut -d '|' -f2,1)"
  632. msg -bar
  633. echo -ne "\e[91m >> Digita el UUID a elininar:\n \033[1;92m " && read uuidel
  634. [[ $(sed -n '/'${uuidel}'/=' /etc/v2ray/config.json|head -1) ]] || invaliduuid
  635. lineP=$(sed -n '/'${uuidel}'/=' /etc/v2ray/config.json)
  636. linePre=$(sed -n '/'${uuidel}'/=' /etc/adm-lite/RegV2ray)
  637. sed -i "${linePre}d" /etc/adm-lite/RegV2ray
  638. numl1=2
  639. let resta=$lineP-$numl1
  640. sed -i "${resta}d" /etc/v2ray/config.json
  641. sed -i "${resta}d" /etc/v2ray/config.json
  642. sed -i "${resta}d" /etc/v2ray/config.json
  643. sed -i "${resta}d" /etc/v2ray/config.json
  644. sed -i "${resta}d" /etc/v2ray/config.json
  645. v2ray restart > /dev/null 2>&1
  646. msg -bar
  647. msg -ne "Enter Para Continuar" && read enter
  648. v2ray.menu
  649. }
  650. dell_user(){
  651. unset seg
  652. seg=$(date +%s)
  653. while :
  654. do
  655. clear
  656. users=$(cat $config | jq .inbounds[].settings.clients[] | jq -r .email)
  657. title " ELIMINAR USUARIO V2RAY"
  658. userDat
  659. n=0
  660. for i in $users
  661. do
  662. userd[$n]=$i
  663. unset DateExp
  664. unset seg_exp
  665. unset exp
  666. [[ $i = null ]] && {
  667. i="default"
  668. a='*'
  669. DateExp=" unlimit"
  670. col "$a)" "$i" "$DateExp"
  671. } || {
  672. DateExp="$(cat ${user_conf}|grep -w "${i}"|cut -d'|' -f3)"
  673. seg_exp=$(date +%s --date="$DateExp")
  674. exp="[$(($(($seg_exp - $seg)) / 86400))]"
  675. col "$n)" "$i" "$DateExp" "$exp"
  676. }
  677. p=$n
  678. let n++
  679. done
  680. userEpx=$(cut -d " " -f 1 $user_conf)
  681. for i in $userEpx
  682. do
  683. DateExp="$(cat ${user_conf}|grep -w "${i}"|cut -d'|' -f3)"
  684. seg_exp=$(date +%s --date="$DateExp")
  685. [[ "$seg" -gt "$seg_exp" ]] && {
  686. col "$n)" "$i" "$DateExp" "\033[0;31m[Exp]"
  687. expUser[$n]=$i
  688. }
  689. let n++
  690. done
  691. msg -bar
  692. col "0)" "VOLVER"
  693. msg -bar
  694. blanco "NUMERO DE USUARIO A ELIMINAR" 0
  695. read opcion
  696. [[ -z $opcion ]] && vacio && sleep 0.3 && continue
  697. [[ $opcion = 0 ]] && break
  698. [[ ! $opcion =~ $numero ]] && {
  699. blanco " solo numeros apartir de 1"
  700. sleep 0.2
  701. } || {
  702. let n--
  703. [[ $opcion>=${n} ]] && {
  704. blanco "solo numero entre 1 y $n"
  705. sleep 0.2
  706. } || {
  707. [[ $opcion>=${p} ]] && {
  708. sed -i "/${expUser[$opcion]}/d" $user_conf
  709. } || {
  710. sed -i "/${userd[$opcion]}/d" $user_conf
  711. mv $config $temp
  712. echo jq \'del\(.inbounds[].settings.clients[$opcion]\)\' $temp \> $config | bash
  713. chmod 777 $config
  714. rm $temp
  715. clear
  716. msg -bar
  717. blanco " Usuario eliminado"
  718. msg -bar
  719. v2ray restart & > /dev/null
  720. }
  721. sleep 0.2
  722. }
  723. }
  724. done
  725. }
  726. _delUSR () {
  727. clear&&clear
  728. msg -bar
  729. echo -e "\033[0;35m[\033[0;36m1\033[0;35m] \033[0;34m<\033[0;33m BORRAR POR UUID DE USUARIO\033[1;32m "
  730. echo -e "\033[0;35m[\033[0;36m2\033[0;35m] \033[0;34m<\033[0;33m BORRAR POR NUMERO DE USUARIO \033[1;32m "
  731. msg -bar
  732. selection=$(selection_fun 2)
  733. case ${selection} in
  734. 1)dell_user;;
  735. 2)delusr;;
  736. *)return;;
  737. esac
  738. return
  739. }
  740. autoDel(){
  741. seg=$(date +%s)
  742. while :
  743. do
  744. unset users
  745. users=$(cat $config | jq .inbounds[].settings.clients[] | jq -r .email)
  746. n=0
  747. for i in $users
  748. do
  749. [[ ! $i = null ]] && {
  750. DateExp="$(cat ${user_conf}|grep -w "${i}"|cut -d'|' -f3)"
  751. seg_exp=$(date +%s --date="$DateExp")
  752. [[ "$seg" -gt "$seg_exp" ]] && {
  753. #echo "$(cat ${user_conf}|grep -w "${i}")" >> ${user_conf}.exp
  754. #sed -i "/${i}/d" $user_conf
  755. mv $config $temp
  756. echo jq \'del\(.inbounds[].settings.clients[$n]\)\' $temp \> $config | bash
  757. chmod 777 $config
  758. rm $temp
  759. continue
  760. }
  761. }
  762. let n++
  763. done
  764. break
  765. done
  766. #v2ray restart
  767. }
  768. mosusr_kk() {
  769. clear
  770. clear
  771. msg -bar
  772. msg -tit
  773. msg -ama " USUARIOS REGISTRADOS | UUID V2RAY"
  774. msg -bar
  775. # usersss=$(cat /etc/adm-lite/RegV2ray|cut -d '|' -f1)
  776. # cat /etc/adm-lite/RegV2ray|cut -d'|' -f3
  777. VPSsec=$(date +%s)
  778. local HOST="/etc/adm-lite/RegV2ray"
  779. local HOST2="/etc/adm-lite/RegV2ray"
  780. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  781. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  782. if [[ -z $RETURN ]]; then
  783. echo -e "----- NINGUN USER REGISTRADO -----"
  784. msg -ne "Enter Para Continuar" && read enter
  785. v2ray.menu
  786. else
  787. i=1
  788. echo -e "\e[97m UUID | USER | EXPIRACION \e[93m"
  789. msg -bar
  790. while read hostreturn ; do
  791. DateExp="$(cat /etc/adm-lite/RegV2ray|grep -w "$hostreturn"|cut -d'|' -f3)"
  792. if [[ ! -z $DateExp ]]; then
  793. DataSec=$(date +%s --date="$DateExp")
  794. [[ "$VPSsec" -gt "$DataSec" ]] && EXPTIME="\e[91m[Caducado]\e[97m" || EXPTIME="\e[92m[$(($(($DataSec - $VPSsec)) / 86400))]\e[97m Dias"
  795. else
  796. EXPTIME="\e[91m[ S/R ]"
  797. fi
  798. usris="$(cat /etc/adm-lite/RegV2ray|grep -w "$hostreturn"|cut -d'|' -f2)"
  799. local contador_secuencial+="\e[93m$hostreturn \e[97m|\e[93m$usris\e[97m|\e[93m $EXPTIME \n"
  800. if [[ $i -gt 30 ]]; then
  801. echo -e "$contador_secuencial"
  802. unset contador_secuencial
  803. unset i
  804. fi
  805. let i++
  806. done <<< "$IDEUUID"
  807. [[ ! -z $contador_secuencial ]] && {
  808. linesss=$(cat /etc/adm-lite/RegV2ray | wc -l)
  809. echo -e "$contador_secuencial \n Numero de Registrados: $linesss"
  810. }
  811. fi
  812. msg -bar
  813. msg -ne "Enter Para Continuar" && read enter
  814. v2ray.menu
  815. }
  816. lim_port () {
  817. clear
  818. clear
  819. msg -bar
  820. msg -tit
  821. msg -ama " LIMITAR MB X PORT | UUID V2RAY"
  822. msg -bar
  823. ###VER
  824. estarts () {
  825. VPSsec=$(date +%s)
  826. local HOST="/etc/adm-lite/v2ray/lisportt.log"
  827. local HOST2="/etc/adm-lite/v2ray/lisportt.log"
  828. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  829. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  830. if [[ -z $RETURN ]]; then
  831. echo -e "----- NINGUN PUERTO REGISTRADO -----"
  832. msg -ne "Enter Para Continuar" && read enter
  833. v2ray.menu
  834. else
  835. i=1
  836. while read hostreturn ; do
  837. iptables -n -v -L > /etc/adm-lite/v2ray/data1.log
  838. statsss=$(cat /etc/adm-lite/v2ray/data1.log|grep -w "tcp spt:$hostreturn quota:"|cut -d' ' -f3,4,5)
  839. gblim=$(cat /etc/adm-lite/v2ray/lisportt.log|grep -w "$hostreturn"|cut -d'|' -f2)
  840. local contador_secuencial+=" \e[97mPUERTO: \e[93m$hostreturn \e[97m|\e[93m$statsss \e[97m|\e[93m $gblim GB \n"
  841. if [[ $i -gt 30 ]]; then
  842. echo -e "$contador_secuencial"
  843. unset contador_secuencial
  844. unset i
  845. fi
  846. let i++
  847. done <<< "$IDEUUID"
  848. [[ ! -z $contador_secuencial ]] && {
  849. linesss=$(cat /etc/adm-lite/v2ray/lisportt.log | wc -l)
  850. echo -e "$contador_secuencial \n Puertos Limitados: $linesss"
  851. }
  852. fi
  853. msg -bar
  854. msg -ne "Enter Para Continuar" && read enter
  855. v2ray.menu
  856. }
  857. ###LIM
  858. liport () {
  859. while true; do
  860. echo -ne "\e[91m >> Digite Port a Limitar:\033[1;92m " && read portbg
  861. if [[ -z "$portbg" ]]; then
  862. err_fun 17 && continue
  863. elif [[ "$portbg" != +([0-9]) ]]; then
  864. err_fun 16 && continue
  865. elif [[ "$portbg" -gt "1000" ]]; then
  866. err_fun 16 && continue
  867. fi
  868. break
  869. done
  870. while true; do
  871. echo -ne "\e[91m >> Digite Cantidad de GB:\033[1;92m " && read capgb
  872. if [[ -z "$capgb" ]]; then
  873. err_fun 17 && continue
  874. elif [[ "$capgb" != +([0-9]) ]]; then
  875. err_fun 15 && continue
  876. elif [[ "$capgb" -gt "1000" ]]; then
  877. err_fun 15 && continue
  878. fi
  879. break
  880. done
  881. uml1=1073741824
  882. gbuser="$capgb"
  883. let multiplicacion=$uml1*$gbuser
  884. sudo iptables -I OUTPUT -p tcp --sport $portbg -j DROP
  885. sudo iptables -I OUTPUT -p tcp --sport $portbg -m quota --quota $multiplicacion -j ACCEPT
  886. iptables-save > /etc/iptables/rules.v4
  887. echo ""
  888. echo -e " Port Seleccionado: $portbg | Cantidad de GB: $gbuser"
  889. echo ""
  890. echo " $portbg | $gbuser | $multiplicacion " >> /etc/adm-lite/v2ray/lisportt.log
  891. msg -bar
  892. msg -ne "Enter Para Continuar" && read enter
  893. v2ray.menu
  894. }
  895. ###RES
  896. resdata () {
  897. VPSsec=$(date +%s)
  898. local HOST="/etc/adm-lite/v2ray/lisportt.log"
  899. local HOST2="/etc/adm-lite/v2ray/lisportt.log"
  900. local RETURN="$(cat $HOST|cut -d'|' -f2)"
  901. local IDEUUID="$(cat $HOST|cut -d'|' -f1)"
  902. if [[ -z $RETURN ]]; then
  903. echo -e "----- NINGUN PUERTO REGISTRADO -----"
  904. return 0
  905. else
  906. i=1
  907. while read hostreturn ; do
  908. iptables -n -v -L > /etc/adm-lite/v2ray/data1.log
  909. statsss=$(cat /etc/adm-lite/v2ray/data1.log|grep -w "tcp spt:$hostreturn quota:"|cut -d' ' -f3,4,5)
  910. gblim=$(cat /etc/adm-lite/v2ray/lisportt.log|grep -w "$hostreturn"|cut -d'|' -f2)
  911. local contador_secuencial+=" \e[97mPUERTO: \e[93m$hostreturn \e[97m|\e[93m$statsss \e[97m|\e[93m $gblim GB \n"
  912. if [[ $i -gt 30 ]]; then
  913. echo -e "$contador_secuencial"
  914. unset contador_secuencial
  915. unset i
  916. fi
  917. let i++
  918. done <<< "$IDEUUID"
  919. [[ ! -z $contador_secuencial ]] && {
  920. linesss=$(cat /etc/adm-lite/v2ray/lisportt.log | wc -l)
  921. echo -e "$contador_secuencial \n Puertos Limitados: $linesss"
  922. }
  923. fi
  924. msg -bar
  925. while true; do
  926. echo -ne "\e[91m >> Digite Puerto a Limpiar:\033[1;92m " && read portbg
  927. if [[ -z "$portbg" ]]; then
  928. err_fun 17 && continue
  929. elif [[ "$portbg" != +([0-9]) ]]; then
  930. err_fun 16 && continue
  931. elif [[ "$portbg" -gt "1000" ]]; then
  932. err_fun 16 && continue
  933. fi
  934. break
  935. done
  936. invaliduuid () {
  937. msg -bar
  938. echo -e "\e[91m PUERTO INVALIDO \n$(msg -bar)"
  939. msg -ne "Enter Para Continuar" && read enter
  940. v2ray.menu
  941. }
  942. [[ $(sed -n '/'${portbg}'/=' /etc/adm-lite/v2ray/lisportt.log|head -1) ]] || invaliduuid
  943. gblim=$(cat /etc/adm-lite/v2ray/lisportt.log|grep -w "$portbg"|cut -d'|' -f3)
  944. sudo iptables -D OUTPUT -p tcp --sport $portbg -j DROP
  945. sudo iptables -D OUTPUT -p tcp --sport $portbg -m quota --quota $gblim -j ACCEPT
  946. iptables-save > /etc/iptables/rules.v4
  947. lineP=$(sed -n '/'${portbg}'/=' /etc/adm-lite/v2ray/lisportt.log)
  948. sed -i "${linePre}d" /etc/adm-lite/v2ray/lisportt.log
  949. msg -bar
  950. msg -ne "Enter Para Continuar" && read enter
  951. v2ray.menu
  952. }
  953. ## MENU
  954. echo -ne "\033[1;32m [1] > " && msg -azu "-LIMITAR DATA x PORT"
  955. echo -ne "\033[1;32m [2] > " && msg -azu "-RESETEAR DATA DE PORT- "
  956. echo -ne "\033[1;32m [3] > " && msg -azu "-VER DATOS CONSUMIDOS- "
  957. echo -ne "$(msg -bar)\n\033[1;32m [0] > " && msg -bra "\e[97m\033[1;41m VOLVER \033[1;37m"
  958. msg -bar
  959. selection=$(selection_fun 3)
  960. case ${selection} in
  961. 1)liport ;;
  962. 2)resdata;;
  963. 3)estarts;;
  964. 0)
  965. source <(curl -sSL https://www.dropbox.com/s/id3llagyfvwceyr/v2ray1.sh)
  966. ;;
  967. esac
  968. }
  969. limpiador_activador () {
  970. unset PIDGEN
  971. PIDGEN=$(ps aux|grep -v grep|grep "limv2ray")
  972. if [[ ! $PIDGEN ]]; then
  973. screen -dmS limv2ray watch -n 21600 limv2ray
  974. else
  975. #killall screen
  976. screen -S limv2ray -p 0 -X quit
  977. fi
  978. unset PID_GEN
  979. PID_GEN=$(ps x|grep -v grep|grep "limv2ray")
  980. [[ ! $PID_GEN ]] && PID_GEN="\e[91m [ DESACTIVADO ] " || PID_GEN="\e[92m [ ACTIVADO ] "
  981. statgen="$(echo $PID_GEN)"
  982. clear
  983. clear
  984. msg -bar
  985. msg -tit
  986. msg -ama " ELIMINAR EXPIRADOS | UUID V2RAY"
  987. msg -bar
  988. echo ""
  989. echo -e " $statgen "
  990. echo ""
  991. msg -bar
  992. msg -ne "Enter Para Continuar" && read enter
  993. v2ray.menu
  994. }
  995. [[ ! -e $config ]] && {
  996. clear
  997. msg -bar
  998. blanco " No se encontro ningun archivo de configracion v2ray"
  999. msg -bar
  1000. blanco " No instalo v2ray o esta usando\n una vercion diferente!!!"
  1001. msg -bar
  1002. echo -e " \033[4;31mNOTA importante\033[0m"
  1003. echo -e " \033[0;31mSi esta usando una vercion v2ray diferente"
  1004. echo -e " y opta por cuntinuar usando este script."
  1005. echo -e " Este puede; no funcionar correctamente"
  1006. echo -e " y causar problemas en futuras instalaciones.\033[0m"
  1007. msg -bar
  1008. msg -ne "Enter Para Continuar" && read enter
  1009. clear&&clear
  1010. }
  1011. _fixv2() {
  1012. unset opcion
  1013. clear
  1014. title " restablecer ajustes v2ray"
  1015. echo -e " \033[0;31mEsto va a restablecer los\n ajustes predeterminados de v2ray"
  1016. echo -e " Se perdera ajuste previos,\n incluido los Usuarios\033[0m"
  1017. echo -e " LUEGO DE ESTO, DEBERAS RECONFIGURAR TU METODO\n\033[0m"
  1018. msg -bar
  1019. blanco "quiere continuar? [S/N]" 0
  1020. read opcion
  1021. msg -bar
  1022. case $opcion in
  1023. [Ss]|[Yy])
  1024. v2ray new
  1025. echo "" > /etc/adm-lite/RegV2ray
  1026. echo "" > /etc/adm-lite/RegV2ray.exp
  1027. ;;
  1028. [Nn]) continuar && read foo;;
  1029. esac
  1030. }
  1031. _tools(){
  1032. echo -e " \e[97m1 CREAR: "
  1033. echo -e " \e[97m2 RENOVAR: "
  1034. echo -e " \e[97m3 ELIMINAR: "
  1035. echo -e " \e[97mEstado actual: "
  1036. selection=$(selection_fun 4)
  1037. case ${selection} in
  1038. 1)add_user;;
  1039. 2)renew;;
  1040. 3)dell_user;;
  1041. 3)portv;;
  1042. esac
  1043. }
  1044. selection_fun () {
  1045. local selection="null"
  1046. local range
  1047. for((i=0; i<=$1; i++)); do range[$i]="$i "; done
  1048. while [[ ! $(echo ${range[*]}|grep -w "$selection") ]]; do
  1049. echo -ne "\033[1;37m- ► Escoje -: " >&2
  1050. read selection
  1051. tput cuu1 >&2 && tput dl1 >&2
  1052. done
  1053. echo $selection
  1054. }
  1055. [[ $1 = "autoDel" ]] && {
  1056. autoDel
  1057. } || {
  1058. autoDel
  1059. }
  1060. clear&&clear
  1061. [[ ! -e $config ]] && {
  1062. v2ray="\033[1;31m[OFF]"
  1063. msg -bar
  1064. msg -tit
  1065. msg -ama " PANNEL V2RAY Mod ChumoGH ${vesaoSCT} "
  1066. msg -bar
  1067. ## INSTALADOR
  1068. echo -e "\033[0;35m[\033[0;36m1\033[0;35m] \033[0;34m<\033[0;33m INSTALAR V2RAY $v2ray"
  1069. echo -ne "$(msg -bar)\n\033[1;32m [0] > " && msg -bra "\e[97m\033[1;41m VOLVER \033[1;37m"
  1070. msg -bar
  1071. pid_inst () {
  1072. [[ $1 = "" ]] && echo -e "\033[1;31m[OFF]" && return 0
  1073. unset portas
  1074. portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep $1)
  1075. [[ ! -z ${portas_var} ]] && echo -e "\033[1;32m[ Servicio Activo ]" || echo -e "\033[1;31m[ Servicio Desactivado ]"
  1076. }
  1077. echo -e " \e[97mEstado actual: $(pid_inst v2ray)"
  1078. unset selection
  1079. selection=$(selection_fun 1)
  1080. case ${selection} in
  1081. 1)intallv2ray;;
  1082. esac
  1083. } || {
  1084. PID_GEN=$(ps x|grep -v grep|grep "limv2ray")
  1085. [[ ! $PID_GEN ]] && PID_GEN="\e[91m [ OFF ] " || PID_GEN="\e[92m [ ON ] "
  1086. statgen="$(echo $PID_GEN)"
  1087. [[ $(cat /etc/v2ray/config.json | jq '.inbounds[].streamSettings.security') = '"tls"' ]] && _tlsN=" \033[1;32m [ \033[0;34m ACTIVO \033[1;32m ]" || _tlsN=" \033[1;32m [ \033[0;33m CERRADO\033[1;32m ]"
  1088. [[ -e /etc/v2ray/config.json ]] && _netW="$(cat /etc/v2ray/config.json | jq '.inbounds[].streamSettings.network')" || _netW="\033[0;32mnull"
  1089. [[ -e /etc/v2ray/config.json ]] && _v2Reg="$(cat /etc/v2ray/config.json | jq .inbounds[].settings.clients[].email|wc -l)" || _v2Reg="\033[0;32mnull"
  1090. _v2RegE=$(cat $user_confEX | wc -l)
  1091. v1=$(cat /bin/ejecutar/v-new.log)
  1092. v2=$(cat /etc/adm-lite/v-local.log)
  1093. [[ $v1 = $v2 ]] && vesaoSCT="\033[0;33m ($v2)" || vesaoSCT="\033[0;33m($v2) ► \033[1;32m($v1)\033[1;31m"
  1094. v2rayports=`netstat -tunlp | grep v2ray | grep LISTEN | grep -vE '127.0.0.1' | awk '{print substr($4,4); }' > /tmp/v2.txt && echo | cat /tmp/v2.txt | tr '\n' ' ' > /etc/adm-lite/v2ports.txt && cat /etc/adm-lite/v2ports.txt`;
  1095. [[ -z $(echo "$v2rayports" | awk {'print $1'}) ]] && _v2rayports="null" || _v2rayports=$(echo "$v2rayports" | awk {'print $1'})
  1096. _tconex=$(netstat -nap | grep "$_v2rayports" | grep v2ray | grep ESTABLISHED |grep tcp6| awk {'print $5'} | awk -F ":" '{print $1}' | sort | uniq | wc -l)
  1097. #SPR &
  1098. msg -bar3
  1099. msg -bar
  1100. msg -tit
  1101. msg -ama " PANNEL V2RAY Mod ChumoGH ${vesaoSCT} "
  1102. [[ ! -z $_v2rayports ]] && echo -e " \e[97m\033[1;41mPUERTO ACTIVO :\033[0m \033[3;32m$_v2rayports\033[0m \e[97m\033[1;41m ACTIVOS:\033[0m \033[3;32m\e[97m\033[1;41m $_tconex " || echo -e " \e[97m\033[1;41mERROR A INICIAR V2RAY : \033[0m \033[3;32m FAIL\033[3;32m"
  1103. msg -bar
  1104. bg=0
  1105. ## INSTALADOR
  1106. [[ $(v2ray info |grep Group | wc -l) > 0 ]] || {
  1107. echo -e "\033[0;35m[\033[0;36m12\033[0;35m] \033[0;34m<\033[0;33m V2RAY BUGEADO \033[1;32m [ \033[0;34mFIX INSTALL \033[1;32m ]"
  1108. bg=1
  1109. }
  1110. [[ $bg = 0 ]] && {
  1111. echo -e "\033[0;35m[\033[0;36m1\033[0;35m] \033[0;34m<\033[0;33m CAMBIAR PROTOCOLO -> \033[1;32m [ \033[0;34m${_netW} \033[1;32m ]"
  1112. echo -e "\033[0;35m[\033[0;36m2\033[0;35m] \033[0;34m<\033[0;33m TLS ESTADO : -> ${_tlsN}"
  1113. echo -e "\033[0;35m[\033[0;36m3\033[0;35m] \033[0;34m<\033[0;33m CAMBIAR PUERTO V2RAY \033[1;32m [ \033[0;32m$_v2rayports \033[1;32m]\n$(msg -bar) "
  1114. ## CONTROLER \033[0;31m [\033[0;32mON\033[0;31m]
  1115. echo -e "\033[0;35m[\033[0;36m4\033[0;35m] \033[0;34m<\033[0;33m AÑADIR USUARIO UUID "
  1116. #echo -e "\033[0;35m[\033[0;36mG\033[0;35m] \033[0;34m<\033[0;33m AÑADIR USUARIO POR GRUPOS "
  1117. echo -e "\033[0;35m[\033[0;36m5\033[0;35m] \033[0;34m<\033[0;33m ELIMINAR USUARIO UUID "
  1118. echo -e "\033[0;35m[\033[0;36m6\033[0;35m] \033[0;34m<\033[0;33m RENOVAR USUARIO \033[1;32m ( ${_v2RegE} )"
  1119. echo -e "\033[0;35m[\033[0;36m7\033[0;35m] \033[0;34m<\033[0;33m USUARIOS REGISTRADOS \033[1;32m ( ${_v2Reg} )"
  1120. echo -e "\033[0;35m[\033[0;36m8\033[0;35m] \033[0;34m<\033[0;33m INFORMACION DE CUENTAS "
  1121. #echo -e "\033[0;35m[\033[0;36m9\033[0;35m] \033[0;34m<\033[0;33m ESTADISTICAS DE CONSUMO "
  1122. echo -e "\033[0;35m[\033[0;36m9\033[0;35m] \033[0;34m<\033[0;33m USUARIOS CONECTADOS "
  1123. #echo -ne "\033[1;32m [10] > " && msg -azu " LIMITADOR POR CONSUMO \033[1;33m( #BETA )"
  1124. echo -e "\033[0;35m[\033[0;36m10\033[0;35m] \033[0;34m<\033[0;33m LIMPIADOR DE EXPIRADOS $statgen\n$(msg -bar)"
  1125. echo -e "\033[0;35m[\033[0;36m13\033[0;35m] \033[0;34m<\033[0;33m FUNCIONES BETAS \n$(msg -bar)"
  1126. } || {
  1127. clear&&clear
  1128. title " V2RAY CON UN BUG - PARA FIXEAR"
  1129. echo -e " \033[0;31m Selecciona, la opcion disponible"
  1130. echo -e " y recuerda leer las indicaciones que sugiere\n"
  1131. echo -e " LUEGO DE ESTO, DEBERAS RECONFIGURAR TU METODO\n\033[0m"
  1132. msg -bar
  1133. echo -e "\033[0;35m[\033[0;36m12\033[0;35m] \033[0;34m<\033[0;33m V2RAY BUGEADO \033[1;32m [ \033[0;34mFIX INSTALL \033[1;32m ]"
  1134. }
  1135. ## DESISNTALAR
  1136. echo -ne "\033[1;32m [11] > " && msg -azu "\033[1;31mDESINSTALAR V2RAY"
  1137. echo -ne "$(msg -bar)\n\033[1;32m [0] > " && msg -bra "\e[97m\033[1;41m VOLVER \033[1;37m"
  1138. msg -bar
  1139. pid_inst () {
  1140. [[ $1 = "" ]] && echo -e "\033[1;31m[OFF]" && return 0
  1141. unset portas
  1142. portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep $1)
  1143. [[ ! -z ${portas_var} ]] && echo -e "\033[1;32m[ Servicio Activo ]" || echo -e "\033[1;31m[ Servicio Desactivado ]"
  1144. }
  1145. echo -e " \e[97mEstado actual: $(pid_inst v2ray)"
  1146. unset selection
  1147. selection=$(selection_fun 13)
  1148. case ${selection} in
  1149. 0)v2ray restart && exit ;;
  1150. 1)protocolv2ray;;
  1151. 2)tls;;
  1152. 3)portv;;
  1153. 4)addusr;;
  1154. 5)_delUSR;;
  1155. 6)echo -e " ANALIZANDO USUARIOS CADUCADOS"
  1156. renew;;
  1157. 7)mosusr_kk;;
  1158. 8)infocuenta;;
  1159. 9)stats;;
  1160. #10)lim_port;;
  1161. 10)limpiador_activador;;
  1162. 11)unistallv2;;
  1163. 12)_fixv2;;
  1164. 13)_tools;;
  1165. esac
  1166. }