NetVPS 3 лет назад
Родитель
Сommit
832cee9f36
52 измененных файлов с 11113 добавлено и 100 удалено
  1. 3 0
      R9/ADMRufu-31/chekup.sh
  2. 276 0
      R9/ADMRufu-31/install/PDirect.py
  3. 682 0
      R9/ADMRufu-31/install/PGet.py
  4. 313 0
      R9/ADMRufu-31/install/POpen.py
  5. 341 0
      R9/ADMRufu-31/install/PPriv.py
  6. 320 0
      R9/ADMRufu-31/install/PPub.py
  7. 102 0
      R9/ADMRufu-31/install/WS-Proxy.js
  8. 92 0
      R9/ADMRufu-31/install/budp.sh
  9. 366 0
      R9/ADMRufu-31/install/cert.sh
  10. BIN
      R9/ADMRufu-31/install/dns-server
  11. 97 0
      R9/ADMRufu-31/install/dropbear.sh
  12. 104 0
      R9/ADMRufu-31/install/limitador.sh
  13. 495 0
      R9/ADMRufu-31/install/openvpn.sh
  14. 339 0
      R9/ADMRufu-31/install/ports.sh
  15. 189 0
      R9/ADMRufu-31/install/slowdns.sh
  16. 216 0
      R9/ADMRufu-31/install/sockspy.sh
  17. 293 0
      R9/ADMRufu-31/install/squid.sh
  18. 216 0
      R9/ADMRufu-31/install/ssl.sh
  19. 97 0
      R9/ADMRufu-31/install/swapfile.sh
  20. 690 0
      R9/ADMRufu-31/install/tcp.sh
  21. 824 0
      R9/ADMRufu-31/install/userHWID
  22. 1055 0
      R9/ADMRufu-31/install/userSSH
  23. 880 0
      R9/ADMRufu-31/install/userTOKEN
  24. 218 0
      R9/ADMRufu-31/install/userV2ray.sh
  25. 283 0
      R9/ADMRufu-31/install/v2ray.sh
  26. 164 0
      R9/ADMRufu-31/install/ws-cdn.sh
  27. 0 0
      R9/ADMRufu-31/main
  28. 779 0
      R9/ADMRufu-31/menu
  29. 363 0
      R9/ADMRufu-31/menu_inst.sh
  30. 179 0
      R9/ADMRufu-31/module
  31. 1 0
      R9/ADMRufu-31/new_vercion
  32. 5 0
      R9/ADMRufu-31/tmp/style
  33. 90 0
      R9/ADMRufu-31/tool_extras.sh
  34. 0 0
      R9/ADMRufu-31/v2r/user
  35. 2 0
      R9/ADMRufu-31/vercion
  36. BIN
      R9/ADMRufu.tar.xz
  37. 1 1
      R9/ADMRufu/chekup.sh
  38. 1 1
      R9/ADMRufu/install/budp.sh
  39. 3 6
      R9/ADMRufu/install/cert.sh
  40. 1 0
      R9/ADMRufu/install/ports.sh
  41. 1 1
      R9/ADMRufu/install/slowdns.sh
  42. 332 50
      R9/ADMRufu/install/squid.sh
  43. 230 9
      R9/ADMRufu/install/ssl.sh
  44. 2 1
      R9/ADMRufu/install/v2ray.sh
  45. 3 4
      R9/ADMRufu/menu
  46. 1 1
      R9/ADMRufu/new_vercion
  47. 1 0
      R9/ADMRufu/source/dominio.txt
  48. 1 0
      R9/ADMRufu/tmp/MEUIPADM
  49. 2 2
      R9/ADMRufu/tool_extras.sh
  50. 1 1
      R9/ADMRufu/vercion
  51. 419 0
      R9/LATAM
  52. 40 23
      R9/install-Of.sh

+ 3 - 0
R9/ADMRufu-31/chekup.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+key_word=$(wget --no-check-certificate -t3 -T5 -qO- "https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/ADMRufu/vercion")
+echo "${key_word}" > /etc/ADMRufu/new_vercion && chmod +x /etc/ADMRufu/new_vercion

+ 276 - 0
R9/ADMRufu-31/install/PDirect.py

@@ -0,0 +1,276 @@
+# -*- coding: utf-8 -*-
+import socket, threading, thread, select, signal, sys, time, getopt, argparse
+
+parser = argparse.ArgumentParser()
+parser.add_argument("-l", "--local", help="Nombre de archivo a procesar")
+parser.add_argument("-p", "--port", help="Nombre de archivo a procesar")
+parser.add_argument("-c", "--contr", help="Nombre de archivo a procesar")
+parser.add_argument("-r", "--response", help="Nombre de archivo a procesar")
+parser.add_argument("-t", "--texto", help="Nombre de archivo a procesar")
+
+args = parser.parse_args()
+
+#==================================
+LISTENING_ADDR = '0.0.0.0'
+
+if args.port:
+    LISTENING_PORT = int(args.port)
+else:
+    print " Deve ingresar el puerto que usara como socks..."
+    sys.exit()
+
+if args.contr:
+    PASS = str(args.contr)
+else:
+    PASS = str()
+
+BUFLEN = 4096 * 4
+TIMEOUT = 60
+
+if args.local:
+    DEFAULT_HOST = '127.0.0.1:' + args.local
+else:
+    print " Deve seleccionar un puerto existente para redireccionar el trafico..."
+    sys.exit()
+
+if args.response:
+    STATUS_RESP = args.response
+else:
+    STATUS_RESP = '200'
+
+if args.texto:
+    STATUS_TXT = args.texto
+else:
+    STATUS_TXT = '<font color="#00FFFF">A</font><font color="#6bffff">D</font><font color="#99ffff">M</font><font color="#ebffff">@</font><font color="#ebffff">R</font><font color="#ccffff">u</font><font color="#99ffff">f</font><font color="#6bffff">u</font><font color="#2effff">9</font><font color="#00FFFF">9</font>'
+
+RESPONSE = str('HTTP/1.1 ' + STATUS_RESP + ' <strong>' + STATUS_TXT + '</strong>\r\nContent-length: 0\r\n\r\nHTTP/1.1 200 Connection established\r\n\r\n')
+
+class Server(threading.Thread):
+    def __init__(self, host, port):
+        threading.Thread.__init__(self)
+        self.running = False
+        self.host = host
+        self.port = port
+        self.threads = []
+        self.threadsLock = threading.Lock()
+        self.logLock = threading.Lock()
+
+    def run(self):
+        self.soc = socket.socket(socket.AF_INET)
+        self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+        self.soc.settimeout(2)
+        self.soc.bind((self.host, self.port))
+        self.soc.listen(0)
+        self.running = True
+
+        try:
+            while self.running:
+                try:
+                    c, addr = self.soc.accept()
+                    c.setblocking(1)
+                except socket.timeout:
+                    continue
+
+                conn = ConnectionHandler(c, self, addr)
+                conn.start()
+                self.addConn(conn)
+        finally:
+            self.running = False
+            self.soc.close()
+
+    def printLog(self, log):
+        self.logLock.acquire()
+        print log
+        self.logLock.release()
+
+    def addConn(self, conn):
+        try:
+            self.threadsLock.acquire()
+            if self.running:
+                self.threads.append(conn)
+        finally:
+            self.threadsLock.release()
+
+    def removeConn(self, conn):
+        try:
+            self.threadsLock.acquire()
+            self.threads.remove(conn)
+        finally:
+            self.threadsLock.release()
+
+    def close(self):
+        try:
+            self.running = False
+            self.threadsLock.acquire()
+
+            threads = list(self.threads)
+            for c in threads:
+                c.close()
+        finally:
+            self.threadsLock.release()
+
+
+class ConnectionHandler(threading.Thread):
+    def __init__(self, socClient, server, addr):
+        threading.Thread.__init__(self)
+        self.clientClosed = False
+        self.targetClosed = True
+        self.client = socClient
+        self.client_buffer = ''
+        self.server = server
+        self.log = 'Connection: ' + str(addr)
+
+    def close(self):
+        try:
+            if not self.clientClosed:
+                self.client.shutdown(socket.SHUT_RDWR)
+                self.client.close()
+        except:
+            pass
+        finally:
+            self.clientClosed = True
+
+        try:
+            if not self.targetClosed:
+                self.target.shutdown(socket.SHUT_RDWR)
+                self.target.close()
+        except:
+            pass
+        finally:
+            self.targetClosed = True
+
+    def run(self):
+        try:
+            self.client_buffer = self.client.recv(BUFLEN)
+
+            hostPort = self.findHeader(self.client_buffer, 'X-Real-Host')
+
+            if hostPort == '':
+                hostPort = DEFAULT_HOST
+
+            split = self.findHeader(self.client_buffer, 'X-Split')
+
+            if split != '':
+                self.client.recv(BUFLEN)
+
+            if hostPort != '':
+                passwd = self.findHeader(self.client_buffer, 'X-Pass')
+				
+                if len(PASS) != 0 and passwd == PASS:
+                    self.method_CONNECT(hostPort)
+                elif len(PASS) != 0 and passwd != PASS:
+                    self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n')
+                elif hostPort.startswith('127.0.0.1') or hostPort.startswith('localhost'):
+                    self.method_CONNECT(hostPort)
+                else:
+                    self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n')
+            else:
+                print '- No X-Real-Host!'
+                self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n')
+
+        except Exception as e:
+            self.log += ' - error: ' + e.strerror
+            self.server.printLog(self.log)
+	    pass
+        finally:
+            self.close()
+            self.server.removeConn(self)
+
+    def findHeader(self, head, header):
+        aux = head.find(header + ': ')
+
+        if aux == -1:
+            return ''
+
+        aux = head.find(':', aux)
+        head = head[aux+2:]
+        aux = head.find('\r\n')
+
+        if aux == -1:
+            return ''
+
+        return head[:aux];
+
+    def connect_target(self, host):
+        i = host.find(':')
+        if i != -1:
+            port = int(host[i+1:])
+            host = host[:i]
+        else:
+            if self.method=='CONNECT':
+                port = 443
+            else:
+                port = 80
+                port = 8080
+                port = 8799
+                port = 3128
+
+        (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0]
+
+        self.target = socket.socket(soc_family, soc_type, proto)
+        self.targetClosed = False
+        self.target.connect(address)
+
+    def method_CONNECT(self, path):
+        self.log += ' - CONNECT ' + path
+
+        self.connect_target(path)
+        self.client.sendall(RESPONSE)
+        self.client_buffer = ''
+
+        self.server.printLog(self.log)
+        self.doCONNECT()
+
+    def doCONNECT(self):
+        socs = [self.client, self.target]
+        count = 0
+        error = False
+        while True:
+            count += 1
+            (recv, _, err) = select.select(socs, [], socs, 3)
+            if err:
+                error = True
+            if recv:
+                for in_ in recv:
+		    try:
+                        data = in_.recv(BUFLEN)
+                        if data:
+			    if in_ is self.target:
+				self.client.send(data)
+                            else:
+                                while data:
+                                    byte = self.target.send(data)
+                                    data = data[byte:]
+
+                            count = 0
+			else:
+			    break
+		    except:
+                        error = True
+                        break
+            if count == TIMEOUT:
+                error = True
+
+            if error:
+                break
+
+def main(host=LISTENING_ADDR, port=LISTENING_PORT):
+
+    print "\n:-------PythonProxy-------:\n"
+    print "Listening addr: " + LISTENING_ADDR
+    print "Listening port: " + str(LISTENING_PORT) + "\n"
+    print ":-------------------------:\n"
+
+    server = Server(LISTENING_ADDR, LISTENING_PORT)
+    server.start()
+
+    while True:
+        try:
+            time.sleep(2)
+        except KeyboardInterrupt:
+            print 'Stopping...'
+            server.close()
+            break
+
+if __name__ == '__main__':
+    main()

+ 682 - 0
R9/ADMRufu-31/install/PGet.py

@@ -0,0 +1,682 @@
+import sys, time, getopt, socket, threading, base64
+
+
+# CONFIG
+CONFIG_LISTENING = '0.0.0.0:8799'
+CONFIG_PASS = 'pwd.pwd'
+
+
+class Logger:
+
+    logLock = threading.Lock()
+    LOG_INFO = 1
+    LOG_WARN = 2
+    LOG_ERROR = 3
+
+    def printWarn(self, log):
+        self.log(log)
+
+    def printInfo(self, log):
+        self.log(log)
+
+    def printError(self, log):
+        self.log(log)
+
+    def printLog(self, log, logLevel):
+        if logLevel == Logger.LOG_INFO:
+            self.printInfo('<-> ' + log)
+        elif logLevel == Logger.LOG_WARN:
+            self.printWarn('<!> ' + log)
+        elif logLevel == Logger.LOG_ERROR:
+            self.printError('<#> ' + log)
+
+    def log(self, log):
+        with Logger.logLock:
+            print log
+
+		
+
+class PasswordSet:
+    FILE_EXEMPLE = 'master=passwd123\n127.0.0.1:22=pwd321;321pawd\n1.23.45.67:443=pass123'
+
+    def __init__(self, masterKey=None):
+        self.masterKey = masterKey
+
+    def parseFile(self, fileName):
+        isValid = False
+
+        with open(fileName) as f:
+            content = f.readlines()
+
+        content = [x.strip() for x in content]
+        content = [item for item in content if not str(item).startswith('#')]
+
+        if len(content) > 0:
+            masterKey = content[0]
+
+            if self.splitParam(masterKey, '=') is not None and masterKey.startswith('master'):
+                self.masterKey = self.splitParam(masterKey, '=')[1]
+
+            isValid = True
+            self.map = dict()
+
+            for i, v in enumerate(content[1:]):
+                hostAndPass = self.splitParam(v, '=')
+
+                if hostAndPass is not None:
+                    self.map[hostAndPass[0]] = hostAndPass[1].split(';')
+
+        return isValid
+
+    def isValidKey(self, key, target):
+        valid = False
+
+        if not self.masterKey == key:
+            if hasattr(self, 'map'):
+                if self.map.has_key(target):
+                    valid = key in self.map[target]
+        else:
+            valid = True
+
+        return valid
+
+
+    def splitParam(self, param, c):
+        index = param.find(c)
+
+        ret = None
+
+        if index != -1:
+            ret = []
+            ret.append(param[0:index])
+            ret.append(param[index+1:])
+
+        return ret
+
+
+
+
+class ClientRequest:
+    MAX_LEN_CLIENT_REQUEST = 1024 * 100
+    HEADER_CONTENT_LENGTH = 'Content-Length'
+    HEADER_ACTION = 'X-Action'
+    ACTION_CLOSE = 'close'
+    ACTION_DATA = 'data'
+
+    def __init__(self, socket):
+        self.socket = socket
+        self.readConent = False
+
+    def parse(self):
+        line = ''
+        count = 0
+        self.isValid = False
+        self.data = None
+        self.contentLength = None
+        self.action = None
+
+        while line != '\r\n' and count < ClientRequest.MAX_LEN_CLIENT_REQUEST:
+            line = self.readHttpLine()
+
+            if line is None:
+                break
+
+            if line.startswith(ClientRequest.HEADER_ACTION):
+                self.action = self.getHeaderVal(line)
+
+                if not self.action is None:
+                    if self.action == ClientRequest.ACTION_CLOSE or self.action == ClientRequest.ACTION_DATA:
+                        self.isValid = True
+
+            count += len(line)
+
+        if self.readConent:
+            if self.contentLength > 0 and self.contentLength < ClientRequest.MAX_LEN_CLIENT_REQUEST:
+                self.data = self.readFully(self.contentLength)
+
+        return self.isValid
+
+    def readHttpLine(self):
+        line = ''
+        count = 0
+        socket = self.socket
+
+        b = socket.recv(1)
+
+        if not b:
+            return None
+
+        while count < ClientRequest.MAX_LEN_CLIENT_REQUEST:
+            count += 1
+            line += b
+
+            if b == '\r':
+                b = socket.recv(1)
+                count += 1
+
+                if not b:
+                    break
+
+                line += b
+
+                if b == '\n':
+                    break
+
+            b = socket.recv(1)
+
+            if not b:
+                break
+
+        if not b:
+            return None
+
+        return line
+
+    def getHeaderVal(self, header):
+        ini = header.find(':')
+
+        if ini == -1:
+            return None
+
+        ini += 2
+
+        fim = header.find('\r\n')
+
+        if fim == -1:
+            header = header[ini:]
+
+        return header[ini:fim]
+
+    def readFully(self, n):
+        count = 0
+        data = ''
+
+        while count < n:
+            packet = self.socket.recv(n - count)
+
+            if not packet:
+                break
+
+            count += len(packet)
+            data += packet
+
+
+
+
+class Client(threading.Thread):
+    ACTION_DATA = 'data'
+    BUFFER_SIZE = 4096
+
+    def __init__(self, id, readSocket, target):
+        super(Client, self).__init__()
+        self.targetHostPort = target
+        self.id = id
+        self.readSocket = readSocket
+        self.logger = Logger()
+        self.isStopped = False
+        self.onCloseFunction = None
+        self.closeLock = threading.Lock()
+        self.threadEndCount = 0
+        self.writeSocket = None
+
+    def connectTarget(self):
+        aux = self.targetHostPort.find(':')
+
+        host = self.targetHostPort[:aux]
+        port = int(self.targetHostPort[aux + 1:])
+
+        self.target = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        self.target.connect((host, port))
+
+    def run(self):
+        try:
+            self.connectTarget()
+
+            request = ClientRequest(self.readSocket)
+            request.readConent = False
+
+            if not request.parse() or not Client.ACTION_DATA == request.action:
+                raise Exception('client sends invalid request')
+
+            threadRead = ThreadRelay(self.readSocket, self.target, self.finallyClose)
+            threadRead.logFunction = self.log
+            threadRead.start()
+
+            threadWrite = ThreadRelay(self.target, self.writeSocket, self.finallyClose)
+            threadWrite.logFunction = self.log
+            threadWrite.start()
+        except Exception as e:
+            self.log('connection error - ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+            self.close()
+
+    def finallyClose(self):
+        with self.closeLock:
+            self.threadEndCount += 1
+
+            if self.threadEndCount == 2:
+                self.close()
+
+    def close(self):
+        if not self.isStopped:
+            self.isStopped = True
+
+            if hasattr(self, 'target'):
+                try:
+                    self.target.close()
+                except:
+                    pass
+
+            if hasattr(self, 'writeSocket'):
+                try:
+                    self.writeSocket.close()
+                except:
+                    pass
+
+            if hasattr(self, 'readSocket'):
+                try:
+                    self.readSocket.close()
+                except:
+                    pass
+
+            self.onClose()
+            self.log('closed', Logger.LOG_INFO)
+
+    def onClose(self):
+        if not self.onCloseFunction is None:
+            self.onCloseFunction(self)
+
+    def log(self, msg, logLevel):
+        msg = 'Client ' + str(self.id) + ': ' + msg
+        self.logger.printLog(msg, logLevel)
+
+
+class ThreadRelay(threading.Thread):
+    def __init__(self, readSocket, writeSocket, closeFunction=None):
+        super(ThreadRelay, self).__init__()
+        self.readSocket = readSocket
+        self.writeSocket = writeSocket
+        self.logFunction = None
+        self.closeFuntion = closeFunction
+
+    def run(self):
+        try:
+            while True:
+                data = self.readSocket.recv(Client.BUFFER_SIZE)
+                if not data:
+                    break
+                self.writeSocket.sendall(data)
+
+            self.writeSocket.shutdown(socket.SHUT_WR)
+        except Exception as e:
+            if not self.logFunction is None:
+                self.logFunction('threadRelay error: ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+        finally:
+            if not self.closeFuntion is None:
+                self.closeFuntion()
+
+
+
+
+class AcceptClient(threading.Thread):
+    MAX_QTD_BYTES = 5000
+    HEADER_BODY = 'X-Body'
+    HEADER_ACTION = 'X-Action'
+    HEADER_TARGET = 'X-Target'
+    HEADER_PASS = 'X-Pass'
+    HEADER_ID = 'X-Id'
+    ACTION_CREATE = 'create'
+    ACTION_COMPLETE = 'complete'
+    MSG_CONNECTION_CREATED = 'Created'
+    MSG_CONNECTION_COMPLETED = 'Completed'
+
+    ID_COUNT = 0
+    ID_LOCK = threading.Lock()
+
+    def __init__(self, socket, server, passwdSet=None):
+        super(AcceptClient, self).__init__()
+        self.server = server
+        self.passwdSet = passwdSet
+        self.socket = socket
+
+    def run(self):
+        needClose = True
+
+        try:
+            head = self.readHttpRequest()
+
+            bodyLen = self.getHeaderVal(head, AcceptClient.HEADER_BODY)
+            if not bodyLen is None:
+                try:
+                    self.readFully(int(bodyLen))
+                except ValueError:
+                    pass
+
+            action = self.getHeaderVal(head, AcceptClient.HEADER_ACTION)
+
+            if action is None:
+                self.log('client sends no action header', Logger.LOG_WARN)
+                self.socket.sendall('HTTP/1.1 400 NoActionHeader!\r\nServer: GetTunnelServer\r\n\r\n')
+                return
+
+            if action == AcceptClient.ACTION_CREATE:
+                target = self.getHeaderVal(head, AcceptClient.HEADER_TARGET)
+
+                if not self.passwdSet is None:
+                    passwd = self.getHeaderVal(head, AcceptClient.HEADER_PASS)
+
+                    try:
+                        passwd = base64.b64decode(passwd)
+                    except:
+                        passwd = None
+                        pass
+
+                    if passwd is None or not self.passwdSet.isValidKey(passwd, target):
+                        self.log('client sends wrong key', Logger.LOG_WARN)
+                        self.socket.sendall('HTTP/1.1 403 Forbidden\r\nServer: GetTunnelServer\r\n\r\n')
+                        return
+
+                if target is not None and self.isValidHostPort(target):
+                    id = self.generateId()
+
+                    client = Client(id, self.socket, target)
+                    client.onCloseFunction = self.server.removeClient
+                    self.server.addClient(client)
+                    self.socket.sendall('HTTP/1.1 200 '+ AcceptClient.MSG_CONNECTION_CREATED + '\r\nServer: GetTunnelServer\r\nX-Id: ' + str(id) + '\r\nContent-Type: text/plain\r\nContent-Length: 0\r\nConnection: Keep-Alive\r\n\r\n')
+                    self.log('connection created - ' + str(id), Logger.LOG_INFO)
+                    needClose = False
+                else:
+                    self.log('client sends no valid target', Logger.LOG_WARN)
+                    self.socket.sendall('HTTP/1.1 400 Target!\r\nServer: GetTunnelServer\r\n\r\n')
+
+            elif action == AcceptClient.ACTION_COMPLETE:
+                id = self.getHeaderVal(head, AcceptClient.HEADER_ID)
+
+                if not id is None:
+                    client = self.server.getClient(id)
+
+                    if not client is None:
+                        client.writeSocket = self.socket
+
+                        self.log('connection completed - ' + str(id), Logger.LOG_INFO)
+                        self.socket.sendall('HTTP/1.1 200 ' + AcceptClient.MSG_CONNECTION_COMPLETED + '\r\nServer: GetTunnelServer\r\nConnection: Keep-Alive\r\n\r\n')
+
+                        client.start()
+                        needClose = False
+                    else:
+                        self.log('client try to complete non existing connection', Logger.LOG_WARN)
+                        self.socket.sendall('HTTP/1.1 400 CreateFirst!\r\nServer: GetTunnelServer\r\n\r\n')
+                else:
+                    self.log('client sends no id header', Logger.LOG_WARN)
+                    self.socket.sendall('HTTP/1.1 400 NoID!\r\nServer: GetTunnelServer\r\n\r\n')
+            else:
+                self.log('client sends invalid action', Logger.LOG_WARN)
+                self.socket.sendall('HTTP/1.1 400 InvalidAction!\r\nServer: GetTunnelServer\r\n\r\n')
+
+        except Exception as e:
+            self.log('connection error - ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+        finally:
+            if needClose:
+                try:
+                    self.socket.close()
+                except:
+                    pass
+
+    def log(self, msg, logLevel):
+        self.server.log(msg, logLevel)
+
+    def readHttpRequest(self):
+        request = ''
+        linha = ''
+        count = 0
+
+        while linha != '\r\n' and count < AcceptClient.MAX_QTD_BYTES:
+            linha = self.readHttpLine()
+
+            if linha is None:
+                break
+
+            request += linha
+            count += len(linha)
+
+        return request
+
+    def readHttpLine(self):
+        line = ''
+        count = 0
+        socket = self.socket
+
+        b = socket.recv(1)
+
+        if not b:
+            return None
+
+        while count < AcceptClient.MAX_QTD_BYTES:
+            count += 1
+            line += b
+
+            if b == '\r':
+                b = socket.recv(1)
+                count += 1
+
+                if not b:
+                    break
+
+                line += b
+
+                if b == '\n':
+                    break
+
+            b = socket.recv(1)
+
+            if not b:
+                break
+
+        if not b:
+            return None
+
+        return line
+
+    def getHeaderVal(self, head, header):
+        if not head.startswith('\r\n'):
+            header = '\r\n' + header
+
+        if not header.endswith(': '):
+            header = header + ': '
+
+        ini = head.find(header)
+
+        if ini == -1:
+            return None
+
+        end = head.find('\r\n', ini+2)
+
+        ini += len(header)
+
+        if end == -1 or ini > end or ini >= len(head):
+            return None
+
+        return head[ini:end]
+
+    def readFully(self, n):
+        count = 0
+
+        while count < n:
+            packet = self.socket.recv(n - count)
+
+            if not packet:
+                break
+
+            count += len(packet)
+
+    def isValidHostPort(self, hostPort):
+        aux = hostPort.find(':')
+
+        if aux == -1 or aux >= len(hostPort) -1:
+            return False
+
+        try:
+            int(hostPort[aux+1:])
+            return True
+        except ValueError:
+            return False
+
+    def generateId(self):
+        with AcceptClient.ID_LOCK:
+            AcceptClient.ID_COUNT += 1
+            return AcceptClient.ID_COUNT
+
+
+
+class Server(threading.Thread):
+
+    def __init__(self, listening, passwdSet=None):
+        super(Server, self).__init__()
+        self.listening = listening
+        self.passwdSet = passwdSet
+        self.running = False
+        self.logger = Logger()
+        self.isStopped = False
+        self.clientsLock = threading.Lock()
+        self.clients = []
+
+    def run(self):
+        try:
+            self.soc = socket.socket(socket.AF_INET)
+            self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+            self.soc.settimeout(2)
+            self.soc.bind((self.listening[:self.listening.find(':')], int(self.listening[self.listening.find(':') + 1:])))
+            self.soc.listen(0)
+
+            self.log('running on ' + self.listening, Logger.LOG_INFO)
+
+            self.running = True
+            while self.running:
+                try:
+                    c, addr = self.soc.accept()
+                    c.setblocking(1)
+
+                    self.log('opennig connection - ' + str(addr), Logger.LOG_INFO)
+                    self.acceptClient(c)
+                except socket.timeout:
+                    continue
+        except Exception as e:
+            self.log('connection error - ' + str(type(e)) + ' - ' + str(e), Logger.LOG_ERROR)
+        finally:
+            self.running = False
+            self.close()
+
+    def acceptClient(self, socket):
+        accept = AcceptClient(socket, self, self.passwdSet)
+        accept.start()
+
+    def addClient(self, client):
+        with self.clientsLock:
+            self.clients.append(client)
+
+    def removeClient(self, client):
+        with self.clientsLock:
+            self.clients.remove(client)
+
+    def getClient(self, id):
+        client = None
+        with self.clientsLock:
+            for c in self.clients:
+                if str(c.id) == str(id):
+                    client = c
+                    break
+        return client
+
+    def close(self):
+        if not self.isStopped:
+            self.isStopped = True
+
+            if hasattr(self, 'soc'):
+                try:
+                    self.soc.close()
+                except:
+                    pass
+
+            with self.clientsLock:
+                clientsCopy = self.clients[:]
+
+            for c in clientsCopy:
+                c.close()
+
+            self.log('closed', Logger.LOG_INFO)
+
+    def log(self, msg, logLevel):
+        msg = 'Server: ' + msg
+        self.logger.printLog(msg, logLevel)
+
+
+
+
+def print_usage():
+    print '\nUsage  : python get.py -b listening -p pass'
+    print 'Ex.    : python get.py -b 0.0.0.0:80 -p pass123'
+    print '       : python get.py -b 0.0.0.0:80 -p passFile.pwd\n'
+    print '___Password file ex.:___'
+    print PasswordSet.FILE_EXEMPLE
+
+def parse_args(argv):
+    global CONFIG_LISTENING
+    global CONFIG_PASS
+
+    try:
+        opts, args = getopt.getopt(argv, "hb:p:", ["bind=", "pass="])
+    except getopt.GetoptError:
+        print_usage()
+        sys.exit(2)
+    for opt, arg in opts:
+        if opt == '-h':
+            print_usage()
+            sys.exit()
+        elif opt in ('-b', '--bind'):
+            CONFIG_LISTENING = arg
+        elif opt in ('-p', '--pass'):
+            CONFIG_PASS = arg
+
+def main():
+    print '\n-->GetTunnelPy - Server v.' + '25/06/2017' + '\n'
+    print '-->Listening: ' + CONFIG_LISTENING
+
+    pwdSet = None
+
+    if not CONFIG_PASS is None:
+        if CONFIG_PASS.endswith('.pwd'):
+            pwdSet = PasswordSet()
+
+            try:
+                isValidFile = pwdSet.parseFile(CONFIG_PASS)
+            except IOError as e:
+                print '--#Error reading file: ' + str(type(e)) + ' - ' + str(e)
+                sys.exit()
+
+            if not isValidFile:
+                print '--#Error on parsing file!\n'
+                print_usage()
+                return
+
+            print '-->Pass file: ' + CONFIG_PASS + '\n'
+        else:
+            if (len(CONFIG_PASS) > 0):
+                print '-->Pass     : yes\n'
+                pwdSet = PasswordSet(CONFIG_PASS)
+            else:
+                print '-->Pass     : no\n'
+
+    server = Server(CONFIG_LISTENING)
+    server.passwdSet = pwdSet
+    server.start()
+
+    while True:
+        try:
+            time.sleep(2)
+        except KeyboardInterrupt:
+            print '<-> Stopping server...'
+            server.running = False
+            break
+
+if __name__ == '__main__':
+    parse_args(sys.argv[1:])
+    main()

+ 313 - 0
R9/ADMRufu-31/install/POpen.py

@@ -0,0 +1,313 @@
+#!/usr/bin/env python
+
+import sys, httplib, socket, select, gzip, zlib, re, traceback, argparse
+from SocketServer import ThreadingMixIn
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+from threading import Lock, Timer
+from cStringIO import StringIO
+from urlparse import urlsplit
+
+parser = argparse.ArgumentParser()
+parser.add_argument("-p", "--port", help="Nombre de archivo a procesar")
+
+args = parser.parse_args()
+
+if args.port:
+    port = int(args.port)
+else:
+    print(" Deve ingresar el puerto que usara como socks...")
+    sys.exit()
+
+class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
+
+    address_family = socket.AF_INET
+
+    def handle_error(self, request, client_address):
+        
+        print >>sys.stderr, '-'*40
+        print >>sys.stderr, 'Exception happened during processing of request from', client_address
+        traceback.print_exc()
+        print >>sys.stderr, '-'*40
+        
+     
+class ThreadingHTTPServer6(ThreadingHTTPServer):
+
+    address_family = socket.AF_INET6
+
+
+class SimpleHTTPProxyHandler(BaseHTTPRequestHandler):
+    global_lock = Lock()
+    conn_table = {}
+    timeout = 300               
+    upstream_timeout = 300    
+    proxy_via = None          
+
+    def log_error(self, format, *args):
+        if format == "Request timed out: %r":
+            return
+        self.log_message(format, *args)
+
+    def do_CONNECT(self):
+        
+
+        req = self
+        reqbody = None
+        req.path = "https://%s/" % req.path.replace(':443', '')
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+
+        u = urlsplit(req.path)
+        address = (u.hostname, u.port or 443)
+        try:
+            conn = socket.create_connection(address)
+        except socket.error:
+            return
+        self.send_response(200, 'SOCKS5')
+        self.send_header('Connection', 'close')
+        self.end_headers()
+
+        conns = [self.connection, conn]
+        keep_connection = True
+        while keep_connection:
+            keep_connection = False
+            rlist, wlist, xlist = select.select(conns, [], conns, self.timeout)
+            if xlist:
+                break
+            for r in rlist:
+                other = conns[1] if r is conns[0] else conns[0]
+                data = r.recv(8192)
+                if data:
+                    other.sendall(data)
+                    keep_connection = True
+        conn.close()
+
+    def do_HEAD(self):
+        self.do_SPAM()
+
+    def do_GET(self):
+        self.do_SPAM()
+
+    def do_POST(self):
+        self.do_SPAM()
+
+    def do_SPAM(self):
+        req = self
+        content_length = int(req.headers.get('Content-Length', 0))
+        if content_length > 0:
+            reqbody = self.rfile.read(content_length)
+        else:
+            reqbody = None
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+        elif replaced_reqbody is not None:
+            reqbody = replaced_reqbody
+            if 'Content-Length' in req.headers:
+                req.headers['Content-Length'] = str(len(reqbody))
+
+        
+        self.remove_hop_by_hop_headers(req.headers)
+        if self.upstream_timeout:
+            req.headers['Connection'] = 'Keep-Alive'
+        else:
+            req.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(req.headers)
+
+        try:
+            res, resdata = self.request_to_upstream_server(req, reqbody)
+        except socket.error:
+            return
+
+        content_encoding = res.headers.get('Content-Encoding', 'identity')
+        resbody = self.decode_content_body(resdata, content_encoding)
+
+        replaced_resbody = self.response_handler(req, reqbody, res, resbody)
+        if replaced_resbody is True:
+            return
+        elif replaced_resbody is not None:
+            resdata = self.encode_content_body(replaced_resbody, content_encoding)
+            if 'Content-Length' in res.headers:
+                res.headers['Content-Length'] = str(len(resdata))
+            resbody = replaced_resbody
+
+        self.remove_hop_by_hop_headers(res.headers)
+        if self.timeout:
+            res.headers['Connection'] = 'Keep-Alive'
+        else:
+            res.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(res.headers)
+
+        self.send_response(res.status, res.reason)
+        for k, v in res.headers.items():
+            if k == 'set-cookie':
+                
+                for value in self.split_set_cookie_header(v):
+                    self.send_header(k, value)
+            else:
+                self.send_header(k, v)
+        self.end_headers()
+
+        if self.command != 'HEAD':
+            self.wfile.write(resdata)
+            with self.global_lock:
+                self.save_handler(req, reqbody, res, resbody)
+
+    def request_to_upstream_server(self, req, reqbody):
+        u = urlsplit(req.path)
+        origin = (u.scheme, u.netloc)
+
+        
+        req.headers['Host'] = u.netloc
+        selector = "%s?%s" % (u.path, u.query) if u.query else u.path
+
+        while True:
+            with self.lock_origin(origin):
+                conn = self.open_origin(origin)
+                try:
+                    conn.request(req.command, selector, reqbody, headers=dict(req.headers))
+                except socket.error:
+                    
+                    self.close_origin(origin)
+                    raise
+                try:
+                    res = conn.getresponse(buffering=True)
+                except httplib.BadStatusLine as e:
+                    if e.line == "''":
+                        
+                        self.close_origin(origin)
+                        continue
+                    else:
+                        raise
+                resdata = res.read()
+                res.headers = res.msg    
+                if not self.upstream_timeout or 'close' in res.headers.get('Connection', ''):
+                    self.close_origin(origin)
+                else:
+                    self.reset_timer(origin)
+            return res, resdata
+
+    def lock_origin(self, origin):
+        d = self.conn_table.setdefault(origin, {})
+        if not 'lock' in d:
+            d['lock'] = Lock()
+        return d['lock']
+
+    def open_origin(self, origin):
+        conn = self.conn_table[origin].get('connection')
+        if not conn:
+            scheme, netloc = origin
+            if scheme == 'https':
+                conn = httplib.HTTPSConnection(netloc)
+            else:
+                conn = httplib.HTTPConnection(netloc)
+            self.reset_timer(origin)
+            self.conn_table[origin]['connection'] = conn
+        return conn
+
+    def reset_timer(self, origin):
+        timer = self.conn_table[origin].get('timer')
+        if timer:
+            timer.cancel()
+        if self.upstream_timeout:
+            timer = Timer(self.upstream_timeout, self.close_origin, args=[origin])
+            timer.daemon = True
+            timer.start()
+        else:
+            timer = None
+        self.conn_table[origin]['timer'] = timer
+
+    def close_origin(self, origin):
+        timer = self.conn_table[origin]['timer']
+        if timer:
+            timer.cancel()
+        conn = self.conn_table[origin]['connection']
+        conn.close()
+        del self.conn_table[origin]['connection']
+
+    def remove_hop_by_hop_headers(self, headers):
+        hop_by_hop_headers = ['Connection', 'Keep-Alive', 'Proxy-Authenticate', 'Proxy-Authorization', 'TE', 'Trailers', 'Trailer', 'Transfer-Encoding', 'Upgrade']
+        connection = headers.get('Connection')
+        if connection:
+            keys = re.split(r',\s*', connection)
+            hop_by_hop_headers.extend(keys)
+
+        for k in hop_by_hop_headers:
+            if k in headers:
+                del headers[k]
+
+    def modify_via_header(self, headers):
+        via_string = "%s %s" % (self.protocol_version, self.proxy_via)
+        via_string = re.sub(r'^HTTP/', '', via_string)
+
+        original = headers.get('Via')
+        if original:
+            headers['Via'] = original + ', ' + via_string
+        else:
+            headers['Via'] = via_string
+
+    def decode_content_body(self, data, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO(data)
+            with gzip.GzipFile(fileobj=io) as f:
+                body = f.read()
+        elif content_encoding == 'deflate':
+            body = zlib.decompress(data)
+        elif content_encoding == 'identity':
+            body = data
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return body
+
+    def encode_content_body(self, body, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO()
+            with gzip.GzipFile(fileobj=io, mode='wb') as f:
+                f.write(body)
+            data = io.getvalue()
+        elif content_encoding == 'deflate':
+            data = zlib.compress(body)
+        elif content_encoding == 'identity':
+            data = body
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return data
+
+    def split_set_cookie_header(self, value):
+        re_cookies = r'([^=]+=[^,;]+(?:;\s*Expires=[^,]+,[^,;]+|;[^,;]+)*)(?:,\s*)?'
+        return re.findall(re_cookies, value, flags=re.IGNORECASE)
+
+    def request_handler(self, req, reqbody):
+        
+        pass
+
+    def response_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+    def save_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+
+# Port
+
+def test(HandlerClass=SimpleHTTPProxyHandler, ServerClass=ThreadingHTTPServer, protocol="HTTP/1.1"):
+
+    server_address = ('', port)
+
+    HandlerClass.protocol_version = protocol
+    httpd = ServerClass(server_address, HandlerClass)
+
+    sa = httpd.socket.getsockname()
+    print "Serving HTTP on", sa[0], "port", sa[1], "..."
+    httpd.serve_forever()
+
+
+if __name__ == '__main__':
+    test()
+

+ 341 - 0
R9/ADMRufu-31/install/PPriv.py

@@ -0,0 +1,341 @@
+#!/usr/bin/env python
+
+# -*- coding: utf-8 -*-
+# Edit By GlEmYsSoN & @e8th4ever
+
+from pprint import pprint
+import sys, http.client, socket, select, gzip, zlib, re, traceback, subprocess, argparse
+from socketserver import ThreadingMixIn
+from http.server import HTTPServer, BaseHTTPRequestHandler
+from threading import Lock, Timer
+from io import StringIO
+from urllib.parse import urlsplit
+
+subprocess.call("clear",shell=True)
+
+parser = argparse.ArgumentParser()
+parser.add_argument("-p", "--port", help="Nombre de archivo a procesar")
+parser.add_argument("-t", "--texto", help="Nombre de archivo a procesar")
+parser.add_argument("-i", "--ip", help="Nombre de archivo a procesar")
+
+args = parser.parse_args()
+
+if args.port:
+    port = int(args.port)
+else:
+    print(" Deve ingresar el puerto que usara como socks...")
+    sys.exit()
+
+if args.texto:
+    msg1 = args.texto
+else:
+    msg1 = '<strong><font color="#00FFFF">A</font><font color="#6bffff">D</font><font color="#99ffff">M</font><font color="#ebffff">@</font><font color="#ebffff">R</font><font color="#ccffff">u</font><font color="#99ffff">f</font><font color="#6bffff">u</font><font color="#2effff">9</font><font color="#00FFFF">9</font></strong>'
+
+if args.ip:
+    server = args.ip
+else:
+    server = "127.0.0.1"
+
+msg2 = 'Server Forbidden'
+
+class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
+
+    address_family = socket.AF_INET
+
+    def handle_error(self, request, client_address):
+        
+        print('-'*40, file=sys.stderr)
+        print('Exception happened during processing of request from', client_address, file=sys.stderr)
+        traceback.print_exc()
+        print('-'*40, file=sys.stderr)
+        
+     
+class ThreadingHTTPServer6(ThreadingHTTPServer):
+
+    address_family = socket.AF_INET6
+
+
+class SimpleHTTPProxyHandler(BaseHTTPRequestHandler):
+    global_lock = Lock()
+    conn_table = {}
+    timeout = 300               
+    upstream_timeout = 300    
+    proxy_via = None          
+
+    def log_error(self, format, *args):
+        if format == "Request timed out: %r":
+            return
+        self.log_message(format, *args)
+
+    def do_CONNECT(self):
+
+        req = self
+        reqbody = None
+        if ':22' in req.path:
+            hostip = req.path.replace(':22', '')
+        elif ':443' in req.path:
+            hostip = req.path.replace(':443', '')
+        req.path = "https://%s/" % req.path.replace(':443', '')
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+
+        u = urlsplit(req.path)
+        address = (u.hostname, u.port or 443)
+        try:
+            conn = socket.create_connection(address)
+        except socket.error:
+            return
+
+        self.send_response(200, msg1)
+        self.send_header('Connection', 'close')
+        self.end_headers()
+
+        conns = [self.connection, conn]
+        keep_connection = True
+        while keep_connection:
+            if not server.find(hostip) != -1:
+                self.send_error(403, msg2)
+                self.close_connection
+            keep_connection = False
+            rlist, wlist, xlist = select.select(conns, [], conns, self.timeout)
+            if xlist:
+                break
+            for r in rlist:
+                other = conns[1] if r is conns[0] else conns[0]
+                data = r.recv(8192)
+                if data:
+                    other.sendall(data)
+                    keep_connection = True
+        conn.close()
+
+    def do_HEAD(self):
+        self.do_SPAM()
+
+    def do_GET(self):
+        self.do_SPAM()
+
+    def do_POST(self):
+        self.do_SPAM()
+
+    def do_SPAM(self):
+        req = self
+
+        content_length = int(req.headers.get('Content-Length', 0))
+        if content_length > 0:
+            reqbody = self.rfile.read(content_length)
+        else:
+            reqbody = None
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+        elif replaced_reqbody is not None:
+            reqbody = replaced_reqbody
+            if 'Content-Length' in req.headers:
+                req.headers['Content-Length'] = str(len(reqbody))
+
+        
+        self.remove_hop_by_hop_headers(req.headers)
+        if self.upstream_timeout:
+            req.headers['Connection'] = 'Keep-Alive'
+        else:
+            req.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(req.headers)
+
+        try:
+            res, resdata = self.request_to_upstream_server(req, reqbody)
+        except socket.error:
+            return
+
+        content_encoding = res.headers.get('Content-Encoding', 'identity')
+        resbody = self.decode_content_body(resdata, content_encoding)
+
+        replaced_resbody = self.response_handler(req, reqbody, res, resbody)
+        if replaced_resbody is True:
+            return
+        elif replaced_resbody is not None:
+            resdata = self.encode_content_body(replaced_resbody, content_encoding)
+            if 'Content-Length' in res.headers:
+                res.headers['Content-Length'] = str(len(resdata))
+            resbody = replaced_resbody
+
+        self.remove_hop_by_hop_headers(res.headers)
+        if self.timeout:
+            res.headers['Connection'] = 'Keep-Alive'
+        else:
+            res.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(res.headers)
+
+        self.send_response(res.status, res.reason)
+        for k, v in list(res.headers.items()):
+            if k == 'set-cookie':
+                
+                for value in self.split_set_cookie_header(v):
+                    self.send_header(k, value)
+            else:
+                self.send_header(k, v)
+        self.end_headers()
+
+        if self.command != 'HEAD':
+            self.wfile.write(resdata)
+            with self.global_lock:
+                self.save_handler(req, reqbody, res, resbody)
+
+    def request_to_upstream_server(self, req, reqbody):
+        u = urlsplit(req.path)
+
+        origin = (u.scheme, u.netloc)
+
+        
+        req.headers['Host'] = u.netloc
+        selector = "%s?%s" % (u.path, u.query) if u.query else u.path
+
+        while True:
+            with self.lock_origin(origin):
+                conn = self.open_origin(origin)
+                try:
+                    conn.request(req.command, selector, reqbody, headers=dict(req.headers))
+                except socket.error:
+                    
+                    self.close_origin(origin)
+                    raise
+                try:
+                    res = conn.getresponse(buffering=True)
+                except http.client.BadStatusLine as e:
+                    if e.line == "''":
+                        
+                        self.close_origin(origin)
+                        continue
+                    else:
+                        raise
+                resdata = res.read()
+                res.headers = res.msg    
+                if not self.upstream_timeout or 'close' in res.headers.get('Connection', ''):
+                    self.close_origin(origin)
+                else:
+                    self.reset_timer(origin)
+            return res, resdata
+
+    def lock_origin(self, origin):
+        d = self.conn_table.setdefault(origin, {})
+        if not 'lock' in d:
+            d['lock'] = Lock()
+        return d['lock']
+
+    def open_origin(self, origin):
+        conn = self.conn_table[origin].get('connection')
+        if not conn:
+            scheme, netloc = origin
+            if scheme == 'https':
+                conn = http.client.HTTPSConnection(netloc)
+            else:
+                conn = http.client.HTTPConnection(netloc)
+            self.reset_timer(origin)
+            self.conn_table[origin]['connection'] = conn
+        return conn
+
+    def reset_timer(self, origin):
+        timer = self.conn_table[origin].get('timer')
+        if timer:
+            timer.cancel()
+        if self.upstream_timeout:
+            timer = Timer(self.upstream_timeout, self.close_origin, args=[origin])
+            timer.daemon = True
+            timer.start()
+        else:
+            timer = None
+        self.conn_table[origin]['timer'] = timer
+
+    def close_origin(self, origin):
+        timer = self.conn_table[origin]['timer']
+        if timer:
+            timer.cancel()
+        conn = self.conn_table[origin]['connection']
+        conn.close()
+        del self.conn_table[origin]['connection']
+
+    def remove_hop_by_hop_headers(self, headers):
+        hop_by_hop_headers = ['Connection', 'Keep-Alive', 'Proxy-Authenticate', 'Proxy-Authorization', 'TE', 'Trailers', 'Trailer', 'Transfer-Encoding', 'Upgrade']
+        connection = headers.get('Connection')
+        if connection:
+            keys = re.split(r',\s*', connection)
+            hop_by_hop_headers.extend(keys)
+
+        for k in hop_by_hop_headers:
+            if k in headers:
+                del headers[k]
+
+    def modify_via_header(self, headers):
+        via_string = "%s %s" % (self.protocol_version, self.proxy_via)
+        via_string = re.sub(r'^HTTP/', '', via_string)
+
+        original = headers.get('Via')
+        if original:
+            headers['Via'] = original + ', ' + via_string
+        else:
+            headers['Via'] = via_string
+
+    def decode_content_body(self, data, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO(data)
+            with gzip.GzipFile(fileobj=io) as f:
+                body = f.read()
+        elif content_encoding == 'deflate':
+            body = zlib.decompress(data)
+        elif content_encoding == 'identity':
+            body = data
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return body
+
+    def encode_content_body(self, body, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO()
+            with gzip.GzipFile(fileobj=io, mode='wb') as f:
+                f.write(body)
+            data = io.getvalue()
+        elif content_encoding == 'deflate':
+            data = zlib.compress(body)
+        elif content_encoding == 'identity':
+            data = body
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return data
+
+    def split_set_cookie_header(self, value):
+        re_cookies = r'([^=]+=[^,;]+(?:;\s*Expires=[^,]+,[^,;]+|;[^,;]+)*)(?:,\s*)?'
+        return re.findall(re_cookies, value, flags=re.IGNORECASE)
+
+    def request_handler(self, req, reqbody):
+        
+        pass
+
+    def response_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+    def save_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+
+
+
+def test(HandlerClass=SimpleHTTPProxyHandler, ServerClass=ThreadingHTTPServer, protocol="HTTP/1.1"):
+
+    server_address = ('', port)
+
+    HandlerClass.protocol_version = protocol
+    httpd = ServerClass(server_address, HandlerClass)
+
+    sa = httpd.socket.getsockname()
+    print("Servidor: " + str(sa[0]) + " Porta " + str(sa[1]))
+    httpd.serve_forever()
+
+
+if __name__ == '__main__':
+    test()

+ 320 - 0
R9/ADMRufu-31/install/PPub.py

@@ -0,0 +1,320 @@
+#!/usr/bin/env python
+
+import sys, httplib, socket, select, gzip, zlib, re, traceback, argparse
+
+from SocketServer import ThreadingMixIn
+from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
+from threading import Lock, Timer
+from cStringIO import StringIO
+from urlparse import urlsplit
+
+parser = argparse.ArgumentParser()
+parser.add_argument("-p", "--port", help="Nombre de archivo a procesar")
+parser.add_argument("-t", "--texto", help="Nombre de archivo a procesar")
+
+args = parser.parse_args()
+
+if args.port:
+    port = int(args.port)
+else:
+    print " Deve ingresar el puerto que usara como socks..."
+    sys.exit()
+
+if args.texto:
+    msg1 = args.texto
+else:
+    msg1 = '<strong><font color="#00FFFF">A</font><font color="#6bffff">D</font><font color="#99ffff">M</font><font color="#ebffff">@</font><font color="#ebffff">R</font><font color="#ccffff">u</font><font color="#99ffff">f</font><font color="#6bffff">u</font><font color="#2effff">9</font><font color="#00FFFF">9</font></strong>'
+
+class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
+
+    address_family = socket.AF_INET
+
+    def handle_error(self, request, client_address):
+        
+        print >>sys.stderr, '-'*40
+        print >>sys.stderr, 'Exception happened during processing of request from', client_address
+        traceback.print_exc()
+        print >>sys.stderr, '-'*40
+        
+     
+class ThreadingHTTPServer6(ThreadingHTTPServer):
+
+    address_family = socket.AF_INET6
+
+
+class SimpleHTTPProxyHandler(BaseHTTPRequestHandler):
+    global_lock = Lock()
+    conn_table = {}
+    timeout = 300               
+    upstream_timeout = 300    
+    proxy_via = None          
+
+    def log_error(self, format, *args):
+        if format == "Request timed out: %r":
+            return
+        self.log_message(format, *args)
+
+    def do_CONNECT(self):
+        
+
+        req = self
+        reqbody = None
+        req.path = "https://%s/" % req.path.replace(':443', '')
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+
+        u = urlsplit(req.path)
+        address = (u.hostname, u.port or 443)
+        try:
+            conn = socket.create_connection(address)
+        except socket.error:
+            return
+        self.send_response(200, msg1)
+        self.send_header('Connection', 'close')
+        self.end_headers()
+
+        conns = [self.connection, conn] 
+        keep_connection = True
+        while keep_connection:
+            keep_connection = False
+            rlist, wlist, xlist = select.select(conns, [], conns, self.timeout)
+            if xlist:
+                break
+            for r in rlist:
+                other = conns[1] if r is conns[0] else conns[0]
+                data = r.recv(8192)
+                if data:
+                    other.sendall(data)
+                    keep_connection = True
+        conn.close()
+
+    def do_HEAD(self):
+        self.do_SPAM()
+
+    def do_GET(self):
+        self.do_SPAM()
+
+    def do_POST(self):
+        self.do_SPAM()
+
+    def do_SPAM(self):
+        req = self
+        content_length = int(req.headers.get('Content-Length', 0))
+        if content_length > 0:
+            reqbody = self.rfile.read(content_length)
+        else:
+            reqbody = None
+
+        replaced_reqbody = self.request_handler(req, reqbody)
+        if replaced_reqbody is True:
+            return
+        elif replaced_reqbody is not None:
+            reqbody = replaced_reqbody
+            if 'Content-Length' in req.headers:
+                req.headers['Content-Length'] = str(len(reqbody))
+
+        
+        self.remove_hop_by_hop_headers(req.headers)
+        if self.upstream_timeout:
+            req.headers['Connection'] = 'Keep-Alive'
+        else:
+            req.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(req.headers)
+
+        try:
+            res, resdata = self.request_to_upstream_server(req, reqbody)
+        except socket.error:
+            return
+
+        content_encoding = res.headers.get('Content-Encoding', 'identity')
+        resbody = self.decode_content_body(resdata, content_encoding)
+
+        replaced_resbody = self.response_handler(req, reqbody, res, resbody)
+        if replaced_resbody is True:
+            return
+        elif replaced_resbody is not None:
+            resdata = self.encode_content_body(replaced_resbody, content_encoding)
+            if 'Content-Length' in res.headers:
+                res.headers['Content-Length'] = str(len(resdata))
+            resbody = replaced_resbody
+
+        self.remove_hop_by_hop_headers(res.headers)
+        if self.timeout:
+            res.headers['Connection'] = 'Keep-Alive'
+        else:
+            res.headers['Connection'] = 'close'
+        if self.proxy_via:
+            self.modify_via_header(res.headers)
+
+        self.send_response(res.status, res.reason)
+        for k, v in res.headers.items():
+            if k == 'set-cookie':
+                
+                for value in self.split_set_cookie_header(v):
+                    self.send_header(k, value)
+            else:
+                self.send_header(k, v)
+        self.end_headers()
+
+        if self.command != 'HEAD':
+            self.wfile.write(resdata)
+            with self.global_lock:
+                self.save_handler(req, reqbody, res, resbody)
+
+    def request_to_upstream_server(self, req, reqbody):
+        u = urlsplit(req.path)
+        origin = (u.scheme, u.netloc)
+
+        
+        req.headers['Host'] = u.netloc
+        selector = "%s?%s" % (u.path, u.query) if u.query else u.path
+
+        while True:
+            with self.lock_origin(origin):
+                conn = self.open_origin(origin)
+                try:
+                    conn.request(req.command, selector, reqbody, headers=dict(req.headers))
+                except socket.error:
+                    
+                    self.close_origin(origin)
+                    raise
+                try:
+                    res = conn.getresponse(buffering=True)
+                except httplib.BadStatusLine as e:
+                    if e.line == "''":
+                        
+                        self.close_origin(origin)
+                        continue
+                    else:
+                        raise
+                resdata = res.read()
+                res.headers = res.msg    
+                if not self.upstream_timeout or 'close' in res.headers.get('Connection', ''):
+                    self.close_origin(origin)
+                else:
+                    self.reset_timer(origin)
+            return res, resdata
+
+    def lock_origin(self, origin):
+        d = self.conn_table.setdefault(origin, {})
+        if not 'lock' in d:
+            d['lock'] = Lock()
+        return d['lock']
+
+    def open_origin(self, origin):
+        conn = self.conn_table[origin].get('connection')
+        if not conn:
+            scheme, netloc = origin
+            if scheme == 'https':
+                conn = httplib.HTTPSConnection(netloc)
+            else:
+                conn = httplib.HTTPConnection(netloc)
+            self.reset_timer(origin)
+            self.conn_table[origin]['connection'] = conn
+        return conn
+
+    def reset_timer(self, origin):
+        timer = self.conn_table[origin].get('timer')
+        if timer:
+            timer.cancel()
+        if self.upstream_timeout:
+            timer = Timer(self.upstream_timeout, self.close_origin, args=[origin])
+            timer.daemon = True
+            timer.start()
+        else:
+            timer = None
+        self.conn_table[origin]['timer'] = timer
+
+    def close_origin(self, origin):
+        timer = self.conn_table[origin]['timer']
+        if timer:
+            timer.cancel()
+        conn = self.conn_table[origin]['connection']
+        conn.close()
+        del self.conn_table[origin]['connection']
+
+    def remove_hop_by_hop_headers(self, headers):
+        hop_by_hop_headers = ['Connection', 'Keep-Alive', 'Proxy-Authenticate', 'Proxy-Authorization', 'TE', 'Trailers', 'Trailer', 'Transfer-Encoding', 'Upgrade']
+        connection = headers.get('Connection')
+        if connection:
+            keys = re.split(r',\s*', connection)
+            hop_by_hop_headers.extend(keys)
+
+        for k in hop_by_hop_headers:
+            if k in headers:
+                del headers[k]
+
+    def modify_via_header(self, headers):
+        via_string = "%s %s" % (self.protocol_version, self.proxy_via)
+        via_string = re.sub(r'^HTTP/', '', via_string)
+
+        original = headers.get('Via')
+        if original:
+            headers['Via'] = original + ', ' + via_string
+        else:
+            headers['Via'] = via_string
+
+    def decode_content_body(self, data, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO(data)
+            with gzip.GzipFile(fileobj=io) as f:
+                body = f.read()
+        elif content_encoding == 'deflate':
+            body = zlib.decompress(data)
+        elif content_encoding == 'identity':
+            body = data
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return body
+
+    def encode_content_body(self, body, content_encoding):
+        if content_encoding in ('gzip', 'x-gzip'):
+            io = StringIO()
+            with gzip.GzipFile(fileobj=io, mode='wb') as f:
+                f.write(body)
+            data = io.getvalue()
+        elif content_encoding == 'deflate':
+            data = zlib.compress(body)
+        elif content_encoding == 'identity':
+            data = body
+        else:
+            raise Exception("Unknown Content-Encoding: %s" % content_encoding)
+        return data
+
+    def split_set_cookie_header(self, value):
+        re_cookies = r'([^=]+=[^,;]+(?:;\s*Expires=[^,]+,[^,;]+|;[^,;]+)*)(?:,\s*)?'
+        return re.findall(re_cookies, value, flags=re.IGNORECASE)
+
+    def request_handler(self, req, reqbody):
+        
+        pass
+
+    def response_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+    def save_handler(self, req, reqbody, res, resbody):
+     
+        pass
+
+
+
+
+def test(HandlerClass=SimpleHTTPProxyHandler, ServerClass=ThreadingHTTPServer, protocol="HTTP/1.1"):
+
+    server_address = ('', port)
+
+    HandlerClass.protocol_version = protocol
+    httpd = ServerClass(server_address, HandlerClass)
+
+    sa = httpd.socket.getsockname()
+    print "Serving HTTP on", sa[0], "port", sa[1], "..."
+    httpd.serve_forever()
+
+
+if __name__ == '__main__':
+    test()
+

+ 102 - 0
R9/ADMRufu-31/install/WS-Proxy.js

@@ -0,0 +1,102 @@
+/*
+* Proxy Bridge
+* Copyright PANCHO7532 - P7COMUnications LLC (c) 2021
+* Dedicated to Emanuel Miranda, for giving me the idea to make this :v
+*/
+const net = require('net');
+const stream = require('stream');
+const util = require('util');
+var dhost = "127.0.0.1";
+var dport = "8080";
+var mainPort = "8888";
+var outputFile = "outputFile.txt";
+var packetsToSkip = 0;
+var gcwarn = true;
+for(c = 0; c < process.argv.length; c++) {
+    switch(process.argv[c]) {
+        case "-skip":
+            packetsToSkip = process.argv[c + 1];
+            break;
+        case "-dhost":
+            dhost = process.argv[c + 1];
+            break;
+        case "-dport":
+            dport = process.argv[c + 1];
+            break;
+        case "-mport":
+            mainPort = process.argv[c + 1];
+            break;
+        case "-o":
+            outputFile = process.argv[c + 1];
+            break;
+    }
+}
+function gcollector() {
+    if(!global.gc && gcwarn) {
+        console.log("[WARNING] - Garbage Collector isn't enabled! Memory leaks may occur.");
+        gcwarn = false;
+        return;
+    } else if(global.gc) {
+        global.gc();
+        return;
+    } else {
+        return;
+    }
+}
+function parseRemoteAddr(raddr) {
+    if(raddr.toString().indexOf("ffff") != -1) {
+        //is IPV4 address
+        return raddr.substring(7, raddr.length);
+    } else {
+        return raddr;
+    }
+}
+setInterval(gcollector, 1000);
+const server = net.createServer();
+server.on('connection', function(socket) {
+    var packetCount = 0;
+    //var handshakeMade = false;
+    socket.write("HTTP/1.1 101 Switching Protocols\r\nContent-Length: 1048576000000\r\n\r\n");
+    console.log("[INFO] - Connection received from " + socket.remoteAddress + ":" + socket.remotePort);
+    var conn = net.createConnection({host: dhost, port: dport});
+    socket.on('data', function(data) {
+        //pipe sucks
+        if(packetCount < packetsToSkip) {
+            //console.log("---c1");
+            packetCount++;
+        } else if(packetCount == packetsToSkip) {
+            //console.log("---c2");
+            conn.write(data);
+        }
+        if(packetCount > packetsToSkip) {
+            //console.log("---c3");
+            packetCount = packetsToSkip;
+        }
+        //conn.write(data);
+    });
+    conn.on('data', function(data) {
+        //pipe sucks x2
+        socket.write(data);
+    });
+    socket.once('data', function(data) {
+        /*
+        * Nota para mas tarde, resolver que diferencia hay entre .on y .once
+        */
+    });
+    socket.on('error', function(error) {
+        console.log("[SOCKET] - read " + error + " from " + socket.remoteAddress + ":" + socket.remotePort);
+        conn.destroy();
+    });
+    conn.on('error', function(error) {
+        console.log("[REMOTE] - read " + error);
+        socket.destroy();
+    });
+    socket.on('close', function() {
+        console.log("[INFO] - Connection terminated for " + socket.remoteAddress + ":" + socket.remotePort);
+        conn.destroy();
+    });
+});
+server.listen(mainPort, function(){
+    console.log("[INFO] - Server started on port: " + mainPort);
+    console.log("[INFO] - Redirecting requests to: " + dhost + " at port " + dport);
+});

+ 92 - 0
R9/ADMRufu-31/install/budp.sh

@@ -0,0 +1,92 @@
+#!/bin/bash
+#19/12/2019
+clear
+msg -bar
+
+BadVPN () {
+if [[ -z $(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "badvpn-ud"|awk '{print $1}') ]]; then
+    print_center -ama "INICIADO BADVPN"
+    msg -bar
+
+echo -e "[Unit]
+Description=BadVPN UDPGW Service
+After=network.target\n
+[Service]
+Type=simple
+User=root
+WorkingDirectory=/root
+ExecStart=/usr/bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 10
+Restart=always
+RestartSec=3s\n
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/badvpn.service
+
+    systemctl enable badvpn &>/dev/null
+    systemctl start badvpn &>/dev/null
+    sleep 2
+    [[ -z $(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "badvpn-ud"|awk '{print $1}') ]] && print_center -verm2 "FALLA AL INICIAR" || print_center -verd "BADVPN INICIADO" 
+    sleep 1
+else
+    print_center -ama "DETENIENDO BADVPN"
+    msg -bar
+    systemctl stop badvpn &>/dev/null
+    systemctl disable badvpn &>/dev/null
+    rm /etc/systemd/system/badvpn.service
+    sleep 2
+    [[ -z $(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "badvpn-ud"|awk '{print $1}') ]] && print_center -ama "BADVPN DETENIDO" || print_center -verm2 "FALLA AL DETENER"
+    sleep 1  
+fi
+unset st_badvpn
+enter
+return 1
+}
+
+install(){
+	title "INSTALADO BADVPN"
+	if [[ ! -e /usr/bin/badvpn-udpgw ]]; then
+		echo -ne "$(msg -azu " INSTALADO DEPENDECIAS...") "
+		if apt install cmake -y &>/dev/null; then
+			msg -verd "[OK]"
+		else
+            msg -verm2 "[fail]"
+            slee 3
+            return 1
+        fi
+        cd ${ADM_src}
+        echo -ne "$(msg -azu " DESCARGANDO BADVPN......") "
+        if wget https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/Utils/badvpn/badvpn-master.zip &>/dev/null; then
+            msg -verd "[OK]"
+        else
+            msg -verm2 "[fail]"
+            slee 3
+            return 1
+        fi
+
+        echo -ne "$(msg -azu " DESCOMPRIMIENDO.........") "
+        if unzip badvpn-master.zip &>/dev/null; then
+            msg -verd "[OK]"
+        else
+            msg -verm2 "[fail]"
+            slee 3
+            return 1
+        fi
+        cd badvpn-master
+        mkdir build
+        cd build
+
+        echo -ne "$(msg -azu " COMPILANDO BADVPN.......") "
+        if cmake .. -DCMAKE_INSTALL_PREFIX="/" -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_UDPGW=1 &>/dev/null && make install &>/dev/null; then
+            msg -verd "[OK]"
+        else
+            msg -verm2 "[fail]"
+            slee 3
+            return 1
+        fi
+        msg -bar
+        cd $HOME
+        rm ${ADM_src}/badvpn-master.zip &>/dev/null
+    fi
+    BadVPN
+}
+install
+

+ 366 - 0
R9/ADMRufu-31/install/cert.sh

@@ -0,0 +1,366 @@
+#!/bin/bash
+#====FUNCIONES==========
+
+cert_install(){
+    #apt install socat netcat -y
+    if [[ ! -e $HOME/.acme.sh/acme.sh ]];then
+    	msg -bar3
+    	msg -ama " Instalando script acme.sh"
+    	curl -s "https://get.acme.sh" | sh &>/dev/null
+    fi
+    if [[ ! -z "${mail}" ]]; then
+    	title "LOGEANDO EN Zerossl"
+    	sleep 3
+    	$HOME/.acme.sh/acme.sh --register-account  -m ${mail} --server zerossl
+    	$HOME/.acme.sh/acme.sh --set-default-ca --server zerossl
+    	enter
+    else
+    	title "APLICANDO SERVIDOR letsencrypt"
+    	sleep 3
+    	$HOME/.acme.sh/acme.sh --set-default-ca --server letsencrypt
+    	enter
+    fi
+    title "GENERANDO CERTIFICADO SSL"
+    sleep 3
+    if "$HOME"/.acme.sh/acme.sh --issue -d "${domain}" --standalone -k ec-256 --force; then
+    	"$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath ${ADM_crt}/${domain}.crt --keypath ${ADM_crt}/${domain}.key --ecc --force &>/dev/null
+    	rm -rf $HOME/.acme.sh/${domain}_ecc
+    	msg -bar
+    	print_center -verd "Certificado SSL se genero con éxito"
+    	enter
+    	return 1
+    else
+    	rm -rf "$HOME/.acme.sh/${domain}_ecc"
+    	msg -bar
+    	print_center -verm2 "Error al generar el certificado SSL"
+    	msg -bar
+    	msg -ama " verifique los posibles error"
+    	msg -ama " e intente de nuevo"
+    	enter
+    	return 1
+    fi
+ }
+
+ext_cert(){
+	unset cert
+	declare -A cert
+	title "INTALADOR DE CERTIFICADO EXTERNO"
+	print_center -azu "Requiere tener a mano su certificado ssl"
+	print_center -azu "junto a su correspondiente clave privada"
+	msg -bar
+	msg -ne " Continuar...[S/N]: "
+	read opcion
+	[[ $opcion != @(S|s|Y|y) ]] && return 1
+
+
+	title "INGRESE EL CONTENIDO DE SU CERTIFICADO SSL"
+	msg -ama ' a continuacion se abrira el editor de texto nano 
+ ingrese el contenido de su certificado
+ guardar precionando "CTRL+x"
+ luego "S o Y" segun el idioma
+ y por ultimo "enter"'
+ 	msg -bar
+ 	msg -ne " Continuar...[S/N]: "
+	read opcion
+	[[ $opcion != @(S|s|Y|y) ]] && return 1
+	rm -rf ${ADM_tmp}/tmp.crt
+	clear
+	nano ${ADM_tmp}/tmp.crt
+
+	title "INGRESE EL CONTENIDO DE CLAVE PRIVADA"
+	msg -ama ' a continuacion se abrira el editor de texto nano 
+ ingrese el contenido de su clave privada.
+ guardar precionando "CTRL+x"
+ luego "S o Y" segun el idioma
+ y por ultimo "enter"'
+ 	msg -bar
+ 	msg -ne " Continuar...[S/N]: "
+	read opcion
+	[[ $opcion != @(S|s|Y|y) ]] && return 1
+	${ADM_tmp}/tmp.key
+	clear
+	nano ${ADM_tmp}/tmp.key
+
+	if openssl x509 -in ${ADM_tmp}/tmp.crt -text -noout &>/dev/null ; then
+		DNS=$(openssl x509 -in ${ADM_tmp}/tmp.crt -text -noout | grep 'DNS:'|sed 's/, /\n/g'|sed 's/DNS:\| //g')
+		rm -rf ${ADM_crt}/*
+		if [[ $(echo "$DNS"|wc -l) -gt "1" ]]; then
+			DNS="multi-domain"
+		fi
+		mv ${ADM_tmp}/tmp.crt ${ADM_crt}/$DNS.crt
+		mv ${ADM_tmp}/tmp.key ${ADM_crt}/$DNS.key
+
+		title "INSTALACION COMPLETA"
+		echo -e "$(msg -verm2 "Domi: ")$(msg -ama "$DNS")"
+		echo -e "$(msg -verm2 "Emit: ")$(msg -ama "$(openssl x509 -noout -in ${ADM_crt}/$DNS.crt -startdate|sed 's/notBefore=//g')")"
+		echo -e "$(msg -verm2 "Expi: ")$(msg -ama "$(openssl x509 -noout -in ${ADM_crt}/$DNS.crt -enddate|sed 's/notAfter=//g')")"
+		echo -e "$(msg -verm2 "Cert: ")$(msg -ama "$(openssl x509 -noout -in ${ADM_crt}/$DNS.crt -issuer|sed 's/issuer=//g'|sed 's/ = /=/g'|sed 's/, /\n      /g')")"
+		msg -bar
+		echo "$DNS" > ${ADM_src}/dominio.txt
+		read foo
+	else
+		rm -rf ${ADM_tmp}/tmp.crt
+		rm -rf ${ADM_tmp}/tmp.key
+		clear
+		msg -bar
+		print_center -verm2 "ERROR DE DATOS"
+		msg -bar
+		msg -ama " Los datos ingresados no son validos.\n por favor verifique.\n e intente de nuevo!!"
+		msg -bar
+		read foo
+	fi
+	return 1
+}
+
+stop_port(){
+	msg -bar3
+	msg -ama " Comprovando puertos..."
+	ports=('80' '443')
+
+	for i in ${ports[@]}; do
+		if [[ 0 -ne $(lsof -i:$i | grep -i -c "listen") ]]; then
+			msg -bar3
+			echo -ne "$(msg -ama " Liberando puerto: $i")"
+			lsof -i:$i | awk '{print $2}' | grep -v "PID" | xargs kill -9
+			sleep 2s
+			if [[ 0 -ne $(lsof -i:$i | grep -i -c "listen") ]];then
+				tput cuu1 && tput dl1
+				print_center -verm2 "ERROR AL LIBERAR PURTO $i"
+				msg -bar3
+				msg -ama " Puerto $i en uso."
+				msg -ama " auto-liberacion fallida"
+				msg -ama " detenga el puerto $i manualmente"
+				msg -ama " e intentar nuevamente..."
+				msg -bar
+				read foo
+				return 1			
+			fi
+		fi
+	done
+ }
+
+ger_cert(){
+	clear
+	case $1 in
+		1)title "Generador De Certificado Let's Encrypt";;
+		2)title "Generador De Certificado Zerossl";;
+	esac
+	print_center -ama "Requiere ingresar un dominio."
+	print_center -ama "el mismo solo deve resolver DNS, y apuntar"
+	print_center -ama "a la direccion ip de este servidor."
+	msg -bar3
+	print_center -ama "Temporalmente requiere tener"
+	print_center -ama "los puertos 80 y 443 libres."
+	if [[ $1 = 2 ]]; then
+		msg -bar3
+		print_center -ama "Requiere tener una cuenta Zerossl."
+	fi
+	msg -bar
+ 	msg -ne " Continuar [S/N]: "
+	read opcion
+	[[ $opcion != @(s|S|y|Y) ]] && return 1
+
+	if [[ $1 = 2 ]]; then
+     while [[ -z $mail ]]; do
+     	clear
+		msg -bar
+		print_center -ama "ingresa tu correo usado en zerossl"
+		msg -bar3
+		msg -ne " >>> "
+		read mail
+	 done
+	fi
+
+	if [[ -e ${ADM_src}/dominio.txt ]]; then
+		domain=$(cat ${ADM_src}/dominio.txt)
+		[[ $domain = "multi-domain" ]] && unset domain
+		if [[ ! -z $domain ]]; then
+			clear
+			msg -bar
+			print_center -azu "Dominio asociado a esta ip"
+			msg -bar3
+			echo -e "$(msg -verm2 " >>> ") $(msg -ama "$domain")"
+			msg -ne "Continuar, usando este dominio? [S/N]: "
+			read opcion
+			tput cuu1 && tput dl1
+			[[ $opcion != @(S|s|Y|y) ]] && unset domain
+		fi
+	fi
+
+	while [[ -z $domain ]]; do
+		clear
+		msg -bar
+		print_center -ama "ingresa tu dominio"
+		msg -bar3
+		msg -ne " >>> "
+		read domain
+	done
+	msg -bar3
+	msg -ama " Comprovando direccion IP ..."
+	local_ip=$(wget -qO- ipv4.icanhazip.com)
+    domain_ip=$(ping "${domain}" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')
+    sleep 3
+    [[ -z "${domain_ip}" ]] && domain_ip="ip no encontrada"
+    if [[ $(echo "${local_ip}" | tr '.' '+' | bc) -ne $(echo "${domain_ip}" | tr '.' '+' | bc) ]]; then
+    	clear
+    	msg -bar
+    	print_center -verm2 "ERROR DE DIRECCION IP"
+    	msg -bar
+    	msg -ama " La direccion ip de su dominio\n no coincide con la de su servidor."
+    	msg -bar3
+    	echo -e " $(msg -azu "IP dominio:  ")$(msg -verm2 "${domain_ip}")"
+    	echo -e " $(msg -azu "IP servidor: ")$(msg -verm2 "${local_ip}")"
+    	msg -bar3
+    	msg -ama " Verifique su dominio, e intente de nuevo."
+    	msg -bar
+    	read foo
+    	return 1
+    fi
+
+    
+    stop_port
+    cert_install
+    echo "$domain" > ${ADM_src}/dominio.txt
+    return 1
+}
+
+gen_domi(){
+	title "GENERADOR DE SUB-DOMINIOS"
+	msg -ama " Verificando direccion ip..."
+	sleep 2
+
+	ls_dom=$(curl -s -X GET "$url/$_dns/dns_records?per_page=100" \
+     -H "X-Auth-Email: $correo" \
+     -H "X-Auth-Key: $apikey" \
+     -H "Content-Type: application/json" | jq '.')
+
+    num_line=$(echo $ls_dom | jq '.result | length')
+    ls_domi=$(echo $ls_dom | jq -r '.result[].name')
+    ls_ip=$(echo $ls_dom | jq -r '.result[].content')
+    my_ip=$(wget -qO- ipv4.icanhazip.com)
+
+	if [[ $(echo "$ls_ip"|grep -w "$my_ip") = "$my_ip" ]];then
+		for (( i = 0; i < $num_line; i++ )); do
+			if [[ $(echo "$ls_dom" | jq -r ".result[$i].content"|grep -w "$my_ip") = "$my_ip" ]]; then
+				domain=$(echo "$ls_dom" | jq -r ".result[$i].name")
+				echo "$domain" > ${ADM_src}/dominio.txt
+				break
+			fi
+		done
+		tput cuu1 && tput dl1
+		print_center -azu "ya existe un sub-dominio asociado a esta IP"
+		msg -bar
+		echo -e " $(msg -verm2 "sub-dominio:") $(msg -ama "$domain")"
+		msg -bar
+		read foo
+		return 1
+    fi
+
+    if [[ -z $name ]]; then
+    	tput cuu1 && tput dl1
+		echo -e " $(msg -azu "El dominio principal es:") $(msg -ama "$_domain")\n $(msg -azu "El sub-dominio sera:") $(msg -ama "ejemplo.$_domain")"
+		msg -bar
+    	while [[ -z "$name" ]]; do
+    		msg -ne " Nombre (ej: vpsfull) >>> "
+    		read name
+    		tput cuu1 && tput dl1
+
+    		name=$(echo "$name" | tr -d '[[:space:]]')
+
+    		if [[ -z $name ]]; then
+    			msg -verm2 " ingresar un nombre...!"
+    			unset name
+    			sleep 2
+    			tput cuu1 && tput dl1
+    			continue
+    		elif [[ ! $name =~ $tx_num ]]; then
+    			msg -verm2 " ingresa solo letras y numeros...!"
+    			unset name
+    			sleep 2
+    			tput cuu1 && tput dl1
+    			continue
+    		elif [[ "${#name}" -lt "4" ]]; then
+    			msg -verm2 " nombre demaciado corto!"
+    			sleep 2
+    			tput cuu1 && tput dl1
+    			unset name
+    			continue
+    		else
+    			domain="$name.$_domain"
+    			msg -ama " Verificando disponibiliad..."
+    			sleep 2
+    			tput cuu1 && tput dl1
+    			if [[ $(echo "$ls_domi" | grep "$domain") = "" ]]; then
+    				echo -e " $(msg -verd "[ok]") $(msg -azu "sub-dominio disponible")"
+    				sleep 2
+    			else
+    				echo -e " $(msg -verm2 "[fail]") $(msg -azu "sub-dominio NO disponible")"
+    				unset name
+    				sleep 2
+    				tput cuu1 && tput dl1
+    				continue
+    			fi
+    		fi
+    	done
+    fi
+    tput cuu1 && tput dl1
+    echo -e " $(msg -azu "El sub-dominio sera:") $(msg -verd "$domain")"
+    msg -bar
+    msg -ne " Continuar...[S/N]: "
+    read opcion
+    [[ $opcion = @(n|N) ]] && return 1
+    tput cuu1 && tput dl1
+    print_center -azu "Creando sub-dominio"
+    sleep 1
+
+    var=$(cat <<EOF
+{
+  "type": "A",
+  "name": "$name",
+  "content": "$my_ip",
+  "ttl": 1,
+  "priority": 10,
+  "proxied": false
+}
+EOF
+)
+    chek_domain=$(curl -s -X POST "$url/$_dns/dns_records" \
+    -H "X-Auth-Email: $correo" \
+    -H "X-Auth-Key: $apikey" \
+    -H "Content-Type: application/json" \
+    -d $(echo $var|jq -c '.')|jq '.')
+
+    tput cuu1 && tput dl1
+    if [[ "$(echo $chek_domain|jq -r '.success')" = "true" ]]; then
+    	echo "$(echo $chek_domain|jq -r '.result.name')" > ${ADM_src}/dominio.txt
+    	print_center -verd "Sub-dominio creado con exito!"
+    else
+    	echo "" > ${ADM_src}/dominio.txt
+    	print_center -ama "Falla al crear Sub-dominio!" 	
+    fi
+    enter
+    return 1
+}
+
+ger_cert_z(){
+	echo ""
+
+}
+
+#======MENU======
+menu_cert(){
+title "SUB-DOMINIO Y CERTIFICADO SSL"
+menu_func "GENERAR CERT SSL (Let's Encrypt)" "GENERAR CERT SSL (Zerossl)" "INGRESAR CERT SSL EXTERNO" "GENERAR SUB-DOMINIO"
+back
+in_opcion "Opcion"
+
+case $opcion in
+	1)ger_cert 1;;
+	2)ger_cert 2;;
+	3)ext_cert;;
+	4)gen_domi;;
+	0)return 1;;
+esac
+}
+
+menu_cert

BIN
R9/ADMRufu-31/install/dns-server


+ 97 - 0
R9/ADMRufu-31/install/dropbear.sh

@@ -0,0 +1,97 @@
+#!/bin/bash
+#19/12/2019
+
+fun_dropbear(){
+  clear
+  [[ -e /etc/default/dropbear ]] && {
+    msg -bar
+    print_center -ama "REMOVIENDO DROPBEAR"
+    msg -bar
+    service dropbear stop & >/dev/null 2>&1
+    fun_bar "apt-get remove dropbear -y"
+    fun_bar "apt-get purge dropbear -y"
+    fun_bar "apt-get autoremove -y"
+    msg -bar
+    print_center -verd "Dropbear Removido"
+    msg -bar
+    [[ -e /etc/default/dropbear ]] && rm /etc/default/dropbear &>/dev/null
+    sleep 2
+    return 1
+  }
+  msg -bar
+  print_center -ama "INSTALADOR DROPBEAR"
+  msg -bar
+  echo -e " $(msg -verm2 "Ingrese Sus Puertos:") $(msg -verd "80 90 109 110 143 443")"
+  msg -bar
+  msg -ne " Digite Puertos: " && read DPORT
+  tput cuu1 && tput dl1
+  TTOTAL=($DPORT)
+  for((i=0; i<${#TTOTAL[@]}; i++)); do
+    [[ $(mportas|grep "${TTOTAL[$i]}") = "" ]] && {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;32m ${TTOTAL[$i]} OK"
+      PORT="$PORT ${TTOTAL[$i]}"
+    } || {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;31m ${TTOTAL[$i]} FAIL"
+    }
+  done
+  [[  -z $PORT ]] && {
+    echo -e "\033[1;31m Ningun Puerto Valida Fue Elegido\033[0m"
+    return 1
+  }
+
+  [[ ! $(cat /etc/shells|grep "/bin/false") ]] && echo -e "/bin/false" >> /etc/shells
+  msg -bar
+  print_center -ama "Instalando dropbear"
+  msg -bar
+  fun_bar "apt-get install dropbear -y"
+  msg -bar
+  chk=$(cat /etc/ssh/sshd_config | grep Banner)
+  if [ "$(echo "$chk" | grep -v "#Banner" | grep Banner)" != "" ]; then
+    local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
+  else
+    local="/etc/bannerssh"
+  fi
+  touch $local
+  print_center -ama "Configurando dropbear"
+
+cat <<EOF > /etc/default/dropbear
+NO_START=0
+DROPBEAR_PORT=VAR1
+DROPBEAR_EXTRA_ARGS="VAR"
+DROPBEAR_BANNER="$local"
+DROPBEAR_RECEIVE_WINDOW=65536
+EOF
+
+  n=0
+  for i in $(echo $PORT); do
+  	p[$n]=$i
+  	let n++
+  done
+
+  sed -i "s/VAR1/${p[0]}/g" /etc/default/dropbear
+
+  if [[ ! -z ${p[1]} ]]; then
+
+  	for (( i = 0; i < ${#p[@]}; i++ )); do
+  		[[ "$i" = "0" ]] && continue
+  		sed -i "s/VAR/-p ${p[$i]} VAR/g" /etc/default/dropbear
+  	done
+  fi
+  sed -i "s/VAR//g" /etc/default/dropbear
+
+  fun_eth
+  service ssh restart > /dev/null 2>&1
+  service dropbear restart > /dev/null 2>&1
+  sleep 1
+  msg -bar3
+  print_center -verd "dropbear configurado con EXITO"
+  msg -bar
+  #UFW
+  for ufww in $(mportas|awk '{print $2}'); do
+    ufw allow $ufww > /dev/null 2>&1
+  done
+  sleep 2
+  return 1
+}
+
+fun_dropbear

+ 104 - 0
R9/ADMRufu-31/install/limitador.sh

@@ -0,0 +1,104 @@
+#!/bin/bash
+droppids(){
+  port_dropbear=`ps aux|grep 'dropbear'|awk NR==1|awk '{print $17;}'`
+
+  log=/var/log/auth.log
+  loginsukses='Password auth succeeded'
+
+  pids=`ps ax|grep 'dropbear'|grep " $port_dropbear"|awk -F " " '{print $1}'`
+
+  for pid in $pids; do
+    pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'`
+
+    i=0
+    for pidend in $pidlogs; do
+      let i=i+1
+    done
+
+    if [ $pidend ];then
+       login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"`
+       PID=$pid
+       user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"`
+       waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'`
+       while [ ${#waktu} -lt 13 ]; do
+           waktu=$waktu" "
+       done
+       while [ ${#user} -lt 16 ]; do
+           user=$user" "
+       done
+       while [ ${#PID} -lt 8 ]; do
+           PID=$PID" "
+       done
+       echo "$user $PID $waktu"
+    fi
+done
+}
+
+sshmonitor(){
+  h=1
+  unlimit=$(cat /etc/ADMRufu/user/unlimit)
+    for i in `echo "$user_type"`; do
+
+        user="$i"
+        s2ssh="$(cat /etc/passwd|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f1)"
+
+        if [[ "$(cat /etc/passwd| grep -w $user| wc -l)" = "1" ]]; then
+          sqd="$(ps -u $user | grep sshd | wc -l)"
+        else
+          sqd=00
+        fi
+        [[ "$sqd" = "" ]] && sqd=0
+
+        if [[ -e /etc/openvpn/openvpn-status.log ]]; then
+          ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$user", | wc -l)"
+        else
+          ovp=0
+        fi
+
+        if netstat -nltp|grep 'dropbear'> /dev/null;then
+          drop="$(droppids | grep -w "$user" | wc -l)"
+        else
+          drop=0
+        fi
+
+        cnx=$(($sqd + $drop))
+        conex=$(($cnx + $ovp))
+
+        if [[ "$conex" -gt "$s2ssh" ]]; then
+        	pkill -u $user
+        	droplim=`droppids|grep -w "$user"|awk '{print $2}'` 
+        	kill -9 $droplim &>/dev/null
+        	usermod -L $user
+        	echo "$user $(printf '%(%H:%M:%S)T') $conex/$s2ssh" >> /etc/ADMRufu/user/limit.log
+          [[ $unlimit -le 0 ]] && continue || at now +${unlimit} minutes <<< "usermod -U $user" &>/dev/null
+        fi
+      done
+      touch /etc/ADMRufu/user/limit
+      timer=$(cat /etc/ADMRufu/user/limit)
+      [[ -z ${timer} ]] && timer="3"
+      at now +${timer} minutes <<< "/etc/ADMRufu/install/limitador.sh" &>/dev/null
+      [[ -z $(cat "/var/spool/cron/crontabs/root"|grep "limitador.sh") ]] && echo "@reboot root /etc/ADMRufu/install/limitador.sh" >> /var/spool/cron/crontabs/root
+}
+
+expired(){
+    for i in `echo "$user_type"`; do
+        user="$i"
+        userDate=$(chage -l "$user"|sed -n '4p'|awk -F ': ' '{print $2}')
+        if [[ $(date '+%s') -gt $(date '+%s' -d "$userDate") ]]; then
+          if [[ $(passwd --status $user|cut -d ' ' -f2) = "P" ]]; then
+            usermod -L $user
+            echo "$user $(printf '%(%H:%M:%S)T') expirado" >> /etc/ADMRufu/user/limit.log
+          fi    
+        fi
+      done
+}
+
+all_user=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog')
+case $1 in
+    -s|--ssh)user_type=$(echo "$all_user"|grep -v 'token'|grep -v 'hwid'|awk -F ':' '{print $1}') && expired;;
+   -h|--hwid)user_type=$(echo "$all_user"|grep -w 'hwid'|awk -F ':' '{print $1}') && expired;;
+  -t|--token)user_type=$(echo "$all_user"|grep -w 'token'|awk -F ':' '{print $1}') && expired;;
+           *)user_type=$(echo "$all_user"|grep -v 'token'|grep -v 'hwid'|awk -F ':' '{print $1}') && sshmonitor;;
+esac
+
+# @daily root /etc/ADMRufu/install/limitador.sh >> /var/spool/cron/crontabs/root

+ 495 - 0
R9/ADMRufu-31/install/openvpn.sh

@@ -0,0 +1,495 @@
+#!/bin/bash
+#19/12/2019
+clear
+msg -bar
+
+# Detect Debian users running the script with "sh" instead of bash
+if readlink /proc/$$/exe | grep -q "dash"; then
+	print_center -ama "Este script se utiliza con bash"
+	enter
+fi
+
+if [[ "$EUID" -ne 0 ]]; then
+	print_center -ama "Sorry, solo funciona como root"
+	enter
+fi
+
+if [[ ! -e /dev/net/tun ]]; then
+	print_center -ama "El TUN device no esta disponible"
+	print_center -ama "Necesitas habilitar TUN antes de usar este script"
+	enter
+fi
+
+if [[ -e /etc/debian_version ]]; then
+	OS=debian
+	GROUPNAME=nogroup
+	RCLOCAL='/etc/rc.local'
+elif [[ -e /etc/centos-release || -e /etc/redhat-release ]]; then
+	OS=centos
+	GROUPNAME=nobody
+	RCLOCAL='/etc/rc.d/rc.local'
+else
+	print_center -ama "Sistema no compatible para este script"
+	enter
+fi
+del(){
+	for (( i = 0; i < $1; i++ )); do
+		tput cuu1 && tput dl1
+	done
+}
+
+agrega_dns(){
+	msg -ama " Escriba el HOST DNS que desea Agregar"
+	read -p " [NewDNS]: " SDNS
+	cat /etc/hosts|grep -v "$SDNS" > /etc/hosts.bak && mv -f /etc/hosts.bak /etc/hosts
+	if [[ -e /etc/opendns ]]; then
+		cat /etc/opendns > /tmp/opnbak
+		mv -f /tmp/opnbak /etc/opendns
+		echo "$SDNS" >> /etc/opendns 
+	else
+		echo "$SDNS" > /etc/opendns
+	fi
+	[[ -z $NEWDNS ]] && NEWDNS="$SDNS" || NEWDNS="$NEWDNS $SDNS"
+	unset SDNS
+}
+
+dns_fun(){
+	case $1 in
+		1)
+			if grep -q "127.0.0.53" "/etc/resolv.conf"; then
+				RESOLVCONF='/run/systemd/resolve/resolv.conf'
+			else
+				RESOLVCONF='/etc/resolv.conf'
+			fi 
+			grep -v '#' $RESOLVCONF | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read line; do
+				echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server.conf
+			done;;
+		2) #cloudflare
+			echo 'push "dhcp-option DNS 1.1.1.1"' >> /etc/openvpn/server.conf
+			echo 'push "dhcp-option DNS 1.0.0.1"' >> /etc/openvpn/server.conf;;
+		3) #google
+			echo 'push "dhcp-option DNS 8.8.8.8"' >> /etc/openvpn/server.conf
+			echo 'push "dhcp-option DNS 8.8.4.4"' >> /etc/openvpn/server.conf;;
+		4) #OpenDNS
+			echo 'push "dhcp-option DNS 208.67.222.222"' >> /etc/openvpn/server.conf
+			echo 'push "dhcp-option DNS 208.67.220.220"' >> /etc/openvpn/server.conf;;
+		5) #Verisign
+			echo 'push "dhcp-option DNS 64.6.64.6"' >> /etc/openvpn/server.conf
+			echo 'push "dhcp-option DNS 64.6.65.6"' >> /etc/openvpn/server.conf;;
+		6) #Quad9
+			echo 'push "dhcp-option DNS 9.9.9.9"' >> /etc/openvpn/server.conf
+			echo 'push "dhcp-option DNS 149.112.112.112"' >> /etc/openvpn/server.conf;;
+		7) #UncensoredDNS
+			echo 'push "dhcp-option DNS 91.239.100.100"' >> /etc/openvpn/server.conf
+			echo 'push "dhcp-option DNS 89.233.43.71"' >> /etc/openvpn/server.conf;;
+	esac
+}
+
+IP="$(fun_ip)"
+
+instala_ovpn(){
+	clear
+	msg -bar
+	print_center -ama "INSTALADOR DE OPENVPN"
+	msg -bar
+	# OpenVPN setup and first user creation
+	msg -ama " Algunos ajustes son necesario para conf OpenVPN"
+	msg -bar
+	# Autodetect IP address and pre-fill for the user
+	IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
+	if echo "$IP" | grep -qE '^(10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.|192\.168)'; then
+		PUBLICIP=$(fun_ip)
+	fi
+	msg -ama "    Seleccione el protocolo de conexiones OpenVPN"
+	msg -bar
+	menu_func "UDP" "TCP"
+	msg -bar
+	while [[ -z $PROTOCOL ]]; do
+		msg -ne " opcion: "
+		read PROTOCOL
+		case $PROTOCOL in
+			1)PROTOCOL=udp; del "6"; msg -nazu " PROTOCOLO: "; msg -verd "UDP";;
+			2)PROTOCOL=tcp; del "6"; msg -nazu " PROTOCOLO: "; msg -verd "TCP";;
+			*)tput cuu1 && tput dl1; print_center -verm2 "selecciona una opcion entre 1 y 2"; sleep 2s; tput cuu1 && tput dl1; unset PROTOCOL;;
+		esac
+	done
+	msg -bar
+	print_center -ama "Ingresa un puerto OpenVPN (Default 1194)"
+	msg -bar
+	while [[ -z $PORT ]]; do
+		msg -ne " Puerto: "
+		read PORT
+		if [[ -z $PORT ]]; then
+			PORT="1194"
+		elif [[ ! $PORT =~ $numero ]]; then
+			tput cuu1 && tput dl1
+			print_center -verm2 "ingresa solo numeros"
+			sleep 2s
+			tput cuu1 && tput dl1
+			unset PORT
+		fi
+
+		[[ $(mportas|grep -w "${PORT}") ]] && {
+			tput cuu1 && tput dl1
+			print_center -verm2 "Puerto en uso"
+			sleep 2s
+			tput cuu1 && tput dl1
+			unset PORT
+        }
+	done
+	del "3"
+	msg -nazu " PUERTO: "; msg -verd "$PORT"
+	msg -bar
+	print_center -ama "Seleccione DNS (default VPS)"
+	msg -bar
+	menu_func "DNS del Sistema" "Cloudflare" "Google" "OpenDNS" "Verisign" "Quad9" "UncensoredDNS"
+	msg -bar
+	while [[ -z $DNS ]]; do
+		msg -ne " opcion: "
+		read DNS
+		if [[ -z $DNS ]]; then
+			DNS="1"
+		elif [[ ! $DNS =~ $numero ]]; then
+			tput cuu1 && tput dl1
+			print_center -verm2 "ingresa solo numeros"
+			sleep 2s
+			tput cuu1 && tput dl1
+			unset DNS
+		elif [[ $DNS != @([1-7]) ]]; then
+			tput cuu1 && tput dl1
+			print_center -ama "solo numeros entre 1 y 7"
+			sleep 2s
+			tput cuu1 && tput dl1
+			unset DNS
+		fi
+	done
+	case $DNS in
+		1)P_DNS="DNS del Sistema";;
+		2)P_DNS="Cloudflare";;
+		3)P_DNS="Google";;
+		4)P_DNS="OpenDNS";;
+		5)P_DNS="Verisign";;
+		6)P_DNS="Quad9";;
+		7)P_DNS="UncensoredDNS";;
+	esac
+	del "11"
+	msg -nazu " DNS: "; msg -verd "$P_DNS"
+	msg -bar
+	print_center -ama " Seleccione la codificacion para el canal de datos"
+	msg -bar
+	menu_func "AES-128-CBC" "AES-192-CBC" "AES-256-CBC" "CAMELLIA-128-CBC" "CAMELLIA-192-CBC" "CAMELLIA-256-CBC" "SEED-CBC" "NONE"
+	msg -bar
+	while [[ -z $CIPHER ]]; do
+		msg -ne " opcion: "
+		read CIPHER
+		if [[ -z $CIPHER ]]; then
+			CIPHER="1"
+		elif [[ ! $CIPHER =~ $numero ]]; then
+			tput cuu1 && tput dl1
+			print_center -verm2 "ingresa solo numeros"
+			sleep 2s
+			tput cuu1 && tput dl1
+			unset CIPHER
+		elif [[ $CIPHER != @([1-8]) ]]; then
+			tput cuu1 && tput dl1
+			print_center -ama "solo numeros entre 1 y 8"
+			sleep 2s
+			tput cuu1 && tput dl1
+			unset CIPHER
+		fi
+	done
+	case $CIPHER in
+		1) CIPHER="cipher AES-128-CBC";;
+		2) CIPHER="cipher AES-192-CBC";;
+		3) CIPHER="cipher AES-256-CBC";;
+		4) CIPHER="cipher CAMELLIA-128-CBC";;
+		5) CIPHER="cipher CAMELLIA-192-CBC";;
+		6) CIPHER="cipher CAMELLIA-256-CBC";;
+		7) CIPHER="cipher SEED-CBC";;
+		8) CIPHER="cipher none";;
+	esac
+	del "12"
+	codi=$(echo $CIPHER|awk -F ' ' '{print $2}')
+	msg -nazu " CODIFICACION: "; msg -verd "$codi"
+	msg -bar
+	msg -ama " Estamos listos para configurar su servidor OpenVPN"
+	enter
+	if [[ "$OS" = 'debian' ]]; then
+		apt-get update
+		apt-get install openvpn iptables openssl ca-certificates -y
+	else
+		# 
+		yum install epel-release -y
+		yum install openvpn iptables openssl ca-certificates -y
+	fi
+	# Get easy-rsa
+	EASYRSAURL='https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.7/EasyRSA-3.0.7.tgz'
+	wget -O ~/easyrsa.tgz "$EASYRSAURL" 2>/dev/null || curl -Lo ~/easyrsa.tgz "$EASYRSAURL"
+	tar xzf ~/easyrsa.tgz -C ~/
+	mv ~/EasyRSA-3.0.7/ /etc/openvpn/
+	mv /etc/openvpn/EasyRSA-3.0.7/ /etc/openvpn/easy-rsa/
+	chown -R root:root /etc/openvpn/easy-rsa/
+	rm -f ~/easyrsa.tgz
+	cd /etc/openvpn/easy-rsa/
+	# 
+	./easyrsa init-pki
+	./easyrsa --batch build-ca nopass
+	./easyrsa gen-dh
+	./easyrsa build-server-full server nopass
+	EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl
+	# 
+	cp pki/ca.crt pki/private/ca.key pki/dh.pem pki/issued/server.crt pki/private/server.key pki/crl.pem /etc/openvpn
+	# 
+	chown nobody:$GROUPNAME /etc/openvpn/crl.pem
+	# 
+	openvpn --genkey --secret /etc/openvpn/ta.key
+	# 
+	echo "port $PORT
+proto $PROTOCOL
+dev tun
+sndbuf 0
+rcvbuf 0
+ca ca.crt
+cert server.crt
+key server.key
+dh dh.pem
+auth SHA512
+tls-auth ta.key 0
+topology subnet
+server 10.8.0.0 255.255.255.0
+ifconfig-pool-persist ipp.txt" > /etc/openvpn/server.conf
+	echo 'push "redirect-gateway def1 bypass-dhcp"' >> /etc/openvpn/server.conf
+	# DNS
+
+	dns_fun "$DNS"
+	
+	echo "keepalive 10 120
+${CIPHER}
+user nobody
+group $GROUPNAME
+persist-key
+persist-tun
+status openvpn-status.log
+verb 3
+crl-verify crl.pem" >> /etc/openvpn/server.conf
+updatedb
+PLUGIN=$(locate openvpn-plugin-auth-pam.so | head -1)
+[[ ! -z $(echo ${PLUGIN}) ]] && {
+echo "client-to-client
+client-cert-not-required
+username-as-common-name
+plugin $PLUGIN login" >> /etc/openvpn/server.conf
+}
+	# 
+	echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/30-openvpn-forward.conf
+	# 
+	echo 1 > /proc/sys/net/ipv4/ip_forward
+	if pgrep firewalld; then
+		# 
+		#
+		# 
+		# 
+		firewall-cmd --zone=public --add-port=$PORT/$PROTOCOL
+		firewall-cmd --zone=trusted --add-source=10.8.0.0/24
+		firewall-cmd --permanent --zone=public --add-port=$PORT/$PROTOCOL
+		firewall-cmd --permanent --zone=trusted --add-source=10.8.0.0/24
+		# 
+		firewall-cmd --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+		firewall-cmd --permanent --direct --add-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+	else
+		# 
+		if [[ "$OS" = 'debian' && ! -e $RCLOCAL ]]; then
+			echo '#!/bin/sh -e
+exit 0' > $RCLOCAL
+		fi
+		chmod +x $RCLOCAL
+		# 
+		iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+		sed -i "1 a\iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP" $RCLOCAL
+		if iptables -L -n | grep -qE '^(REJECT|DROP)'; then
+			#
+			# 
+			# 
+			iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT
+			iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT
+			iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
+			sed -i "1 a\iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT" $RCLOCAL
+			sed -i "1 a\iptables -I FORWARD -s 10.8.0.0/24 -j ACCEPT" $RCLOCAL
+			sed -i "1 a\iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT" $RCLOCAL
+		fi
+	fi
+	# 
+	if sestatus 2>/dev/null | grep "Current mode" | grep -q "enforcing" && [[ "$PORT" != '1194' ]]; then
+		# 
+		if ! hash semanage 2>/dev/null; then
+			yum install policycoreutils-python -y
+		fi
+		semanage port -a -t openvpn_port_t -p $PROTOCOL $PORT
+	fi
+	# 
+	if [[ "$OS" = 'debian' ]]; then
+		# 
+		if pgrep systemd-journal; then
+			systemctl restart openvpn@server.service
+		else
+			/etc/init.d/openvpn restart
+		fi
+	else
+		if pgrep systemd-journal; then
+			systemctl restart openvpn@server.service
+			systemctl enable openvpn@server.service
+		else
+			service openvpn restart
+			chkconfig openvpn on
+		fi
+	fi
+	# 
+	if [[ "$PUBLICIP" != "" ]]; then
+		IP=$PUBLICIP
+	fi
+	# 
+	echo "# OVPN_ACCESS_SERVER_PROFILE=ADMRufu
+client
+dev tun
+proto $PROTOCOL
+sndbuf 0
+rcvbuf 0
+remote $IP $PORT
+resolv-retry infinite
+nobind
+persist-key
+persist-tun
+remote-cert-tls server
+auth SHA512
+${CIPHER}
+setenv opt block-outside-dns
+key-direction 1
+verb 3
+auth-user-pass" > /etc/openvpn/client-common.txt
+clear
+msg -bar
+print_center -verd "Configuracion Finalizada!"
+msg -bar
+print_center -ama " Crear un usuario SSH para generar el (.ovpn)!"
+enter
+}
+
+edit_ovpn_host(){
+	msg -ama " CONFIGURACION HOST DNS OPENVPN"
+	msg -bar
+	while [[ $DDNS != @(n|N) ]]; do
+		echo -ne "\033[1;33m"
+		read -p " Agregar host [S/N]: " -e -i n DDNS
+		[[ $DDNS = @(s|S|y|Y) ]] && agrega_dns
+	done
+	[[ ! -z $NEWDNS ]] && sed -i "/127.0.0.1[[:blank:]]\+localhost/a 127.0.0.1 $NEWDNS" /etc/hosts
+	msg -bar
+	msg -ama " Es Necesario el Reboot del Servidor Para"
+	msg -ama " Para que las configuraciones sean efectudas"
+	enter
+}
+
+fun_openvpn(){
+	[[ -e /etc/openvpn/server.conf ]] && {
+		unset OPENBAR
+		[[ $(mportas|grep -w "openvpn") ]] && OPENBAR="\033[1;32m [ONLINE]" || OPENBAR="\033[1;31m [OFFLINE]"
+		clear
+		msg -bar
+		print_center -ama "CONFIGURACION OPENVPN"
+		msg -bar
+
+		menu_func "$(msg -verd "INICIAR O PARAR OPENVPN") $OPENBAR" "EDITAR CONFIGURACION CLIENTE $(msg -ama "(MEDIANTE NANO)")" "EDITAR CONFIGURACION SERVIDOR $(msg -ama "(MEDIANTE NANO)")" "CAMBIAR HOST DE OPENVPN" "$(msg -verm2 "DESINSTALAR OPENVPN")"
+		back
+		while [[ $xption != @([0-5]) ]]; do
+			echo -ne "\033[1;33m $(fun_trans "Opcion"): " && read xption
+			tput cuu1 && tput dl1
+		done
+		case $xption in 
+			5)
+				clear
+				msg -bar
+				echo -ne "\033[1;97m"
+				read -p "QUIERES DESINTALAR OPENVPN? [Y/N]: " -e REMOVE
+				msg -bar
+				if [[ "$REMOVE" = 'y' || "$REMOVE" = 'Y' ]]; then
+					PORT=$(grep '^port ' /etc/openvpn/server.conf | cut -d " " -f 2)
+					PROTOCOL=$(grep '^proto ' /etc/openvpn/server.conf | cut -d " " -f 2)
+					if pgrep firewalld; then
+						IP=$(firewall-cmd --direct --get-rules ipv4 nat POSTROUTING | grep '\-s 10.8.0.0/24 '"'"'!'"'"' -d 10.8.0.0/24 -j SNAT --to ' | cut -d " " -f 10)
+						# 
+						firewall-cmd --zone=public --remove-port=$PORT/$PROTOCOL
+						firewall-cmd --zone=trusted --remove-source=10.8.0.0/24
+						firewall-cmd --permanent --zone=public --remove-port=$PORT/$PROTOCOL
+						firewall-cmd --permanent --zone=trusted --remove-source=10.8.0.0/24
+						firewall-cmd --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+						firewall-cmd --permanent --direct --remove-rule ipv4 nat POSTROUTING 0 -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+					else
+						IP=$(grep 'iptables -t nat -A POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to ' $RCLOCAL | cut -d " " -f 14)
+						iptables -t nat -D POSTROUTING -s 10.8.0.0/24 ! -d 10.8.0.0/24 -j SNAT --to $IP
+						sed -i '/iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 ! -d 10.8.0.0\/24 -j SNAT --to /d' $RCLOCAL
+						if iptables -L -n | grep -qE '^ACCEPT'; then
+							iptables -D INPUT -p $PROTOCOL --dport $PORT -j ACCEPT
+							iptables -D FORWARD -s 10.8.0.0/24 -j ACCEPT
+							iptables -D FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
+							sed -i "/iptables -I INPUT -p $PROTOCOL --dport $PORT -j ACCEPT/d" $RCLOCAL
+							sed -i "/iptables -I FORWARD -s 10.8.0.0\/24 -j ACCEPT/d" $RCLOCAL
+							sed -i "/iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT/d" $RCLOCAL
+						fi
+					fi
+					if sestatus 2>/dev/null | grep "Current mode" | grep -q "enforcing" && [[ "$PORT" != '1194' ]]; then
+						semanage port -d -t openvpn_port_t -p $PROTOCOL $PORT
+					fi
+					if [[ "$OS" = 'debian' ]]; then
+						apt-get remove --purge -y openvpn
+					else
+						yum remove openvpn -y
+					fi
+					rm -rf /etc/openvpn
+					rm -f /etc/sysctl.d/30-openvpn-forward.conf
+					clear
+					msg -bar
+					print_center -verd "OpenVPN removido!"
+					enter
+				else
+					clear
+					msg -bar
+					print_center -verm2 "Desinstalacion abortada!"
+					enter
+				fi
+				return 1;;
+			2)
+				nano /etc/openvpn/client-common.txt;;
+			3)
+				nano /etc/openvpn/server.conf;;
+			4)
+				edit_ovpn_host;;
+			1)
+				[[ $(mportas|grep -w openvpn) ]] && {
+					/etc/init.d/openvpn stop > /dev/null 2>&1
+					killall openvpn &>/dev/null
+					systemctl stop openvpn@server.service &>/dev/null
+					service openvpn stop &>/dev/null
+					#ps x |grep openvpn |grep -v grep|awk '{print $1}' | while read pid; do kill -9 $pid; done
+				} || {
+					cd /etc/openvpn
+					screen -dmS ovpnscr openvpn --config "server.conf" > /dev/null 2>&1
+					cd $HOME
+				}
+				print_center -ama "Procedimiento con Exito"
+				enter;;
+			0)
+				return 1;;
+		esac
+		return 0
+	}
+	[[ -e /etc/squid/squid.conf ]] && instala_ovpn && return 0
+	[[ -e /etc/squid3/squid.conf ]] && instala_ovpn && return 0
+	instala_ovpn || return 1
+}
+
+while [[ ! $rec = 1 ]]; do
+	fun_openvpn
+	rec="$?"
+	unset xption
+done
+return 1

+ 339 - 0
R9/ADMRufu-31/install/ports.sh

@@ -0,0 +1,339 @@
+#!/bin/bash
+clear
+port(){
+  local portas
+  local portas_var=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
+  i=0
+  while read port; do
+    var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
+    [[ "$(echo -e ${portas}|grep -w "$var1 $var2")" ]] || {
+      portas+="$var1 $var2 $portas"
+      echo "$var1 $var2"
+      let i++
+    }
+  done <<< "$portas_var"
+}
+
+verify_port () {
+local SERVICE="$1"
+local PORTENTRY="$2"
+[[ ! $(echo -e $(port|grep -v ${SERVICE})|grep -w "$PORTENTRY") ]] && return 0 || return 1
+}
+
+edit_squid(){
+
+  if [[ -e /etc/squid/squid.conf ]]; then
+    local CONF="/etc/squid/squid.conf"
+  elif [[ -e /etc/squid3/squid.conf ]]; then
+    local CONF="/etc/squid3/squid.conf"
+  fi
+
+  local line="$(cat ${CONF}|sed -n '/http_port/='|head -1)"
+  local NEWCONF="$(cat ${CONF}|sed "$line c ADMR_port"|sed '/http_port/d')"
+
+  title "$(fun_trans "REDEFINIR PUERTOS SQUID")"
+  msg -ne " $(fun_trans " Digite Puertos"): " && read DPORT
+  tput cuu1 && tput dl1
+  TTOTAL=($DPORT)
+  for((i=0; i<${#TTOTAL[@]}; i++)); do
+
+    [[ $(mportas|grep -v squid|grep -v '>'|grep -w "${TTOTAL[$i]}") = "" ]] && {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;32m ${TTOTAL[$i]} OK"
+      PORT="$PORT ${TTOTAL[$i]}"
+    } || {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;31m ${TTOTAL[$i]} FAIL"
+    }
+  done
+  [[  -z $PORT ]] && {
+    msg -bar
+    print_center -verm2 "Ningun Puerto Valido"
+    return 1
+  }
+
+  rm ${CONF}
+
+  while read varline; do
+
+    if [[ ! -z "$(echo "$varline"|grep 'ADMR_port')" ]]; then
+      for i in `echo $PORT`; do
+        echo -e "http_port ${i}" >> ${CONF}
+      done
+      continue
+    fi
+
+    echo -e "${varline}" >> ${CONF}
+  done <<< "${NEWCONF}"
+
+  msg -bar
+  print_center -azu "$(fun_trans "AGUARDE")"
+  [[ -d "/etc/squid/" ]] && {
+    service ssh restart > /dev/null 2>&1
+    /etc/init.d/squid start > /dev/null 2>&1
+    service squid restart > /dev/null 2>&1
+  }
+
+  [[ -d "/etc/squid3/" ]] && {
+    service ssh restart > /dev/null 2>&1
+    /etc/init.d/squid3 start > /dev/null 2>&1
+    service squid3 restart > /dev/null 2>&1
+  }
+  sleep 2s
+  tput cuu1 && tput dl1
+  print_center -verd "$(fun_trans "PUERTOS REDEFINIDOS")"
+}
+
+
+edit_apache(){
+  local CONF="/etc/apache2/ports.conf"
+  local line="$(cat ${CONF}|sed -n '/Listen/='|head -1)"
+  local NEWCONF="$(cat ${CONF}|sed "$line c ADMRufu")"
+  let line++
+  while [[ ! -z $(echo "$NEWCONF"|sed -n "${line}p"|grep 'Listen') ]]; do
+    NEWCONF=$(echo "$NEWCONF"|sed "${line}d")
+  done
+
+  title "$(fun_trans "REDEFINIR PUERTOS APACHE")"
+  msg -ne " $(fun_trans " Digite Puertos"): " && read DPORT
+  tput cuu1 && tput dl1
+  TTOTAL=($DPORT)
+  for((i=0; i<${#TTOTAL[@]}; i++)); do
+
+    [[ $(mportas|grep -v apache|grep -v '>'|grep -w "${TTOTAL[$i]}") = "" ]] && {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;32m ${TTOTAL[$i]} OK"
+      PORT="$PORT ${TTOTAL[$i]}"
+    } || {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;31m ${TTOTAL[$i]} FAIL"
+    }
+  done
+  [[  -z $PORT ]] && {
+    msg -bar
+    print_center -verm2 "Ningun Puerto Valido"
+    return 1
+  }
+
+  rm ${CONF}
+
+  while read varline; do
+
+    if [[ ! -z "$(echo "$varline"|grep 'ADMRufu')" ]]; then
+      for i in `echo $PORT`; do
+        echo -e "Listen ${i}" >> ${CONF}
+      done
+      continue
+    fi
+
+    echo -e "${varline}" >> ${CONF}
+  done <<< "${NEWCONF}"
+
+  msg -bar
+  print_center -azu "$(fun_trans "AGUARDE")"
+  service apache2 restart &>/dev/null
+  sleep 2s
+  tput cuu1 && tput dl1
+  print_center -verd "$(fun_trans "PUERTOS REDEFINIDOS")"
+}
+
+
+edit_openvpn(){
+msg -azu "$(fun_trans "REDEFINIR PUERTOS OPENVPN")"
+msg -bar
+
+
+local CONF="/etc/openvpn/server.conf"
+local CONF2="/etc/openvpn/client-common.txt"
+
+local NEWCONF="$(cat ${CONF}|grep -v [Pp]ort)"
+local NEWCONF2="$(cat ${CONF2})"
+
+
+
+msg -ne "$(fun_trans "Nuevos puertos"): "
+read -p "" newports
+
+for PTS in `echo ${newports}`; do
+verify_port openvpn "${PTS}" && echo -e "\033[1;33mPort $PTS \033[1;32mOK" || {
+echo -e "\033[1;33mPort $PTS \033[1;31mFAIL"
+return 1
+}
+done
+
+rm ${CONF}
+
+while read varline; do
+echo -e "${varline}" >> ${CONF}
+if [[ ${varline} = "proto tcp" ]]; then
+echo -e "port ${newports}" >> ${CONF}
+fi
+done <<< "${NEWCONF}"
+
+rm ${CONF2}
+
+while read varline; do
+if [[ $(echo ${varline}|grep -v "remote-random"|grep "remote") ]]; then
+echo -e "$(echo ${varline}|cut -d' ' -f1,2) ${newports} $(echo ${varline}|cut -d' ' -f4)" >> ${CONF2}
+else
+echo -e "${varline}" >> ${CONF2}
+fi
+done <<< "${NEWCONF2}"
+
+
+msg -azu "$(fun_trans "AGUARDE")"
+service openvpn restart &>/dev/null
+/etc/init.d/openvpn restart &>/dev/null
+sleep 1s
+msg -bar
+msg -azu "$(fun_trans "PUERTOS REDEFINIDOS")"
+msg -bar
+}
+
+edit_dropbear(){
+  title "$(fun_trans "REDEFINIR PUERTOS DROPBEAR")"
+  msg -ne " $(fun_trans " Digite Puertos"): " && read DPORT
+  tput cuu1 && tput dl1
+  TTOTAL=($DPORT)
+  for((i=0; i<${#TTOTAL[@]}; i++)); do
+
+    [[ $(mportas|grep -v 'dropbear'|grep "${TTOTAL[$i]}") = "" ]] && {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;32m ${TTOTAL[$i]} OK"
+      PORT="$PORT ${TTOTAL[$i]}"
+    } || {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;31m ${TTOTAL[$i]} FAIL"
+    }
+  done
+  [[  -z $PORT ]] && {
+    echo -e "\033[1;31m Ningun Puerto Valida Fue Elegido\033[0m"
+    return 1
+  }
+
+  cat <<EOF > /etc/default/dropbear
+NO_START=0
+DROPBEAR_PORT=VAR1
+DROPBEAR_EXTRA_ARGS="VAR"
+DROPBEAR_BANNER="/etc/dropbear/banner"
+DROPBEAR_RECEIVE_WINDOW=65536
+EOF
+
+  n=0
+  for i in $(echo $PORT); do
+    p[$n]=$i
+    let n++
+  done
+
+  sed -i "s/VAR1/${p[0]}/g" /etc/default/dropbear
+
+  if [[ ! -z ${p[1]} ]]; then
+
+    for (( i = 0; i < ${#p[@]}; i++ )); do
+      [[ "$i" = "0" ]] && continue
+      sed -i "s/VAR/-p ${p[$i]} VAR/g" /etc/default/dropbear
+    done
+  fi
+  sed -i "s/VAR//g" /etc/default/dropbear
+  msg -bar
+  print_center -azu "$(fun_trans "AGUARDE")"
+  service dropbear restart &>/dev/null
+  sleep 2s
+  tput cuu1 && tput dl1
+  print_center -verd "$(fun_trans "PUERTOS REDEFINIDOS")"
+}
+
+edit_openssh(){
+  local CONF="/etc/ssh/sshd_config"
+  local line="$(cat ${CONF}|sed -n '/[Pp]ort/='|head -1)"
+  local NEWCONF="$(cat ${CONF}|sed "$line c ADMRufu"|sed '/[Pp]ort/d')"
+
+  title "$(fun_trans "REDEFINIR PUERTOS OPENSSH")"
+  msg -ne " $(fun_trans " Digite Puertos"): " && read DPORT
+  tput cuu1 && tput dl1
+  TTOTAL=($DPORT)
+  for((i=0; i<${#TTOTAL[@]}; i++)); do
+
+    [[ $(mportas|grep -v ssh|grep -v '>'|grep -w "${TTOTAL[$i]}") = "" ]] && {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;32m ${TTOTAL[$i]} OK"
+      PORT="$PORT ${TTOTAL[$i]}"
+    } || {
+      echo -e "\033[1;33m Puerto Elegido:\033[1;31m ${TTOTAL[$i]} FAIL"
+    }
+  done
+  [[  -z $PORT ]] && {
+    msg -bar
+    print_center -verm2 "Ningun Puerto Valido"
+    return 1
+  }
+
+  rm ${CONF}
+
+  while read varline; do
+
+    if [[ ! -z "$(echo "$varline"|grep 'ADMRufu')" ]]; then
+      for i in `echo $PORT`; do
+        echo -e "Port ${i}" >> ${CONF}
+      done
+      continue
+    fi
+
+    echo -e "${varline}" >> ${CONF}
+  done <<< "${NEWCONF}"
+
+  msg -bar
+  print_center -azu "$(fun_trans "AGUARDE")"
+  service ssh restart &>/dev/null
+  service sshd restart &>/dev/null
+  sleep 2s
+  tput cuu1 && tput dl1
+  print_center -verd "$(fun_trans "PUERTOS REDEFINIDOS")"
+}
+
+main_fun(){
+  title "$(fun_trans "GESTOR DE PUERTOS")"
+  unset newports
+
+  i=0
+  new=$(mportas|cut -d ' ' -f1|grep -E 'squid|apache|dropbear|ssh')
+
+  [[ ! -z $(echo "$new"|grep squid) ]] && {
+    let i++
+    echo -e "$(msg -verd "[$i]") $(msg -verm2 ">") $(msg -azu "$(fun_trans "REDEFINIR PUERTOS SQUID")")"
+    squid=$i
+  }
+
+  [[ ! -z $(echo "$new"|grep apache) ]] && {
+    let i++
+    echo -e "$(msg -verd "[$i]") $(msg -verm2 ">") $(msg -azu "$(fun_trans "REDEFINIR PUERTOS APACHE")")"
+    apache=$i
+  }
+
+  #[[ ! -z $(echo "$new"|grep openvpn) ]] && {
+  #  let i++
+  #  echo -e "$(msg -verd "[$i]") $(msg -verm2 ">") $(msg -azu "$(fun_trans "REDEFINIR PUERTOS OPENVPN")")"
+  #  openvpn=$i
+  #}
+
+  [[ ! -z $(echo "$new"|grep dropbear) ]] && {
+    let i++
+    echo -e "$(msg -verd "[$i]") $(msg -verm2 ">") $(msg -azu "$(fun_trans "REDEFINIR PUERTOS DROPBEAR")")"
+    dropbear=$i
+  }
+
+  [[ ! -z $(echo "$new"|grep ssh) ]] && {
+    let i++
+    echo -e "$(msg -verd "[$i]") $(msg -verm2 ">") $(msg -azu "$(fun_trans "REDEFINIR PUERTOS SSH")")"
+    ssh=$i
+  }
+
+  back
+  opcion=$(selection_fun $i)
+
+  case $opcion in
+    $squid)edit_squid;;
+    $apache)edit_apache;;
+    #$openvpn)edit_openvpn;;
+    $dropbear)edit_dropbear;;
+    $ssh)edit_openssh;;
+  esac
+
+}
+
+main_fun
+enter
+return 1

+ 189 - 0
R9/ADMRufu-31/install/slowdns.sh

@@ -0,0 +1,189 @@
+#!/bin/bash
+
+info(){
+	clear
+	nodata(){
+		msg -bar
+		print_center -ama "SIN INFORMACION SLOWDNS!!!"
+		enter
+	}
+
+	if [[ -e  ${ADM_slow}/domain_ns ]]; then
+		ns=$(cat ${ADM_slow}/domain_ns)
+		if [[ -z "$ns" ]]; then
+			nodata
+			return
+		fi
+	else
+		nodata
+		return
+	fi
+
+	if [[ -e ${ADM_slow}/server.pub ]]; then
+		key=$(cat ${ADM_slow}/server.pub)
+		if [[ -z "$key" ]]; then
+			nodata
+			return
+		fi
+	else
+		nodata
+		return
+	fi
+
+	msg -bar
+	print_center -ama "DATOS DE SU CONECCION SLOWDNS"
+	msg -bar
+	msg -ama "Su NS (Nameserver): $(cat ${ADM_slow}/domain_ns)"
+	msg -bar3
+	msg -ama "Su Llave: $(cat ${ADM_slow}/server.pub)"
+	enter
+	return
+}
+
+drop_port(){
+    local portasVAR=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
+    local NOREPEAT
+    local reQ
+    local Port
+    unset DPB
+    while read port; do
+        reQ=$(echo ${port}|awk '{print $1}')
+        Port=$(echo {$port} | awk '{print $9}' | awk -F ":" '{print $2}')
+        [[ $(echo -e $NOREPEAT|grep -w "$Port") ]] && continue
+        NOREPEAT+="$Port\n"
+
+        case ${reQ} in
+        	sshd|dropbear|stunnel4|stunnel|python|python3)DPB+=" $reQ:$Port";;
+            *)continue;;
+        esac
+    done <<< "${portasVAR}"
+ }
+
+ini_slow(){
+	title "INSTALADOR SLOWDNS By @Rufu99"
+	drop_port
+	n=1
+    for i in $DPB; do
+        proto=$(echo $i|awk -F ":" '{print $1}')
+        proto2=$(printf '%-12s' "$proto")
+        port=$(echo $i|awk -F ":" '{print $2}')
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -ama "$proto2")$(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done
+    msg -bar
+    opc=$(selection_fun $num_opc)
+    echo "${drop[$opc]}" > ${ADM_slow}/puerto
+    PORT=$(cat ${ADM_slow}/puerto)
+    title "INSTALADOR SLOWDNS By @Rufu99"
+    echo -e " $(msg -ama "Puerto de coneccion atraves de SlowDNS:") $(msg -verd "$PORT")"
+    msg -bar3
+
+    unset NS
+    while [[ -z $NS ]]; do
+    	msg -nama " Tu dominio NS: "
+    	read NS
+    	tput cuu1 && tput dl1
+    done
+    echo "$NS" > ${ADM_slow}/domain_ns
+    echo -e " $(msg -ama "Tu dominio NS:") $(msg -verd "$NS")"
+    msg -bar3
+
+    if [[ ! -e ${ADM_inst}/dns-server ]]; then
+    	msg -nama " Descargando binario...."
+    	if wget -O ${ADM_inst}/dns-server https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/Utils/SlowDNS/dns-server &>/dev/null ; then
+    		chmod +x ${ADM_inst}/dns-server
+    		msg -verd "[OK]"
+    	else
+    		msg -verm2 "[fail]"
+    		msg -bar
+    		print_center -ama "No se pudo descargar el binario"
+    		print_center -verm2 "Instalacion canselada"
+    		enter
+    		return
+    	fi
+    	msg -bar3
+    fi
+
+    [[ -e "${ADM_slow}/server.pub" ]] && pub=$(cat ${ADM_slow}/server.pub)
+
+    if [[ ! -z "$pub" ]]; then
+    	msg -nama " Usar clave existente [S/N]: "
+    	read ex_key
+
+    	case $ex_key in
+    		s|S|y|Y) tput cuu1 && tput dl1
+    			 echo -e " $(msg -ama "Tu clave:") $(msg -verd "$(cat ${ADM_slow}/server.pub)")";;
+    		n|N) tput cuu1 && tput dl1
+    			 rm -rf ${ADM_slow}/server.key
+    			 rm -rf ${ADM_slow}/server.pub
+    			 ${ADM_inst}/dns-server -gen-key -privkey-file ${ADM_slow}/server.key -pubkey-file ${ADM_slow}/server.pub &>/dev/null
+    			 echo -e " $(msg -ama "Tu clave:") $(msg -verd "$(cat ${ADM_slow}/server.pub)")";;
+    		*);;
+    	esac
+    else
+    	rm -rf ${ADM_slow}/server.key
+    	rm -rf ${ADM_slow}/server.pub
+    	${ADM_inst}/dns-server -gen-key -privkey-file ${ADM_slow}/server.key -pubkey-file ${ADM_slow}/server.pub &>/dev/null
+    	echo -e " $(msg -ama "Tu clave:") $(msg -verd "$(cat ${ADM_slow}/server.pub)")"
+    fi
+    msg -bar
+    msg -nama "    Iniciando SlowDNS...."
+
+    iptables -I INPUT -p udp --dport 5300 -j ACCEPT
+    iptables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 5300
+
+    if screen -dmS slowdns ${ADM_inst}/dns-server -udp :5300 -privkey-file ${ADM_slow}/server.key $NS 127.0.0.1:$PORT ; then
+    	msg -verd "Con exito!!!"
+    else
+    	msg -verm2 "Con fallo!!!"
+    fi
+    enter
+}
+
+reset_slow(){
+	clear
+	msg -bar
+	msg -nama "    Reiniciando SlowDNS...."
+	screen -ls | grep slowdns | cut -d. -f1 | awk '{print $1}' | xargs kill
+	NS=$(cat ${ADM_slow}/domain_ns)
+	PORT=$(cat ${ADM_slow}/puerto)
+	if screen -dmS slowdns /etc/slowdns/dns-server -udp :5300 -privkey-file /root/server.key $NS 127.0.0.1:$PORT ;then
+		msg -verd "Con exito!!!"
+	else
+		msg -verm2 "Con fallo!!!"
+	fi
+	enter
+}
+stop_slow(){
+	clear
+	msg -bar
+	msg -nama "    Deteniendo SlowDNS...."
+	if screen -ls | grep slowdns | cut -d. -f1 | awk '{print $1}' | xargs kill ; then
+		msg -verd "Con exito!!!"
+	else
+		msg -verm2 "Con fallo!!!"
+	fi
+	enter
+}
+
+while :
+do
+	clear
+	msg -bar
+	print_center -ama "INSTALADOR SLOWDNS By @Rufu99"
+	msg -bar
+	menu_func "Ver Informacion\n$(msg -bar3)" "$(msg -verd "Iniciar SlowDNS")" "$(msg -ama "Reiniciar SlowDNS")" "$(msg -verm2 "Parar SlowDNS")" 
+	back
+	opcion=$(selection_fun 5)
+
+	case $opcion in
+		1)info;;
+		2)ini_slow;;
+		3)reset_slow;;
+		4)stop_slow;;
+		0)break;;
+	esac
+done
+return 1

+ 216 - 0
R9/ADMRufu-31/install/sockspy.sh

@@ -0,0 +1,216 @@
+#!/bin/bash
+#19/05/2020
+clear
+msg -bar
+
+stop_all () {
+    ck_py=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "python")
+
+    if [[ -z $(echo "$ck_py" | awk '{print $1}' | head -n 1) ]]; then
+        print_center -verm "Puertos PYTHON no encontrados"
+        msg -bar
+    else
+        ck_port=$(echo "$ck_py" | awk '{print $9}' | awk -F ":" '{print $2}')
+        for i in $ck_port; do
+            systemctl stop python.${i} &>/dev/null
+            systemctl disable python.${1} &>/dev/null
+            rm /etc/systemd/system/python.${i}.service &>/dev/null
+        done
+        print_center -verd "Puertos PYTHON detenidos"
+        msg -bar    
+    fi
+    sleep 3
+ }
+
+  stop_port () {
+    clear
+    STPY=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "python" | awk '{print $9}' | awk -F ":" '{print $2}')
+
+    msg -bar
+    print_center -ama "DETENER UN PUERTO"
+    msg -bar
+
+    n=1
+    for i in $STPY; do
+        echo -e " \033[1;32m[$n] \033[1;31m> \033[1;37m$i\033[0m"
+        pypr[$n]=$i
+        let n++ 
+    done
+
+    msg -bar
+    echo -ne "$(msg -verd "  [0]") $(msg -verm2 ">") " && msg -bra "\033[1;41mVOLVER"
+    msg -bar
+    echo -ne "\033[1;37m opcion: " && read prpy
+    tput cuu1 && tput dl1
+
+    [[ $prpy = "0" ]] && return
+
+    systemctl stop python.${pypr[$prpy]} &>/dev/null
+    systemctl disable python.${pypr[$prpy]} &>/dev/null
+    rm /etc/systemd/system/python.${pypr[$prpy]}.service &>/dev/null
+
+    print_center -verd "PUERTO PYTHON ${pypr[$prpy]} detenido"
+    msg -bar
+    sleep 3
+ }
+
+colector(){
+    clear
+    msg -bar
+    print_center -azu "Selecciona Puerto Principal, para Proxy"
+    msg -bar
+
+while [[ -z $porta_socket ]]; do
+    echo -ne "\033[1;37m Digite el Puerto: " && read porta_socket
+    tput cuu1 && tput dl1
+
+        [[ $(mportas|grep -w "${porta_socket}") = "" ]] && {
+            echo -e "\033[1;33m $(fun_trans  "Puerto python:")\033[1;32m ${porta_socket} OK"
+            msg -bar3
+        } || {
+            echo -e "\033[1;33m $(fun_trans  "Puerto python:")\033[1;31m ${porta_socket} FAIL" && sleep 2
+            tput cuu1 && tput dl1
+            unset porta_socket
+        }
+ done
+
+ if [[ $1 = "PDirect" ]]; then
+
+     print_center -azu "Selec Puerto Local SSH/DROPBEAR/OPENVPN"
+     msg -bar3
+
+     while [[ -z $local ]]; do
+        echo -ne "\033[1;97m Digite el Puerto: \033[0m" && read local
+        tput cuu1 && tput dl1
+
+        [[ $(mportas|grep -w "${local}") = "" ]] && {
+            echo -e "\033[1;33m $(fun_trans  "Puerto local:")\033[1;31m ${local} FAIL" && sleep 2
+            tput cuu1 && tput dl1
+            unset local
+        } || {
+            echo -e "\033[1;33m $(fun_trans  "Puerto local:")\033[1;32m ${local} OK"
+            msg -bar3
+        }
+    done
+     print_center -azu "Response personalizado (enter por defecto 200)"
+     print_center -ama "NOTA : Para OVER WEBSOCKET escribe (101)"
+     msg -bar3
+     echo -ne "\033[1;97m Digite un Response: \033[0m" && read response
+     tput cuu1 && tput dl1
+     if [[ -z $response ]]; then
+        response="200"
+        echo -e "\033[1;33m $(fun_trans  "Response:")\033[1;32m ${response} OK"
+    else
+        echo -e "\033[1;33m $(fun_trans  "Response:")\033[1;32m ${response} OK"
+    fi
+    msg -bar3
+ fi
+
+    if [[ ! $1 = "PGet" ]] && [[ ! $1 = "POpen" ]]; then
+        print_center -azu "Introdusca su Mini-Banner"
+        msg -bar3
+        print_center -azu "Introduzca un texto [Plano] o en [HTML]"
+        echo ""
+        read texto_soket
+    fi
+
+    if [[ $1 = "PPriv" ]]; then
+        py="python3"
+        IP=$(fun_ip)
+    elif [[ $1 = "PGet" ]]; then
+        echo "master=NetVPS" > ${ADM_tmp}/pwd.pwd
+        while read service; do
+            [[ -z $service ]] && break
+            echo "127.0.0.1:$(echo $service|cut -d' ' -f2)=$(echo $service|cut -d' ' -f1)" >> ${ADM_tmp}/pwd.pwd
+        done <<< "$(mportas)"
+         porta_bind="0.0.0.0:$porta_socket"
+         pass_file="${ADM_tmp}/pwd.pwd"
+         py="python"
+    else
+        py="python"
+    fi
+
+    [[ ! -z $porta_bind ]] && conf="-b $porta_bind "|| conf="-p $porta_socket "
+    [[ ! -z $pass_file ]] && conf+="-p $pass_file"
+    [[ ! -z $local ]] && conf+="-l $local "
+    [[ ! -z $response ]] && conf+="-r $response "
+    [[ ! -z $IP ]] && conf+="-i $IP "
+    [[ ! -z $texto_soket ]] && conf+="-t '$texto_soket'"
+
+echo -e "[Unit]
+Description=$1 Service by @Rufu99
+After=network.target
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+User=root
+WorkingDirectory=/root
+ExecStart=/usr/bin/$py ${ADM_inst}/$1.py $conf
+Restart=always
+RestartSec=3s
+
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/python.$porta_socket.service
+
+    systemctl enable python.$porta_socket &>/dev/null
+    systemctl start python.$porta_socket &>/dev/null
+
+    if [[ $1 = "PGet" ]]; then
+        [[ "$(ps x | grep "PGet.py" | grep -v "grep" | awk -F "pts" '{print $1}')" ]] && {
+            print_center -verd "$(fun_trans  "Gettunel Iniciado com Exito")" 
+            print_center -azu "$(fun_trans  "Su Contraseña Gettunel es"): $(msg -ama "NetVPS")"
+            msg -bar3
+        } || {
+            print_center -verm2 "$(fun_trans  "Gettunel no fue iniciado")"
+            msg -bar3
+        }
+    fi
+    msg -bar
+    print_center -verd "PYTHON INICIADO CON EXITO!!!"
+    msg -bar
+    sleep 3
+}
+
+iniciarsocks () {
+pidproxy=$(ps x | grep -w "PPub.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy ]] && P1="\033[1;32m[ON]" || P1="\033[1;31m[OFF]"
+pidproxy2=$(ps x | grep -w  "PPriv.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy2 ]] && P2="\033[1;32m[ON]" || P2="\033[1;31m[OFF]"
+pidproxy3=$(ps x | grep -w  "PDirect.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy3 ]] && P3="\033[1;32m[ON]" || P3="\033[1;31m[OFF]"
+pidproxy4=$(ps x | grep -w  "POpen.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy4 ]] && P4="\033[1;32m[ON]" || P4="\033[1;31m[OFF]"
+pidproxy5=$(ps x | grep "PGet.py" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy5 ]] && P5="\033[1;32m[ON]" || P5="\033[1;31m[OFF]"
+pidproxy6=$(ps x | grep "scktcheck" | grep -v "grep" | awk -F "pts" '{print $1}') && [[ ! -z $pidproxy6 ]] && P6="\033[1;32m[ON]" || P6="\033[1;31m[OFF]"
+print_center -ama "$(fun_trans  "INSTALADOR SOCKS PYTHON")"
+msg -bar
+echo -ne "$(msg -verd "  [1]") $(msg -verm2 ">") " && msg -azu "Socks Python SIMPLE      $P1"
+echo -ne "$(msg -verd "  [2]") $(msg -verm2 ">") " && msg -azu "Socks Python SEGURO      $P2"
+echo -ne "$(msg -verd "  [3]") $(msg -verm2 ">") " && msg -azu "Socks Python DIRETO      $P3"
+echo -ne "$(msg -verd "  [4]") $(msg -verm2 ">") " && msg -azu "Socks Python OPENVPN     $P4"
+echo -ne "$(msg -verd "  [5]") $(msg -verm2 ">") " && msg -azu "Socks Python GETTUNEL    $P5"
+msg -bar
+
+py=6
+if [[ $(lsof -V -i tcp -P -n|grep -v "ESTABLISHED"|grep -v "COMMAND"|grep "python"|wc -l) -ge "2" ]]; then
+    echo -e "$(msg -verd "  [6]") $(msg -verm2 ">") $(msg -azu "DETENER TODOS") $(msg -verd "  [7]") $(msg -verm2 ">") $(msg -azu "DETENER UN PUERTO")"
+    py=7
+else
+    echo -e "$(msg -verd "  [6]") $(msg -verm2 ">") $(msg -azu "DETENER TODOS")"
+fi
+
+msg -bar
+echo -ne "$(msg -verd "  [0]") $(msg -verm2 ">") " && msg -bra "   \033[1;41m VOLVER \033[0m"
+msg -bar
+
+selection=$(selection_fun ${py})
+case ${selection} in
+    1)colector PPub;;
+    2)colector PPriv;;
+    3)colector PDirect;;
+    4)colector POpen;;
+    5)colector PGet;;
+    6)stop_all;;
+    7)stop_port;;
+    0)return 1;;
+esac
+return 1
+}
+iniciarsocks

+ 293 - 0
R9/ADMRufu-31/install/squid.sh

@@ -0,0 +1,293 @@
+#!/bin/bash
+lshost(){
+  n=1
+    for i in `cat $payload|awk -F "/" '{print $1,$2,$3,$4}'`; do
+      echo -e " $(msg -verd "$n)") $(msg -verm2 ">") $(msg -teal "$i")"
+      pay[$n]=$i
+      let n++
+    done
+}
+
+fun_squid(){
+  if [[ -e /etc/squid/squid.conf ]]; then
+    var_squid="/etc/squid/squid.conf"
+  elif [[ -e /etc/squid3/squid.conf ]]; then
+    var_squid="/etc/squid3/squid.conf"
+  fi
+
+  [[ -e $var_squid ]] && {
+    clear
+    msg -bar
+    print_center -ama "$(fun_trans "REMOVIENDO SQUID")"
+    print_center -ama "Aguarde un momento!!!"
+    msg -bar
+
+    [[ -d "/etc/squid" ]] && {
+      service squid stop > /dev/null 2>&1
+      apt-get remove squid -y >/dev/null 2>&1
+      apt-get purge squid -y >/dev/null 2>&1
+      rm -rf /etc/squid >/dev/null 2>&1
+    }
+
+    [[ -d "/etc/squid3" ]] && {
+      service squid3 stop > /dev/null 2>&1
+      apt-get remove squid3 -y >/dev/null 2>&1
+      apt-get purge squid3 -y >/dev/null 2>&1
+      rm -rf /etc/squid3 >/dev/null 2>&1
+    }
+    clear
+    msg -bar
+    print_center -verd "$(fun_trans "Squid removido")"
+    [[ -e $var_squid ]] && rm -rf $var_squid
+    [[ -e /etc/payloads ]] && rm -rf /etc/payloads
+    enter
+    return 1
+  }
+
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "INSTALADOR SQUID ADMRufu")"
+  msg -bar
+  print_center -ama " $(fun_trans "Seleccione los puertos en orden secuencial")"
+  print_center -ama "      Ejemplo: \e[32m80 8080 8799 3128"
+  msg -bar
+  while [[ -z $PORT ]]; do
+        msg -ne " $(fun_trans "Digite los Puertos:") "; read PORT
+        tput cuu1 && tput dl1
+
+        [[ $(mportas|grep -w "${PORT}") = "" ]] && {
+            echo -e "\033[1;33m $(fun_trans  "Puerto de squid:")\033[1;32m ${PORT} OK"
+        } || {
+            echo -e "\033[1;33m $(fun_trans  "Puerto de squid:")\033[1;31m ${PORT} FAIL" && sleep 2
+            tput cuu1 && tput dl1
+            unset PORT
+        }
+  done
+
+  msg -bar
+  print_center -ama " $(fun_trans  "INSTALANDO SQUID")"
+  msg -bar
+  fun_bar "apt-get install squid3 -y"
+  msg -bar
+  print_center -ama " $(fun_trans "INICIANDO CONFIGURACION")"
+ 
+cat <<-EOF > /etc/payloads
+.bookclaro.com.br/
+.claro.com.ar/
+.claro.com.br/
+.claro.com.co/
+.claro.com.ec/
+.claro.com.gt/
+.cloudfront.net/
+.claro.com.ni/
+.claro.com.pe/
+.claro.com.sv/
+.claro.cr/
+.clarocurtas.com.br/
+.claroideas.com/
+.claroideias.com.br/
+.claromusica.com/
+.clarosomdechamada.com.br/
+.clarovideo.com/
+.facebook.net/
+.facebook.com/
+.netclaro.com.br/
+.oi.com.br/
+.oimusica.com.br/
+.speedtest.net/
+.tim.com.br/
+.timanamaria.com.br/
+.vivo.com.br/
+.rdio.com/
+.compute-1.amazonaws.com/
+.portalrecarga.vivo.com.br/
+.vivo.ddivulga.com/  
+EOF
+
+  unset var_squid
+  if [[ -d /etc/squid ]]; then
+    var_squid="/etc/squid/squid.conf"
+  elif [[ -d /etc/squid3 ]]; then
+    var_squid="/etc/squid3/squid.conf"
+  fi
+
+  ip=$(fun_ip)
+
+cat <<-EOF > $var_squid
+#Configuracion SquiD
+acl url1 dstdomain -i $ip
+acl url2 dstdomain -i 127.0.0.1
+acl url3 url_regex -i '/etc/payloads'
+acl url4 dstdomain -i localhost
+acl all src 0.0.0.0/0
+http_access allow url1
+http_access allow url2
+http_access allow url3
+http_access allow url4
+http_access deny all
+
+#puertos
+EOF
+
+for pts in $(echo -e $PORT); do
+  echo -e "http_port $pts" >> $var_squid
+  [[ -f "/usr/sbin/ufw" ]] && ufw allow $pts/tcp &>/dev/null 2>&1
+done
+
+cat <<-EOF >> $var_squid
+#Nombre Squid
+visible_hostname ADMRufu
+
+via off
+forwarded_for off
+pipeline_prefetch off
+EOF
+
+print_center -ama "$(fun_trans "REINICIANDO SERVICIOS")"
+
+[[ -d "/etc/squid/" ]] && {
+  service ssh restart > /dev/null 2>&1
+  /etc/init.d/squid start > /dev/null 2>&1
+  service squid restart > /dev/null 2>&1
+}
+
+[[ -d "/etc/squid3/" ]] && {
+  service ssh restart > /dev/null 2>&1
+  /etc/init.d/squid3 start > /dev/null 2>&1
+  service squid3 restart > /dev/null 2>&1
+}
+
+sleep 2s
+tput cuu1 && tput dl1
+print_center -verd "$(fun_trans "SQUID CONFIGURADO")"
+enter
+}
+
+add_host(){
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Hosts Actuales Dentro del Squid")"
+  msg -bar
+  lshost
+  back
+
+  while [[ $hos != \.* ]]; do
+      msg -nazu " $(fun_trans "Digita un nuevo host"): " && read hos
+      [[ $hos = 0 ]] && return 1
+      tput cuu1 && tput dl1
+      [[ $hos = \.* ]] && continue
+      print_center -ama "$(fun_trans "El host deve comensar con") .punto.com"
+      sleep 3s
+      tput cuu1 && tput dl1
+  done
+
+  host="$hos/"
+  [[ -z $host ]] && return 1
+
+  if [[ `grep -c "^$host" $payload` -eq 1 ]]; then
+      print_center -ama " $(fun_trans "El host ya exciste")"
+      enter
+      return 1
+  fi
+
+  echo "$host" >> $payload && grep -v "^$" $payload > /tmp/a && mv /tmp/a $payload
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Host Agregado con Exito")"
+  msg -bar
+  lshost
+  msg -bar
+  print_center -ama "Reiniciando servicios"
+
+  if [[ ! -f "/etc/init.d/squid" ]]; then
+      service squid3 reload &>/dev/null
+      service squid3 restart &>/dev/null
+   else
+      /etc/init.d/squid reload &>/dev/null
+      service squid restart &>/dev/null
+  fi
+
+  tput cuu1 && tput dl1
+  tput cuu1 && tput dl1
+  enter
+  return 1
+}
+
+del_host(){
+  unset opcion
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Hosts Actuales Dentro del Squid")"
+  msg -bar
+  lshost
+  back
+  while [[ -z $opcion ]]; do
+      msg -ne " Eliminar el host numero: "
+      read opcion
+      if [[ ! $opcion =~ $numero ]]; then
+        tput cuu1 && tput dl1
+        print_center -verm2 "ingresa solo numeros"
+        sleep 2s
+        tput cuu1 && tput dl1
+        unset opcion
+      elif [[ $opcion -gt ${#pay[@]} ]]; then
+        tput cuu1 && tput dl1
+        print_center -ama "solo numeros entre 0 y ${#pay[@]}"
+        sleep 2s
+        tput cuu1 && tput dl1
+        unset opcion
+      fi
+  done
+  [[ $opcion = 0 ]] && return 1
+  host="${pay[$opcion]}/"
+  [[ -z $host ]] && return 1
+  [[ `grep -c "^$host" $payload` -ne 1 ]] && print_center -ama "$(fun_trans  "Host No Encontrado")" && return 1
+  grep -v "^$host" $payload > /tmp/a && mv /tmp/a $payload
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Host Removido Con Exito")"
+  msg -bar
+  lshost
+  msg -bar
+  print_center -ama "Reiniciando servicios"
+
+  if [[ ! -f "/etc/init.d/squid" ]]; then
+      service squid3 reload &>/dev/null
+      service squid3 restart &>/dev/null
+  else
+      /etc/init.d/squid reload &>/dev/null
+      service squid restart &>/dev/null
+  fi
+
+  tput cuu1 && tput dl1
+  tput cuu1 && tput dl1
+  enter
+  return 1
+}
+
+online_squid(){
+  payload="/etc/payloads"
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "CONFIGURACION DE SQUID")"
+  msg -bar
+  menu_func "$(fun_trans "Colocar Host en Squid")" "$(fun_trans "Remover Host de Squid")" "$(fun_trans "Desinstalar Squid")"
+  back
+  opcion=$(selection_fun 3)
+
+  case $opcion in
+    1)add_host;;
+    2)del_host;;
+    3)fun_squid;;
+    0)return 1;;
+  esac
+}
+
+if [[ -e /etc/squid/squid.conf ]]; then
+  online_squid
+elif [[ -e /etc/squid3/squid.conf ]]; then
+  online_squid
+else
+  fun_squid
+  return 1
+fi

+ 216 - 0
R9/ADMRufu-31/install/ssl.sh

@@ -0,0 +1,216 @@
+#!/bin/bash
+#19/12/2019
+
+drop_port(){
+    local portasVAR=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
+    local NOREPEAT
+    local reQ
+    local Port
+
+    while read port; do
+        reQ=$(echo ${port}|awk '{print $1}')
+        Port=$(echo {$port} | awk '{print $9}' | awk -F ":" '{print $2}')
+        [[ $(echo -e $NOREPEAT|grep -w "$Port") ]] && continue
+        NOREPEAT+="$Port\n"
+
+        case ${reQ} in
+            cupsd)continue;;
+            systemd-r)continue;;
+            stunnel4|stunnel)continue;;
+            *)DPB+=" $reQ:$Port";;
+        esac
+    done <<< "${portasVAR}"
+ }
+
+ssl_stunel(){
+    [[ $(mportas|grep stunnel4|head -1) ]] && {
+        clear
+        msg -bar
+        print_center -ama "Parando Stunnel"
+        msg -bar
+        service stunnel4 stop & >/dev/null 2>&1
+        fun_bar 'apt-get purge stunnel4 -y' 'UNINSTALL STUNNEL4 '
+        msg -bar
+        print_center -verd "Stunnel detenido con Exito!"
+        msg -bar
+        sleep 2
+        return 1
+    }
+    title "INSTALADOR SSL By @Rufu99"
+    print_center -azu "Seleccione puerto de redireccion de trafico"
+    msg -bar
+    drop_port
+    n=1
+    for i in $DPB; do
+        proto=$(echo $i|awk -F ":" '{print $1}')
+        proto2=$(printf '%-12s' "$proto")
+        port=$(echo $i|awk -F ":" '{print $2}')
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -ama "$proto2")$(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done
+    msg -bar
+
+    while [[ -z $opc ]]; do
+        msg -ne " opcion: "
+        read opc
+        tput cuu1 && tput dl1
+
+        if [[ -z $opc ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ ! $opc =~ $numero ]]; then
+            msg -verm2 " selecciona solo numeros entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ "$opc" -gt "$num_opc" ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            sleep 2
+            tput cuu1 && tput dl1
+            unset opc
+            continue
+        fi
+    done
+
+    title "INSTALADOR SSL By @Rufu99"
+    echo -e "\033[1;33m Puerto de redireccion de trafico: \033[1;32m${drop[$opc]}"
+    msg -bar
+    while [[ -z $opc2 ]]; do
+        echo -ne "\033[1;37m Ingrese un puerto para SSL: " && read opc2
+        tput cuu1 && tput dl1
+
+        [[ $(mportas|grep -w "${opc2}") = "" ]] && {
+            echo -e "\033[1;33m $(fun_trans  "Puerto de ssl:")\033[1;32m ${opc2} OK"
+        } || {
+            echo -e "\033[1;33m $(fun_trans  "Puerto de ssl:")\033[1;31m ${opc2} FAIL" && sleep 2
+            tput cuu1 && tput dl1
+            unset opc2
+        }
+    done
+
+    # openssl x509 -in 2.crt -text -noout |grep -w 'Issuer'|awk -F 'O = ' '{print $2}'|cut -d ',' -f1
+
+    msg -bar
+    fun_bar 'apt-get install stunnel4 -y' 'INSTALL STUNNEL4 '
+    echo -e "client = no\n[SSL]\ncert = /etc/stunnel/stunnel.pem\naccept = ${opc2}\nconnect = 127.0.0.1:${drop[$opc]}" > /etc/stunnel/stunnel.conf
+
+    db="$(ls ${ADM_crt})"
+    opcion="n"
+    if [[ ! "$(echo "$db"|grep ".crt")" = "" ]]; then
+        cert=$(echo "$db"|grep ".crt")
+        key=$(echo "$db"|grep ".key")
+        msg -bar
+        print_center -azu "CERTIFICADO SSL ENCONTRADO"
+        msg -bar
+        echo -e "$(msg -azu "CERT:") $(msg -ama "$cert")"
+        echo -e "$(msg -azu "KEY:")  $(msg -ama "$key")"
+        msg -bar
+        msg -ne "Continuar, usando estre certificado [S/N]: "
+        read opcion
+        if [[ $opcion != @(n|N) ]]; then
+            cp ${ADM_crt}/$cert ${ADM_tmp}/stunnel.crt
+            cp ${ADM_crt}/$key ${ADM_tmp}/stunnel.key
+        fi
+    fi
+
+    if [[ $opcion != @(s|S) ]]; then
+        openssl genrsa -out ${ADM_tmp}/stunnel.key 2048 > /dev/null 2>&1
+        (echo "" ; echo "" ; echo "" ; echo "" ; echo "" ; echo "" ; echo "@cloudflare" )|openssl req -new -key ${ADM_tmp}/stunnel.key -x509 -days 1000 -out ${ADM_tmp}/stunnel.crt > /dev/null 2>&1
+    fi
+    cat ${ADM_tmp}/stunnel.key ${ADM_tmp}/stunnel.crt > /etc/stunnel/stunnel.pem
+    sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
+    service stunnel4 restart > /dev/null 2>&1
+    msg -bar
+    print_center -verd "INSTALADO CON EXITO"
+    msg -bar
+    rm -rf ${ADM_tmp}/stunnel.crt > /dev/null 2>&1
+    rm -rf ${ADM_tmp}/stunnel.key > /dev/null 2>&1
+    sleep 3
+    return 1
+}
+
+add_port(){
+    title "INSTALADOR SSL By @Rufu99"
+    print_center -azu "Seleccione puerto de redireccion de trafico"
+    msg -bar
+    drop_port
+    n=1
+    for i in $DPB; do
+        proto=$(echo $i|awk -F ":" '{print $1}')
+        proto2=$(printf '%-12s' "$proto")
+        port=$(echo $i|awk -F ":" '{print $2}')
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -ama "$proto2")$(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done
+    msg -bar
+
+    while [[ -z $opc ]]; do
+        msg -ne " opcion: "
+        read opc
+        tput cuu1 && tput dl1
+
+        if [[ -z $opc ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ ! $opc =~ $numero ]]; then
+            msg -verm2 " selecciona solo numeros entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ "$opc" -gt "$num_opc" ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            sleep 2
+            tput cuu1 && tput dl1
+            unset opc
+            continue
+        fi
+    done
+
+    title "INSTALADOR SSL By @Rufu99"
+    echo -e "\033[1;33m Puerto de redireccion de trafico: \033[1;32m${drop[$opc]}"
+    msg -bar
+    while [[ -z $opc2 ]]; do
+        echo -ne "\033[1;37m Ingrese un puerto para SSL: " && read opc2
+        tput cuu1 && tput dl1
+
+        [[ $(mportas|grep -w "${opc2}") = "" ]] && {
+            echo -e "\033[1;33m $(fun_trans  "Puerto de ssl:")\033[1;32m ${opc2} OK"
+        } || {
+            echo -e "\033[1;33m $(fun_trans  "Puerto de ssl:")\033[1;31m ${opc2} FAIL" && sleep 2
+            tput cuu1 && tput dl1
+            unset opc2
+        }
+    done
+    echo -e "client = no\n[SSL+]\ncert = /etc/stunnel/stunnel.pem\naccept = ${opc2}\nconnect = 127.0.0.1:${drop[$opc]}" >> /etc/stunnel/stunnel.conf
+    service stunnel4 restart > /dev/null 2>&1
+    msg -bar
+    print_center -verd "PUERTO AGREGADO CON EXITO"
+    msg -bar
+    sleep 3
+    return 1
+}
+
+title "INSTALADOR SSL By @Rufu99"
+menu_func "ININICIAR O PARAR SSL" "AGREGAR PUERTOS SSL"
+msg -bar
+echo -ne "$(msg -verd " [0]") $(msg -verm2 ">") " && msg -bra "\033[1;41mVOLVER"
+msg -bar
+msg -ne " Opcion: "
+read opcao
+case $opcao in
+    1)ssl_stunel;;
+    2)add_port;;
+    0) return 1;;
+esac

+ 97 - 0
R9/ADMRufu-31/install/swapfile.sh

@@ -0,0 +1,97 @@
+#!/bin/bash
+
+funcion_crear(){
+	if [[ -e "/swapfile" ]]; then
+		title "DETENIENDO MEMORIA SWAP"
+		fun_bar 'swapoff -a' 'STOP SWAPFILE  '
+		fun_bar 'sed -i '/swap/d' /etc/fstab' 'REMOV AUTO-RUN '
+		fun_bar 'sed -i '/vm.swappiness/d' /etc/sysctl.conf' 'REMOV PRORITY  '
+		fun_bar 'sysctl -p' 'RELOAD CONFG   '
+		fun_bar 'rm -rf /swapfile' 'REMOV SWAPFILE '
+		msg -bar
+		print_center -verd "SWAPFILE DETENIDO"
+		msg -bar
+		read foo
+		return
+	fi
+
+	memoria=$(dmidecode --type memory | grep ' MB'|awk '{print $2}')
+	if [[ "$memoria" -gt "2048" ]]; then
+		msg -azu " Su sistema cuenta con mas de 2GB de ram\n No es necesario la creacion de memoria swap" 
+		msg -bar
+		read foo
+		return 1
+	fi
+	title "INSTALADO MEMORIA SWAP"
+	fun_bar 'fallocate -l 2G /swapfile' 'MAKE SWAPFILE    '
+	#fun_bar "dd if=/dev/zero of=$swap bs=1MB count=2048" 'MAKE SWAPFILE    '
+	fun_bar 'ls -lh /swapfile' 'VERIFIC SWAPFILE '
+	fun_bar 'chmod 600 /swapfile' 'ASSIGN PERMISOS  '
+	fun_bar 'mkswap /swapfile' 'ASSIGN FORMATO   '
+	msg -bar
+	print_center -verd "SWAPFILE CREADO CON EXITO"
+	msg -bar
+	read foo	
+}
+
+funcion_activar(){
+	title "ACTIVAR SWAPFILE"
+	menu_func "PREMANENTE" "HASTA EL PROXIMO REINICO"
+	back
+	opcion=$(selection_fun 2)
+	case $opcion in
+		  1)sed -i '/swap/d' $fstab
+			echo "$swap none swap sw 0 0" >> $fstab
+			swapon $swap
+			print_center -verd "SWAPFILE ACTIVO"
+			msg -bar
+			sleep 2;;
+		  2)swapon $swap
+			print_center -verd "SWAPFILE ACTIVO"
+			msg -bar
+			sleep 2;;
+    	  0)return;;
+	esac
+}
+
+
+funcion_prio(){
+	title "PRIORIDAD SWAP"
+	menu_func "10" "20 (recomendado)" "30" "40" "50" "60" "70" "80" "90" "100"
+	back
+	opcion=$(selection_fun 10)
+	case $opcion in
+		0)return;;
+		*)
+if [[ $(cat "$sysctl"|grep "vm.swappiness") = "" ]]; then
+	echo "vm.swappiness=${opcion}0" >> $sysctl
+	sysctl -p &>/dev/null
+else
+	sed -i '/vm.swappiness=/d' $sysctl
+	echo "vm.swappiness=${opcion}0" >> $sysctl
+	sysctl -p &>/dev/null
+fi
+print_center -verd "PRIORIDAD SWAP EN ${opcion}0"
+msg -bar
+sleep 2;;
+	esac
+}
+
+while :
+do
+	title 'SWAP MANAGER By @Rufu99'
+	menu_func "CREAR/DESACTIVAR /SWAPFILE" \
+	"ACTIVAR SWAP" \
+	"PRIORIDAD SWAP"
+	back
+	opcion="$(selection_fun 3)"
+
+	case $opcion in
+		1)funcion_crear;;
+		2)funcion_activar;;
+		3)funcion_prio;;
+		0)break;;
+	esac
+	[[ "$?" = "1" ]] && break
+done
+return 1

+ 690 - 0
R9/ADMRufu-31/install/tcp.sh

@@ -0,0 +1,690 @@
+#!/bin/bash
+#19/12/2019
+clear
+msg -bar 
+PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
+export PATH
+SCPfrm="/etc/ger-frm" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
+BARRA1="\e[0;31m--------------------------------------------------------------------\e[0m"
+SCPinst="/etc/ger-inst" && [[ ! -d ${SCPfrm} ]] && mkdir ${SCPfrm}
+#=================================================
+#	System Required: CentOS 6/7,Debian 8/9,Ubuntu 16+
+#	Description: BBR+BBRVersión mágica+BBRplus+Lotserver
+#	Version: 1.3.1
+#	Author: Mil sombras,cx9208
+#	Blog: https://www.94ish.me/
+#=================================================
+
+sh_ver="1.3.1"
+github="raw.githubusercontent.com/cx9208/Linux-NetSpeed/master"
+
+Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
+Info="${Green_font_prefix}[Informacion]${Font_color_suffix}"
+Error="${Red_font_prefix}[Error]${Font_color_suffix}"
+Tip="${Green_font_prefix}[Atencion]${Font_color_suffix}"
+
+#Instalar el núcleo BBR
+installbbr(){
+	kernel_version="4.11.8"
+	if [[ "${release}" == "centos" ]]; then
+		rpm --import http://${github}/bbr/${release}/RPM-GPG-KEY-elrepo.org
+		yum install -y http://${github}/bbr/${release}/${version}/${bit}/kernel-ml-${kernel_version}.rpm
+		yum remove -y kernel-headers
+		yum install -y http://${github}/bbr/${release}/${version}/${bit}/kernel-ml-headers-${kernel_version}.rpm
+		yum install -y http://${github}/bbr/${release}/${version}/${bit}/kernel-ml-devel-${kernel_version}.rpm
+	elif [[ "${release}" == "debian" || "${release}" == "ubuntu" ]]; then
+		mkdir bbr && cd bbr
+		apt install libssl1.0.0 -y
+		#wget https://debian.sipwise.com/debian-security/pool/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u10_amd64.deb
+		#wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u12_amd64.deb
+		wget -N --no-check-certificate http://${github}/bbr/debian-ubuntu/linux-headers-${kernel_version}-all.deb
+		wget -N --no-check-certificate http://${github}/bbr/debian-ubuntu/${bit}/linux-headers-${kernel_version}.deb
+		wget -N --no-check-certificate http://${github}/bbr/debian-ubuntu/${bit}/linux-image-${kernel_version}.deb
+	
+		#dpkg -i libssl1.0.0_1.0.1t-1+deb8u10_amd64.deb
+		dpkg -i linux-headers-${kernel_version}-all.deb
+		dpkg -i linux-headers-${kernel_version}.deb
+		dpkg -i linux-image-${kernel_version}.deb
+		cd .. && rm -rf bbr
+	fi
+	detele_kernel
+	BBR_grub
+	msg -bar
+	echo -e "${Tip} Después de reiniciar el VPS, vuelva a ejecutar el script para abrir\n${Red_font_prefix} BBR/BBR Versión mágica${Font_color_suffix}"
+	msg -bar
+	stty erase '^H' && read -p "Debe reiniciar el VPS antes de poder habilitar BBR, reiniciar ahora. ? [Y/n] :" yn
+	[ -z "${yn}" ] && yn="y"
+	if [[ $yn == [Yy] ]]; then
+		echo -e "${Info} VPS se reinicia ..."
+		reboot
+	fi
+}
+
+#Instale el núcleo BBRplus
+installbbrplus(){
+	kernel_version="4.14.129-bbrplus"
+	if [[ "${release}" == "centos" ]]; then
+		wget -N --no-check-certificate https://${github}/bbrplus/${release}/${version}/kernel-${kernel_version}.rpm
+		yum install -y kernel-${kernel_version}.rpm
+		rm -f kernel-${kernel_version}.rpm
+		kernel_version="4.14.129_bbrplus" #fix a bug
+	elif [[ "${release}" == "debian" || "${release}" == "ubuntu" ]]; then
+		mkdir bbrplus && cd bbrplus
+		wget -N --no-check-certificate http://${github}/bbrplus/debian-ubuntu/${bit}/linux-headers-${kernel_version}.deb
+		wget -N --no-check-certificate http://${github}/bbrplus/debian-ubuntu/${bit}/linux-image-${kernel_version}.deb
+		dpkg -i linux-headers-${kernel_version}.deb
+		dpkg -i linux-image-${kernel_version}.deb
+		cd .. && rm -rf bbrplus
+	fi
+	detele_kernel
+	BBR_grub
+	msg -bar
+	echo -e "${Tip} Después de reiniciar el VPS, vuelva a ejecutar el script para abrir\n${Red_font_prefix} BBRplus${Font_color_suffix}"
+	msg -bar
+	stty erase '^H' && read -p "Debe reiniciar el VPS antes de poder habilitar BBRplus, reiniciar ahora ? [Y/n] :" yn
+	[ -z "${yn}" ] && yn="y"
+	if [[ $yn == [Yy] ]]; then
+		echo -e "${Info} VPS se reinicia ..."
+		reboot
+	fi
+}
+
+#Instale el kernel de Lotserver
+installlot(){
+	if [[ "${release}" == "centos" ]]; then
+		rpm --import http://${github}/lotserver/${release}/RPM-GPG-KEY-elrepo.org
+		yum remove -y kernel-firmware
+		yum install -y http://${github}/lotserver/${release}/${version}/${bit}/kernel-firmware-${kernel_version}.rpm
+		yum install -y http://${github}/lotserver/${release}/${version}/${bit}/kernel-${kernel_version}.rpm
+		yum remove -y kernel-headers
+		yum install -y http://${github}/lotserver/${release}/${version}/${bit}/kernel-headers-${kernel_version}.rpm
+		yum install -y http://${github}/lotserver/${release}/${version}/${bit}/kernel-devel-${kernel_version}.rpm
+	elif [[ "${release}" == "ubuntu" ]]; then
+		bash <(wget --no-check-certificate -qO- "http://${github}/Debian_Kernel.sh")
+	elif [[ "${release}" == "debian" ]]; then
+		bash <(wget --no-check-certificate -qO- "http://${github}/Debian_Kernel.sh")
+	fi
+	detele_kernel
+	BBR_grub
+	msg -bar
+	echo -e "${Tip} Después de reiniciar el VPS, vuelva a ejecutar el script para abrir\n${Red_font_prefix}Lotserver${Font_color_suffix}"
+	msg -bar
+	stty erase '^H' && read -p "Necesita reiniciar el VPS antes de poder abrir Lotserver, reiniciar ahora ? [Y/n] :" yn
+	[ -z "${yn}" ] && yn="y"
+	if [[ $yn == [Yy] ]]; then
+		echo -e "${Info} VPS se reinicia ..."
+		reboot
+	fi
+}
+
+# Habilitar BBR
+startbbr(){
+	remove_all
+	echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
+	echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
+	sysctl -p
+	echo -e "${Info}¡BBR comenzó con éxito!"
+	msg -bar
+}
+
+#Habilitar BBRplus
+startbbrplus(){
+	remove_all
+	echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
+	echo "net.ipv4.tcp_congestion_control=bbrplus" >> /etc/sysctl.conf
+	sysctl -p
+	echo -e "${Info}BBRplus comenzó con éxito!!"
+	msg -bar
+}
+
+# Compilar y habilitar el cambio mágico BBR
+startbbrmod(){
+	remove_all
+	if [[ "${release}" == "centos" ]]; then
+		yum install -y make gcc
+		mkdir bbrmod && cd bbrmod
+		wget -N --no-check-certificate http://${github}/bbr/tcp_tsunami.c
+		echo "obj-m:=tcp_tsunami.o" > Makefile
+		make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc
+		chmod +x ./tcp_tsunami.ko
+		cp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4
+		insmod tcp_tsunami.ko
+		depmod -a
+	else
+		apt-get update
+		if [[ "${release}" == "ubuntu" && "${version}" = "14" ]]; then
+			apt-get -y install build-essential
+			apt-get -y install software-properties-common
+			add-apt-repository ppa:ubuntu-toolchain-r/test -y
+			apt-get update
+		fi
+		apt-get -y install make gcc
+		mkdir bbrmod && cd bbrmod
+		wget -N --no-check-certificate http://${github}/bbr/tcp_tsunami.c
+		echo "obj-m:=tcp_tsunami.o" > Makefile
+		ln -s /usr/bin/gcc /usr/bin/gcc-4.9
+		make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc-4.9
+		install tcp_tsunami.ko /lib/modules/$(uname -r)/kernel
+		cp -rf ./tcp_tsunami.ko /lib/modules/$(uname -r)/kernel/net/ipv4
+		depmod -a
+	fi
+	
+
+	echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
+	echo "net.ipv4.tcp_congestion_control=tsunami" >> /etc/sysctl.conf
+	sysctl -p
+    cd .. && rm -rf bbrmod
+	echo -e "${Info}¡La versión mágica de BBR comenzó con éxito!"
+	msg -bar
+}
+
+# Compilar y habilitar el cambio mágico BBR
+startbbrmod_nanqinlang(){
+	remove_all
+	if [[ "${release}" == "centos" ]]; then
+		yum install -y make gcc
+		mkdir bbrmod && cd bbrmod
+		wget -N --no-check-certificate https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/bbr/centos/tcp_nanqinlang.c
+		echo "obj-m := tcp_nanqinlang.o" > Makefile
+		make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc
+		chmod +x ./tcp_nanqinlang.ko
+		cp -rf ./tcp_nanqinlang.ko /lib/modules/$(uname -r)/kernel/net/ipv4
+		insmod tcp_nanqinlang.ko
+		depmod -a
+	else
+		apt-get update
+		if [[ "${release}" == "ubuntu" && "${version}" = "14" ]]; then
+			apt-get -y install build-essential
+			apt-get -y install software-properties-common
+			add-apt-repository ppa:ubuntu-toolchain-r/test -y
+			apt-get update
+		fi
+		apt-get -y install make gcc-4.9
+		mkdir bbrmod && cd bbrmod
+		wget -N --no-check-certificate https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/bbr/tcp_nanqinlang.c
+		echo "obj-m := tcp_nanqinlang.o" > Makefile
+		make -C /lib/modules/$(uname -r)/build M=`pwd` modules CC=/usr/bin/gcc-4.9
+		install tcp_nanqinlang.ko /lib/modules/$(uname -r)/kernel
+		cp -rf ./tcp_nanqinlang.ko /lib/modules/$(uname -r)/kernel/net/ipv4
+		depmod -a
+	fi
+	
+
+	echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
+	echo "net.ipv4.tcp_congestion_control=nanqinlang" >> /etc/sysctl.conf
+	sysctl -p
+	echo -e "${Info}¡La versión mágica de BBR comenzó con éxito!"
+	msg -bar
+}
+
+# Habilitar Lotserver
+startlotserver(){
+	remove_all
+	if [[ "${release}" == "centos" ]]; then
+		yum install ethtool
+	else
+		apt-get update
+		apt-get install ethtool
+	fi
+	bash <(wget --no-check-certificate -qO- https://github.com/MoeClub/lotServer/raw/master/Install.sh) install
+	start_menu
+}
+
+# Desinstalar toda la aceleración
+remove_all(){
+	rm -rf bbrmod
+	sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf
+    sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf
+    sed -i '/fs.file-max/d' /etc/sysctl.conf
+	sed -i '/net.core.rmem_max/d' /etc/sysctl.conf
+	sed -i '/net.core.wmem_max/d' /etc/sysctl.conf
+	sed -i '/net.core.rmem_default/d' /etc/sysctl.conf
+	sed -i '/net.core.wmem_default/d' /etc/sysctl.conf
+	sed -i '/net.core.netdev_max_backlog/d' /etc/sysctl.conf
+	sed -i '/net.core.somaxconn/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_syncookies/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_tw_reuse/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_tw_recycle/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_fin_timeout/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_keepalive_time/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.ip_local_port_range/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_syn_backlog/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_tw_buckets/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_rmem/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_wmem/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_mtu_probing/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf
+	sed -i '/fs.inotify.max_user_instances/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_syncookies/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_fin_timeout/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_tw_reuse/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_syn_backlog/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.ip_local_port_range/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_tw_buckets/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.route.gc_timeout/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_synack_retries/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_syn_retries/d' /etc/sysctl.conf
+	sed -i '/net.core.somaxconn/d' /etc/sysctl.conf
+	sed -i '/net.core.netdev_max_backlog/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_timestamps/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_orphans/d' /etc/sysctl.conf
+	if [[ -e /appex/bin/lotServer.sh ]]; then
+		bash <(wget --no-check-certificate -qO- https://github.com/MoeClub/lotServer/raw/master/Install.sh) uninstall
+	fi
+	clear
+	echo -e "${Info}:La aceleración está Desinstalada."
+	sleep 1s
+}
+
+#Optimizar la configuración del sistema
+optimizing_system(){
+	sed -i '/fs.file-max/d' /etc/sysctl.conf
+	sed -i '/fs.inotify.max_user_instances/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_syncookies/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_fin_timeout/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_tw_reuse/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_syn_backlog/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.ip_local_port_range/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_tw_buckets/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.route.gc_timeout/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_synack_retries/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_syn_retries/d' /etc/sysctl.conf
+	sed -i '/net.core.somaxconn/d' /etc/sysctl.conf
+	sed -i '/net.core.netdev_max_backlog/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_timestamps/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.tcp_max_orphans/d' /etc/sysctl.conf
+	sed -i '/net.ipv4.ip_forward/d' /etc/sysctl.conf
+	echo "fs.file-max = 1000000
+fs.inotify.max_user_instances = 8192
+net.ipv4.tcp_syncookies = 1
+net.ipv4.tcp_fin_timeout = 30
+net.ipv4.tcp_tw_reuse = 1
+net.ipv4.ip_local_port_range = 1024 65000
+net.ipv4.tcp_max_syn_backlog = 16384
+net.ipv4.tcp_max_tw_buckets = 6000
+net.ipv4.route.gc_timeout = 100
+net.ipv4.tcp_syn_retries = 1
+net.ipv4.tcp_synack_retries = 1
+net.core.somaxconn = 32768
+net.core.netdev_max_backlog = 32768
+net.ipv4.tcp_timestamps = 0
+net.ipv4.tcp_max_orphans = 32768
+# forward ipv4
+net.ipv4.ip_forward = 1">>/etc/sysctl.conf
+	sysctl -p
+	echo "*               soft    nofile           1000000
+*               hard    nofile          1000000">/etc/security/limits.conf
+	echo "ulimit -SHn 1000000">>/etc/profile
+	read -p "Después de aplicar la configuracion al VPS necesita reiniciar, reiniciar ahora ? [Y/n] :" yn
+	msg -bar 
+	[ -z "${yn}" ] && yn="y"
+	if [[ $yn == [Yy] ]]; then
+		echo -e "${Info} Reinicio de VPS..."
+		reboot
+	fi
+}
+# Script de actualización
+Update_Shell(){
+	echo -e "La versión actual es [ ${sh_ver} ],Empieza a detectar la última versión..."
+	sh_new_ver=$(wget --no-check-certificate -qO- "http://${github}/tcp.sh"|grep 'sh_ver="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1)
+	[[ -z ${sh_new_ver} ]] && echo -e "${Error} Error al detectar la última versión !" && start_menu
+	if [[ ${sh_new_ver} != ${sh_ver} ]]; then
+		echo -e "Descubre nueva versión[ ${sh_new_ver} ],Ya sea para actualizar?[Y/n]"
+		read -p "(Por defecto: y):" yn
+		[[ -z "${yn}" ]] && yn="y"
+		if [[ ${yn} == [Yy] ]]; then
+			wget -N --no-check-certificate http://${github}/tcp.sh && chmod +x tcp.sh
+			echo -e "El script ha sido actualizado a la última versión.[ ${sh_new_ver} ] !"
+		else
+			echo && echo "	Cancelado ..." && echo
+		fi
+	else
+		echo -e "Actualmente la última versión[ ${sh_new_ver} ] !"
+		sleep 5s
+	fi
+}
+
+# Menú de inicio
+start_menu(){
+clear
+msg -bar
+echo -e " TCP Aceleración (BBR/Plus) MOD By @Rufu99 ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix}
+$(msg -bar)
+ ${Green_font_prefix}0.${Font_color_suffix} Script de actualización
+——————————————————Gestión del Núcleo—————————————————
+ ${Green_font_prefix}1.${Font_color_suffix} Instalación BBR/BBR Kernel Mágico
+ ${Green_font_prefix}2.${Font_color_suffix} Instalación BBRplus Kernel 
+ ${Green_font_prefix}3.${Font_color_suffix} Instalación Lotserver Kernel (Velocidad Aguda)
+——————————————————Gestión Acelerada——————————————————
+ ${Green_font_prefix}4.${Font_color_suffix} Usar BBR Aceleración
+ ${Green_font_prefix}5.${Font_color_suffix} Usar BBR Velocidad de revisión mágica
+ ${Green_font_prefix}6.${Font_color_suffix} Usar BBR Aceleración Violenta de revisión mágica
+ ${Green_font_prefix}7.${Font_color_suffix} Usar BBRplus Aceleración
+ ${Green_font_prefix}8.${Font_color_suffix} Usar Lotserver (Velocidad Brusca) Aceleración
+——————————————————Manejo misceláneo——————————————————
+ ${Green_font_prefix}9.${Font_color_suffix} Desintalar Todas las Aceleraciones
+ ${Green_font_prefix}10.${Font_color_suffix} Optimización de la configuración del sistema.
+ ${Green_font_prefix}11.${Font_color_suffix} Salir del script
+—————————————————————————————————————————————————————" && msg -bar
+
+	check_status
+	if [[ ${kernel_status} == "noinstall" ]]; then
+		echo -e " Estado actual: ${Green_font_prefix}No instalado\n${Font_color_suffix} Kernel Acelerado ${Red_font_prefix}Por favor, instale el Núcleo primero.${Font_color_suffix}"
+	else
+		echo -e " Estado actual: ${Green_font_prefix}Instalado\n${Font_color_suffix} ${_font_prefix}${kernel_status}${Font_color_suffix} Kernel Acelerado, ${Green_font_prefix}${run_status}${Font_color_suffix}"
+		
+	fi
+msg -bar
+read -p " Por favor ingrese un número [0-11]:" num
+case "$num" in
+	0)
+	Update_Shell
+	;;
+	1)
+	check_sys_bbr
+	;;
+	2)
+	check_sys_bbrplus
+	;;
+	3)
+	check_sys_Lotsever
+	;;
+	4)
+	startbbr
+	;;
+	5)
+	startbbrmod
+	;;
+	6)
+	startbbrmod_nanqinlang
+	;;
+	7)
+	startbbrplus
+	;;
+	8)
+	startlotserver
+	;;
+	9)
+	remove_all
+	;;
+	10)
+	optimizing_system
+	;;
+	11)
+	exit 1
+	;;
+	*)
+	clear
+	echo -e "${Error}:Por favor ingrese el número correcto [0-11]"
+	sleep 5s
+	start_menu
+	;;
+esac
+}
+############# Componentes de gestión del núcleo #############
+
+# Eliminar kernel redundante
+detele_kernel(){
+	if [[ "${release}" == "centos" ]]; then
+		rpm_total=`rpm -qa | grep kernel | grep -v "${kernel_version}" | grep -v "noarch" | wc -l`
+		if [ "${rpm_total}" > "1" ]; then
+			echo -e "Detectado ${rpm_total} El resto del núcleo, comienza a desinstalar ..."
+			for((integer = 1; integer <= ${rpm_total}; integer++)); do
+				rpm_del=`rpm -qa | grep kernel | grep -v "${kernel_version}" | grep -v "noarch" | head -${integer}`
+				echo -e "Comience a desinstalar${rpm_del} Kernel ..."
+				rpm --nodeps -e ${rpm_del}
+				echo -e "Desinstalar ${rpm_del} La desinstalación del núcleo se ha completado, continúa ..."
+			done
+			echo --nodeps -e "El núcleo se desinstala y continúa ..."
+		else
+			echo -e " El número de núcleos detectados es incorrecto, ¡por favor verifique!" && exit 1
+		fi
+	elif [[ "${release}" == "debian" || "${release}" == "ubuntu" ]]; then
+		deb_total=`dpkg -l | grep linux-image | awk '{print $2}' | grep -v "${kernel_version}" | wc -l`
+		if [ "${deb_total}" > "1" ]; then
+			echo -e "Detectado ${deb_total} El resto del núcleo, comienza a desinstalar ..."
+			for((integer = 1; integer <= ${deb_total}; integer++)); do
+				deb_del=`dpkg -l|grep linux-image | awk '{print $2}' | grep -v "${kernel_version}" | head -${integer}`
+				echo -e "Comience a desinstalar ${deb_del} Kernel ..."
+				apt-get purge -y ${deb_del}
+				echo -e "Desinstalar ${deb_del} La desinstalación del núcleo se ha completado, continúa ..."
+			done
+			echo -e "El núcleo se desinstala y continúa ..."
+		else
+			echo -e " El número de núcleos detectados es incorrecto, ¡por favor verifique!" && exit 1
+		fi
+	fi
+}
+
+#Actualizar arranque
+BBR_grub(){
+	if [[ "${release}" == "centos" ]]; then
+        if [[ ${version} = "6" ]]; then
+            if [ ! -f "/boot/grub/grub.conf" ]; then
+                echo -e "${Error} /boot/grub/grub.conf No encontrado, verifique."
+                exit 1
+            fi
+            sed -i 's/^default=.*/default=0/g' /boot/grub/grub.conf
+        elif [[ ${version} = "7" ]]; then
+            if [ ! -f "/boot/grub2/grub.cfg" ]; then
+                echo -e "${Error} /boot/grub2/grub.cfg No encontrado, verifique."
+                exit 1
+            fi
+            grub2-set-default 0
+        fi
+    elif [[ "${release}" == "debian" || "${release}" == "ubuntu" ]]; then
+        /usr/sbin/update-grub
+    fi
+}
+
+#############Componente de gestión del kernel#############
+
+
+
+#############Componentes de detección del sistema#############
+
+#Sistema de inspección
+check_sys(){
+	if [[ -f /etc/redhat-release ]]; then
+		release="centos"
+	elif cat /etc/issue | grep -q -E -i "debian"; then
+		release="debian"
+	elif cat /etc/issue | grep -q -E -i "ubuntu"; then
+		release="ubuntu"
+	elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
+		release="centos"
+	elif cat /proc/version | grep -q -E -i "debian"; then
+		release="debian"
+	elif cat /proc/version | grep -q -E -i "ubuntu"; then
+		release="ubuntu"
+	elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
+		release="centos"
+    fi
+}
+
+#Verifique la versión de Linux
+check_version(){
+	if [[ -s /etc/redhat-release ]]; then
+		version=`grep -oE  "[0-9.]+" /etc/redhat-release | cut -d . -f 1`
+	else
+		version=`grep -oE  "[0-9.]+" /etc/issue | cut -d . -f 1`
+	fi
+	bit=`uname -m`
+	if [[ ${bit} = "x86_64" ]]; then
+		bit="x64"
+	else
+		bit="x32"
+	fi
+}
+
+#Verifique los requisitos del sistema para instalar bbr
+check_sys_bbr(){
+	check_version
+	if [[ "${release}" == "centos" ]]; then
+		if [[ ${version} -ge "6" ]]; then
+			installbbr
+		else
+			echo -e "${Error} BBR El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	elif [[ "${release}" == "debian" ]]; then
+		if [[ ${version} -ge "8" ]]; then
+			installbbr
+		else
+			echo -e "${Error} BBR El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	elif [[ "${release}" == "ubuntu" ]]; then
+		if [[ ${version} -ge "14" ]]; then
+			installbbr
+		else
+			echo -e "${Error} BBR El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	else
+		echo -e "${Error} BBR El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+	fi
+}
+
+check_sys_bbrplus(){
+	check_version
+	if [[ "${release}" == "centos" ]]; then
+		if [[ ${version} -ge "6" ]]; then
+			installbbrplus
+		else
+			echo -e "${Error} BBRplus El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	elif [[ "${release}" == "debian" ]]; then
+		if [[ ${version} -ge "8" ]]; then
+			installbbrplus
+		else
+			echo -e "${Error} BBRplus El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	elif [[ "${release}" == "ubuntu" ]]; then
+		if [[ ${version} -ge "14" ]]; then
+			installbbrplus
+		else
+			echo -e "${Error} BBRplus El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	else
+		echo -e "${Error} BBRplus El núcleo no es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+	fi
+}
+
+
+#Verifique los requisitos del sistema para instalar Lotsever
+check_sys_Lotsever(){
+	check_version
+	if [[ "${release}" == "centos" ]]; then
+		if [[ ${version} == "6" ]]; then
+			kernel_version="2.6.32-504"
+			installlot
+		elif [[ ${version} == "7" ]]; then
+			yum -y install net-tools
+			kernel_version="3.10.0-327"
+			installlot
+		else
+			echo -e "${Error} Lotsever No es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	elif [[ "${release}" == "debian" ]]; then
+		if [[ ${version} = "7" || ${version} = "8" ]]; then
+			if [[ ${bit} == "x64" ]]; then
+				kernel_version="3.16.0-4"
+				installlot
+			elif [[ ${bit} == "x32" ]]; then
+				kernel_version="3.2.0-4"
+				installlot
+			fi
+		elif [[ ${version} = "9" ]]; then
+			if [[ ${bit} == "x64" ]]; then
+				kernel_version="4.9.0-4"
+				installlot
+			fi
+		else
+			echo -e "${Error} Lotsever No es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	elif [[ "${release}" == "ubuntu" ]]; then
+		if [[ ${version} -ge "12" ]]; then
+			if [[ ${bit} == "x64" ]]; then
+				kernel_version="4.4.0-47"
+				installlot
+			elif [[ ${bit} == "x32" ]]; then
+				kernel_version="3.13.0-29"
+				installlot
+			fi
+		else
+			echo -e "${Error} Lotsever No es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+		fi
+	else
+		echo -e "${Error} Lotsever No es compatible con el sistema actual ${release} ${version} ${bit} !" && exit 1
+	fi
+}
+
+check_status(){
+	kernel_version=`uname -r | awk -F "-" '{print $1}'`
+	kernel_version_full=`uname -r`
+	if [[ ${kernel_version_full} = "4.14.129-bbrplus" ]]; then
+		kernel_status="BBRplus"
+	elif [[ ${kernel_version} = "3.10.0" || ${kernel_version} = "3.16.0" || ${kernel_version} = "3.2.0" || ${kernel_version} = "4.4.0" || ${kernel_version} = "3.13.0"  || ${kernel_version} = "2.6.32" || ${kernel_version} = "4.9.0" ]]; then
+		kernel_status="Lotserver"
+	elif [[ `echo ${kernel_version} | awk -F'.' '{print $1}'` == "4" ]] && [[ `echo ${kernel_version} | awk -F'.' '{print $2}'` -ge 9 ]] || [[ `echo ${kernel_version} | awk -F'.' '{print $1}'` == "5" ]]; then
+		kernel_status="BBR"
+	else 
+		kernel_status="noinstall"
+	fi
+
+	if [[ ${kernel_status} == "Lotserver" ]]; then
+		if [[ -e /appex/bin/lotServer.sh ]]; then
+			run_status=`bash /appex/bin/lotServer.sh status | grep "LotServer" | awk  '{print $3}'`
+			if [[ ${run_status} = "running!" ]]; then
+				run_status="Comenzó exitosamente"
+			else 
+				run_status="No se pudo iniciar"
+			fi
+		else 
+			run_status="No hay un módulo de aceleración instalado"
+		fi
+	elif [[ ${kernel_status} == "BBR" ]]; then
+		run_status=`grep "net.ipv4.tcp_congestion_control" /etc/sysctl.conf | awk -F "=" '{print $2}'`
+		if [[ ${run_status} == "bbr" ]]; then
+			run_status=`lsmod | grep "bbr" | awk '{print $1}'`
+			if [[ ${run_status} == "tcp_bbr" ]]; then
+				run_status="BBR Comenzó exitosamente"
+			else 
+				run_status="BBR Comenzó exitosamente"
+			fi
+		elif [[ ${run_status} == "tsunami" ]]; then
+			run_status=`lsmod | grep "tsunami" | awk '{print $1}'`
+			if [[ ${run_status} == "tcp_tsunami" ]]; then
+				run_status="BBR La revisión mágica se lanzó con éxito"
+			else 
+				run_status="BBR Inicio de modificación mágica fallido"
+			fi
+		elif [[ ${run_status} == "nanqinlang" ]]; then
+			run_status=`lsmod | grep "nanqinlang" | awk '{print $1}'`
+			if [[ ${run_status} == "tcp_nanqinlang" ]]; then
+				run_status="El violento manifestante de BBR se lanzó con éxito"
+			else 
+				run_status="Violenta revisión mágica de BBR no pudo comenzar"
+			fi
+		else 
+			run_status="No hay un módulo de aceleración instalado"
+		fi
+	elif [[ ${kernel_status} == "BBRplus" ]]; then
+		run_status=`grep "net.ipv4.tcp_congestion_control" /etc/sysctl.conf | awk -F "=" '{print $2}'`
+		if [[ ${run_status} == "bbrplus" ]]; then
+			run_status=`lsmod | grep "bbrplus" | awk '{print $1}'`
+			if [[ ${run_status} == "tcp_bbrplus" ]]; then
+				run_status="BBRplus comenzó con éxito"
+			else 
+				run_status="BBRplus comenzó con éxito"
+			fi
+		else 
+			run_status="No hay un módulo de aceleración instalado"
+		fi
+	fi
+}
+
+#############Componentes de detección del sistema#############
+check_sys
+check_version
+[[ ${release} != "debian" ]] && [[ ${release} != "ubuntu" ]] && [[ ${release} != "centos" ]] && echo -e "${Error} Este script no es compatible con el sistema actual. ${release} !" && exit 1
+start_menu
+

+ 824 - 0
R9/ADMRufu-31/install/userHWID

@@ -0,0 +1,824 @@
+#!/bin/bash
+
+USRdatabase="${ADM_user}/ADMuser"
+[[ ! -d ${ADM_user}/B-ADMuser ]] && mkdir ${ADM_user}/B-ADMuser
+
+err_fun(){
+  case $1 in
+    1)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Cliente Nulo")"; sleep 2s; tput cuu1; tput dl1;;
+    2)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Nombre de Cliente muy corto")"; sleep 2s; tput cuu1; tput dl1;;
+    3)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Nombre de Cliente muy largo")"; sleep 2s; tput cuu1; tput dl1;;
+    4)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Contraseña Nula")"; sleep 2s; tput cuu1; tput dl1;;
+    5)tput cuu1; tput dl1 && msg -verm "$(fun_trans "HWID corto, verifi catidad caracteres")"; sleep 2s; tput cuu1; tput dl1;;
+    6)tput cuu1; tput dl1 && msg -verm "$(fun_trans "HWID largo, verifi catidad caracteres")"; sleep 2s; tput cuu1; tput dl1;;
+    7)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion Nula")"; sleep 2s; tput cuu1; tput dl1;;
+    8)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion invalida utilize numeros")"; sleep 2s; tput cuu1; tput dl1;;
+    9)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion maxima y de un año")"; sleep 2s; tput cuu1; tput dl1;;
+    11)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite Nulo")"; sleep 2s; tput cuu1; tput dl1;;
+    12)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite invalido utilize numeros")"; sleep 2s; tput cuu1; tput dl1;;
+    13)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite maximo de 999")"; sleep 2s; tput cuu1; tput dl1;;
+    14)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Cliente o HWID ya existe")"; sleep 2s; tput cuu1; tput dl1;;
+  esac
+}
+
+data_user(){
+  cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog')
+  [[ -z "$(echo "${cat_users}"|awk -F ':' '{print $5}'|cut -d ',' -f1|grep -w 'hwid'|head -1)" ]] && print_center -verm2 "NO HAY CLIENTES HWID REGISTRADOS" && return 1
+	dat_us=$(printf '%-20s%-12s%-8s%s' 'Cliente' 'Fecha' 'Dias' 'Statu')
+	msg -azu "  N°  $dat_us"
+	msg -bar
+
+	i=1
+	for u in `echo "${cat_users}"|awk -F ':' '{print $1}'`; do
+
+    fix_hwid_token=$(echo "${cat_users}"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f1) && [[ "${fix_hwid_token}" != @(hwid) ]] && continue
+
+		fecha=$(chage -l "$u"|sed -n '4p'|awk -F ': ' '{print $2}')
+
+		mes_dia=$(echo $fecha|awk -F ',' '{print $1}'|sed 's/ //g')
+		ano=$(echo $fecha|awk -F ', ' '{printf $2}'|cut -c 3-)
+		us=$(printf '%-12s' "$u")
+
+		pass=$(cat "/etc/passwd"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+		[[ "${#pass}" -gt '12' ]] && pass="Desconosida"
+		pass="$(printf '%-19s' "$pass")"
+
+		unset stat
+		if [[ $(passwd --status $u|cut -d ' ' -f2) = "P" ]]; then
+			stat="$(msg -verd "ULK")"
+		else
+			stat="$(msg -verm2 "LOK")"
+		fi
+
+		echo -ne "  $(msg -verd "$i)")$(msg -verm2 "-") $(msg -azu "${pass}")"
+		if [[ $(echo $fecha|awk '{print $2}') = "" ]]; then
+			exp="$(printf '%8s%-2s' '[X]')"
+			exp+="$(printf '%-6s' '[X]')"
+			echo " $(msg -verm2 "$fecha")$(msg -verd "$exp")$(echo -e "$stat")"	
+		else
+			if [[ $(date +%s) -gt $(date '+%s' -d "${fecha}") ]]; then
+				exp="$(printf '%-5s' "Exp")"
+				echo " $(msg -verm2 "$mes_dia/$ano")  $(msg -verm2 "$exp")$(echo -e "$stat")"
+			else
+				EXPTIME="$(($(($(date '+%s' -d "${fecha}") - $(date +%s))) / 86400))"
+				if [[ "${#EXPTIME}" = "1" ]]; then
+            exp="$(printf '%6s%-7s' "$EXPTIME")"
+        elif [[ "${#EXPTIME}" = "2" ]]; then
+            exp="$(printf '%7s%-6s' "$EXPTIME")"
+        else
+            exp="$(printf '%7s%-5s' "$EXPTIME")"
+        fi
+				echo " $(msg -verm2 "$mes_dia/$ano")$(msg -verd "$exp")$(echo -e "$stat")"
+			fi
+		fi
+    echo -e "      $(msg -ama "HWID:") $(msg -azu "${us}")"
+    msg -bar3
+		let i++
+	done
+  tput cuu1 && tput dl1
+
+}
+
+#======CREAR NUEVO USUARIO===========
+#useradd -M -s /bin/false -e 2021-10-16 -K PASS_MAX_DAYS=1 ruso99
+add_user(){
+  Fecha=`date +%d-%m-%y-%R`
+  [[ $(cat /etc/passwd |grep $1: |grep -vi [a-z]$1 |grep -v [0-9]$1 > /dev/null) ]] && return 1
+  valid=$(date '+%C%y-%m-%d' -d " +$3 days")
+  clear
+  msg -bar
+
+  system=$(cat -n /etc/issue |grep 1 |cut -d ' ' -f6,7,8 |sed 's/1//' |sed 's/      //')
+  distro=$(echo "$system"|awk '{print $1}')
+  vercion=$(echo $system|awk '{print $2}'|cut -d '.' -f1)
+
+  if [[ ${distro} = @(Ubuntu|Debian) ]]; then
+    if [[ ${vercion} = "16" ]]; then
+      pass=$(openssl passwd -1 $2)
+    else
+      pass=$(openssl passwd -6 $2)
+    fi
+  fi
+
+  if useradd -M -s /bin/false -e ${valid} -K PASS_MAX_DAYS=$3 -p ${pass} -c hwid,$1 $2 ; then
+
+    if [[ $4 = @(s|S) ]]; then
+      rm -rf /etc/openvpn/easy-rsa/pki/reqs/$1.req
+      rm -rf /etc/openvpn/easy-rsa/pki/issued/$1.crt
+      rm -rf /etc/openvpn/easy-rsa/pki/private/$1.key
+      cd /etc/openvpn/easy-rsa/
+      ./easyrsa build-client-full $1 nopass > /dev/null 2>&1
+      cd
+      cp /etc/openvpn/client-common.txt ~/$1.ovpn
+      echo "<ca>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn
+      echo "</ca>" >> ~/$1.ovpn
+      echo "<cert>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn
+      echo "</cert>" >> ~/$1.ovpn
+      echo "<key>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn
+      echo "</key>" >> ~/$1.ovpn
+      echo "<tls-auth>" >> ~/$1.ovpn
+      cat /etc/openvpn/ta.key >> ~/$1.ovpn
+      echo "</tls-auth>" >> ~/$1.ovpn
+
+      cd $HOME
+      zip ./$1.zip ./$1.ovpn > /dev/null 2>&1
+      rm ./$1.ovpn > /dev/null 2>&1
+
+      zip_ovpn="$HOME/$1.zip"
+
+    fi
+
+  	print_center -verd "$(fun_trans "Usuario Creado con Exito")"
+  else
+  	print_center -verm2 "$(fun_trans "Error, Usuario no creado")"
+  	msg -bar
+  	sleep 3
+  	return
+  fi
+  msg -bar
+}
+
+mostrar_usuarios(){
+  for u in `cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'hwid'|awk -F ':' '{print $1}'`; do
+    echo "$u"
+  done
+}
+
+new_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "CREAR USUARIOS")"
+  msg -bar
+  data_user
+  back
+
+  while true; do
+    msg -ne "$(fun_trans "Nombre De cliente"): "
+    read cliente
+    cliente="$(echo $cliente|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    cliente="$(echo $cliente|sed -e 's/[^a-z0-9 -]//ig')"
+    if [[ -z $cliente ]]; then
+      err_fun 1 && continue
+    elif [[ "${cliente}" = "0" ]]; then
+      return
+    elif [[ "${#cliente}" -lt "4" ]]; then
+      err_fun 2 && continue
+    elif [[ "${#cliente}" -gt "20" ]]; then
+      err_fun 3 && continue
+    elif [[ "$(echo ${usuarios_ativos[@]}|grep -w "$cliente")" ]]; then
+      err_fun 14 && continue
+    fi
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "HWID")"
+    read -p ": " hwid
+    hwid="$(echo $hwid|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    if [[ -z $hwid ]]; then
+      err_fun 4 && continue
+    elif [[ "${#hwid}" -lt "30" ]]; then
+      err_fun 5 && continue
+    elif [[ "${#hwid}" -gt "35" ]]; then
+      err_fun 6 && continue
+    fi
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "Tiempo de coneccion")"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      err_fun 9 && continue
+    fi 
+    break
+  done
+
+  [[ $(dpkg --get-selections|grep -w "openvpn"|head -1) ]] && [[ -e /etc/openvpn/openvpn-status.log ]] && {
+
+    while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
+      msg -ne "$(fun_trans "Crear Archivo") OpenVPN? [S/N]: "
+      read -e -i S newfile
+    done
+  }
+
+  add_user "${cliente}" "${hwid}" "${diasuser}" "${newfile}"
+
+  msg -ne " $(fun_trans "IP del Servidor"): " && msg -ama "    $(fun_ip)"
+  msg -ne " $(fun_trans "Cliente"): " && msg -ama "            $cliente"
+  msg -ne " $(fun_trans "Dias de Duracion"): " && msg -ama "   $diasuser"
+  msg -ne " $(fun_trans "Fecha de Expiracion"): " && msg -ama "$(date "+%F" -d " + $diasuser days")"
+  [[ ! -z "$zip_ovpn" ]] && msg -ne " $(fun_trans "Archivo OVPN"): " && msg -ama "       $zip_ovpn"
+  msg -ne " $(fun_trans "HWID"): " && msg -ama "$hwid"
+  msg -bar
+  print_center -ama "►► Presione enter para continuar ◄◄"
+  read
+  return 1
+}
+#===================================
+
+#======CREAR USUARIO TEMPORAL======
+
+mktmpuser(){
+	while [[ -z $name ]]; do
+		msg -ne " Nombre del usuario: "
+		read name
+		if [[ -z $name ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva un nombre de usuario"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset name
+			continue
+		fi
+	done
+
+	if cat /etc/passwd |grep $name: |grep -vi [a-z]$name |grep -v [0-9]$name > /dev/null ; then
+		tput cuu1 && tput dl1
+		msg -verm2 " El usuario $name ya existe"
+		sleep 2
+		tput cuu1 && tput dl1
+		return
+	fi
+
+	while [[ -z $pass ]]; do
+		msg -ne " Contraseña: "
+		read pass
+		if [[ -z $pass ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva una Contraseña"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset pass
+			continue
+		fi
+	done
+
+	while [[ -z $tmp ]]; do
+		msg -ne " Duracion en minutos: "
+		read tmp
+		if [[ -z $tmp ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva un tiempo de duracion"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset tmp
+			continue
+		fi
+	done
+
+	if [[ -z $1 ]]; then
+		msg -ne " Aplicar a conf Default [S/N]: "
+		read def
+		if [[ ! "$def" != @(s|S|y|Y) ]]; then
+			echo -e "usuario=$name
+Contraseña=$pass
+Tiempo=$tmp" > ${Default}
+		fi
+	fi
+
+	useradd -M -s /bin/false -p $(openssl passwd -6 $pass) $name
+	#(echo $pass; echo $pass)|passwd $name 2>/dev/null
+	touch /tmp/$name
+
+	timer=$(( $tmp * 60 ))
+	timer2="'$timer's"
+	echo "#!/bin/bash
+sleep $timer2
+kill"' $(ps -u '"$name |awk '{print"' $tmp'"}') 1> /dev/null 2> /dev/null
+userdel --force $name
+rm -rf /tmp/$name
+exit" > /tmp/$name
+
+	chmod 777 /tmp/$name
+	touch /tmp/cmd
+	chmod 777 /tmp/cmd
+	echo "nohup /tmp/$name & >/dev/null" > /tmp/cmd
+	/tmp/cmd 2>/dev/null 1>/dev/null
+	rm -rf /tmp/cmd
+
+	title "USUARIO TEMPORAL CREADO"
+	echo -e " $(msg -verm2 "IP:        ") $(msg -ama "$(fun_ip)")"
+	echo -e " $(msg -verm2 "Usuario:   ") $(msg -ama "$name")"
+	echo -e " $(msg -verm2 "Contraseña:") $(msg -ama "$pass")"
+	echo -e " $(msg -verm2 "Duracion:  ") $(msg -ama "$tmp minutos")"
+	msg -bar
+	read foo
+	return
+}
+
+userTMP(){
+	tmp_f="${ADM_user}/userTMP" && [[ ! -d ${tmp_f} ]] && mkdir ${tmp_f}
+	Default="${tmp_f}/Default"
+	if [[ ! -e ${Default} ]]; then
+		echo -e "usuario=ADMRufu
+Contraseña=ADMRufu
+Tiempo=15" > ${Default}
+	fi
+
+	name="$(cat ${Default}|grep "usuario"|cut -d "=" -f2)"
+	pass="$(cat ${Default}|grep "Contraseña"|cut -d "=" -f2)"
+	tmp="$(cat ${Default}|grep "Tiempo"|cut -d "=" -f2)"
+
+	title "CONF DE USUARIO TEMPORAL"
+	print_center -teal "Usuario Default"
+	msg -bar3
+	echo -e " $(msg -verm2 "IP:        ") $(msg -ama "$(fun_ip)")"
+	echo -e " $(msg -verm2 "Usuario:   ") $(msg -ama "$name")"
+	echo -e " $(msg -verm2 "Contraseña:") $(msg -ama "$pass")"
+	echo -e " $(msg -verm2 "Duracion:  ") $(msg -ama "$tmp minutos")"
+	msg -bar
+	menu_func "APLICAR CONF DEFAULT" "CONF PERSONALIZADA"
+	back
+	opcion=$(selection_fun 2)
+	case $opcion in
+		1)mktmpuser "def";;
+		2)unset name
+		  unset pass
+		  unset tmp
+		  mktmpuser;;
+		0)return;;
+	esac
+}
+#===========================================
+
+#=====REMOVER USUARIO=======================
+rm_user(){
+  #nome
+  if userdel --force "$1" ; then
+    sed -i "/$1/d" ${ADM_user}/passwd
+  	print_center -verd "[$(fun_trans "Removido")]"
+  else
+  	print_center -verm "[$(fun_trans "No Removido")]"
+  fi
+}
+
+remove_user(){
+	clear
+	usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "REMOVER USUARIOS")"
+  msg -bar
+  data_user
+	back
+
+	print_center -ama "$(fun_trans "Escriba o Seleccione un Usuario")"
+	msg -bar
+	unset selection
+	while [[ -z ${selection} ]]; do
+		msg -nazu "$(fun_trans "Seleccione Una Opcion"): " && read selection
+		tput cuu1 && tput dl1
+	done
+	[[ ${selection} = "0" ]] && return
+
+  client_chek=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'hwid')
+
+	if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+		usuario_del="${usuarios_ativos[$selection]}"
+	else
+		usuario_del=$(echo "$client_chek"|grep -w "$selection"|awk -F ':' '{print $1}')
+	fi
+	[[ -z $usuario_del ]] && {
+		msg -verm "$(fun_trans "Error, Cliente Invalido")"
+		msg -bar
+		return 1
+	}
+	[[ ! $(echo ${usuarios_ativos[@]}|grep -w "$usuario_del") ]] && {
+		msg -verm "$(fun_trans "Error, Cliente Invalido")"
+		msg -bar
+		return 1
+	}
+
+  client=$(echo "$client_chek"|grep -w "$usuario_del"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+
+	print_center -ama "$(fun_trans "Cliente Seleccionado"): $client"
+	pkill -u $usuario_del
+	droplim=`droppids|grep -w "$usuario_del"|awk '{print $2}'` 
+	kill -9 $droplim &>/dev/null
+	rm_user "$usuario_del"
+	msg -bar
+	sleep 3
+}
+
+#========RENOVAR USUARIOS==========
+
+renew_user_fun(){
+  #nome dias
+  datexp=$(date "+%F" -d " + $2 days") && valid=$(date '+%C%y-%m-%d' -d " + $2 days")
+  if chage -E $valid $1 ; then
+  	print_center -ama "$(fun_trans "Cliente Renovado Con Exito")"
+  else
+  	print_center -verm "$(fun_trans "Error, Cliente no Renovado")"
+  fi
+}
+
+renew_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "RENOVAR CLIENTE")"
+  msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o seleccione un cliente")"
+  msg -bar
+  unset selection
+  while [[ -z ${selection} ]]; do
+    msg -nazu "$(fun_trans " Seleccione una Opcion"): " && read selection
+    tput cuu1 && tput dl1
+  done
+
+  [[ ${selection} = "0" ]] && return
+
+  client_chek=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'hwid')
+
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    useredit="${usuarios_ativos[$selection]}"
+  else
+    useredit=$(echo "$client_chek"|grep -w "$selection"|awk -F ':' '{print $1}')
+  fi
+
+  [[ -z $useredit ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    sleep 3
+    return 1
+  }
+
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$useredit") ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    sleep 3
+    return 1
+  }
+
+  client=$(echo "$client_chek"|grep -w "$useredit"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+
+  while true; do
+    msg -ne "$(fun_trans "Nuevo Tiempo de Duracion de"): $client"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      echo -e '\n\n\n'
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      echo -e '\n\n\n'
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      echo -e '\n\n\n'
+      err_fun 9 && continue
+    fi
+    break
+  done
+  msg -bar
+  renew_user_fun "${useredit}" "${diasuser}"
+  msg -bar
+  sleep 3
+}
+
+eliminar_all(){
+  title "ELIMINAR TODOS LOS CLIENTES"
+  msg -ne " [S/N]: "
+  read opcion
+  [[ "${opcion}" != @(S|s) ]] && return 1
+  enter
+  service dropbear stop &>/dev/null
+  service sshd stop &>/dev/null
+  service ssh stop &>/dev/null
+  service stunnel4 stop &>/dev/null
+  service squid stop &>/dev/null
+
+  cat_users=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w "hwid")
+
+  for user in `echo "$cat_users"|awk -F ':' '{print $1}'`; do
+    userpid=$(ps -u $user |awk {'print $1'})
+    kill "$userpid" 2>/dev/null
+    client=$(echo "$cat_users"|grep -w "$user"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+    userdel --force $user
+    user2=$(printf '%-15s' "$client")
+    echo -e " $(msg -azu "CLIENTE:") $(msg -ama "$user2")$(msg -verm2 "Eliminado")"
+  done
+  service sshd restart &>/dev/null
+  service ssh restart &>/dev/null
+  service dropbear start &>/dev/null
+  service stunnel4 start &>/dev/null
+  service squid restart &>/dev/null
+  msg -bar
+  print_center -ama "CONEXIONES ELIMINANDOS"
+  enter
+  return 1
+}
+
+sshmonitor(){
+	clear
+  cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog')
+	cab=$(printf '%-15s%-13s%-15s%-9s' 'USUARIO' 'STATUS' 'CONEXIONES' 'TIEMPO')
+	msg -bar 
+	echo -e "\E[41;1;37m $cab\E[0m"
+	msg -bar
+    for i in `echo "$cat_users"|awk -F ':' '{print $1}'`; do
+        user="$i"
+        s2ssh="$(echo "$cat_users"|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f1)"
+
+        if [[ "$(echo "$cat_users"| grep -w $i| wc -l)" = "1" ]]; then
+          sqd="$(ps -u $user | grep sshd | wc -l)"
+        else
+          sqd=00
+        fi
+
+        [[ "$sqd" = "" ]] && sqd=0
+        if [[ -e /etc/openvpn/openvpn-status.log ]]; then
+          ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$i", | wc -l)"
+        else
+          ovp=0
+        fi
+
+        if netstat -nltp|grep 'dropbear'> /dev/null;then
+          drop="$(droppids | grep "$i" | wc -l)"
+        else
+          drop=0
+        fi
+        
+        cnx=$(($sqd + $drop))
+        conex=$(($cnx + $ovp))
+        if [[ $cnx -gt 0 ]]; then
+          tst="$(ps -o etime $(ps -u $i |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')"
+          tst1=$(echo "$tst" | wc -c)
+        if [[ "$tst1" == "9" ]]; then 
+          timerr="$(ps -o etime $(ps -u $i |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')"
+        else
+          timerr="$(echo "00:$tst")"
+        fi
+        elif [[ $ovp -gt 0 ]]; then
+          tmp2=$(printf '%(%H:%M:%S)T\n')
+          tmp1="$(grep -w "$i" /etc/openvpn/openvpn-status.log |awk '{print $4}'| head -1)"
+          [[ "$tmp1" = "" ]] && tmp1="00:00:00" && tmp2="00:00:00"
+          var1=`echo $tmp1 | cut -c 1-2`
+          var2=`echo $tmp1 | cut -c 4-5`
+          var3=`echo $tmp1 | cut -c 7-8`
+          var4=`echo $tmp2 | cut -c 1-2`
+          var5=`echo $tmp2 | cut -c 4-5`
+          var6=`echo $tmp2 | cut -c 7-8`
+          calc1=`echo $var1*3600 + $var2*60 + $var3 | bc`
+          calc2=`echo $var4*3600 + $var5*60 + $var6 | bc`
+          seg=$(($calc2 - $calc1))
+          min=$(($seg/60))
+          seg=$(($seg-$min*60))
+          hor=$(($min/60))
+          min=$(($min-$hor*60))
+          timerusr=`printf "%02d:%02d:%02d \n" $hor $min $seg;`
+          timerr=$(echo "$timerusr" | sed -e 's/[^0-9:]//ig' )
+        else
+          timerr="00:00:00"
+        fi
+
+        if [[ "$s2ssh" != @(hwid|token) ]]; then
+          user=$(printf '%-15s' "$i")
+          con=$(printf '%-11s' "$conex/$s2ssh")
+        else
+          fix="$(echo "$cat_users"|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f2)"
+          user=$(printf '%-15s' "$fix")
+          con=$(printf '%-11s' "$(echo $s2ssh|awk '{print toupper($0)}')")
+        fi
+
+        if [[ $conex -eq 0 ]]; then
+           status=$(printf '%-16s' 'Offline')
+           echo -e " $(msg -ama "$user")$(msg -verm2 "$status")$(msg -verd "$con")$(msg -ama "$timerr")"
+        else
+           status=$(printf '%-16s' 'Online')
+           echo -e " $(msg -ama "$user")$(msg -verd "$status")$(msg -verd "$con")$(msg -ama "$timerr")"
+        fi
+        msg -bar3
+      done
+    tput cuu1 && tput dl1
+    msg -bar
+    print_center -ama "►► Presione enter para continuar ◄◄"
+    read
+}
+
+detail_user(){
+	clear
+	usuarios_ativos=('' $(mostrar_usuarios))
+	if [[ -z ${usuarios_ativos[@]} ]]; then
+		msg -bar
+		print_center -verm2 "$(fun_trans "Ningun usuario registrado")"
+		msg -bar
+		sleep 3
+		return
+	else
+		msg -bar
+		print_center -ama "$(fun_trans "DETALLES DEL LOS USUARIOS")"
+		msg -bar
+	fi
+	data_user
+	enter
+}
+
+block_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+	print_center -ama "$(fun_trans "BLOQUEAR/DESBLOQUEAR CLIENTE")"
+	msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o Seleccione Un Cliente")"
+  msg -bar
+  unset selection
+  while [[ ${selection} = "" ]]; do
+    echo -ne "\033[1;37m Seleccione: " && read selection
+    tput cuu1 && tput dl1
+  done
+  [[ ${selection} = "0" ]] && return
+
+  client_chek=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'hwid')
+
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    usuario_del="${usuarios_ativos[$selection]}"
+  else
+    usuario_del=$(echo "$client_chek"|grep -w "$selection"|awk -F ':' '{print $1}')
+  fi
+  [[ -z $usuario_del ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    return 1
+  }
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$usuario_del") ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    return 1
+  }
+
+  client=$(echo "$client_chek"|grep -w "$usuario_del"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+
+  msg -nama "   $(fun_trans "Cliente"): $client >>>> "
+
+  if [[ $(passwd --status $usuario_del|cut -d ' ' -f2) = "P" ]]; then
+    pkill -u $usuario_del &>/dev/null
+    droplim=`droppids|grep -w "$usuario_del"|awk '{print $2}'` 
+    kill -9 $droplim &>/dev/null
+    usermod -L $usuario_del &>/dev/null
+    sleep 2
+    msg -verm2 "$(fun_trans "Bloqueado")"
+  else
+  	usermod -U $usuario_del
+  	sleep 2
+  	msg -verd "$(fun_trans "Desbloqueado")"
+  fi
+  enter
+}
+
+rm_vencidos(){
+	title "REMOVER CLIENTES VENCIDOS"
+	print_center -ama " Removera todo los clientes hwid expirado"
+	msg -bar
+	msg -ne " Continua [S/N]: "
+	read opcion
+	tput cuu1 && tput dl1
+	[[ "$opcion" != @(s|S|y|Y) ]] && return
+
+	expired="$(fun_trans "Expirado")"
+	removido="$(fun_trans "Removido")"
+	DataVPS=$(date +%s)
+
+	while read user; do
+		DataUser=$(chage -l "$user"|sed -n '4p'|awk -F ': ' '{print $2}')
+		[[ "$DataUser" = @(never|nunca) ]] && continue
+		#[[ "$DataUser" = "ene 01, 1970" ]] && DataUser="Jan 01, 1970"
+		DataSEC=$(date +%s --date="$DataUser")
+
+		if [[ "$DataSEC" -lt "$DataVPS" ]]; then
+			pkill -u $user
+			droplim=`droppids|grep -w "$user"|awk '{print $2}'` 
+			kill -9 $droplim &>/dev/null
+			client=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'hwid'|grep -w "$user"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+      userdel $user
+      print_center -ama "$client $expired ($removido)"
+			sleep 1
+		fi
+	done <<< "$(mostrar_usuarios)"
+	enter
+}
+
+limiter(){
+
+  ltr(){
+    clear
+    msg -bar
+    l_cron=$(cat /var/spool/cron/crontabs/root|grep -w 'limitador.sh'|grep -w 'hwid')
+    if [[ -z "$l_cron" ]]; then
+      echo '@daily /etc/ADMRufu/install/limitador.sh --hwid' >> /var/spool/cron/crontabs/root
+      print_center -verd "limitador de expirados programado\nse ejecutara todos los dias a las 00hs\nsegun la hora programada en el servidor"
+      enter
+      return
+    else
+      sed -i '/limitador.sh --hwid/d' /var/spool/cron/crontabs/root
+      print_center -verm2 "limitador de expirados detenido"
+      enter
+      return   
+    fi
+  }	
+
+	log(){
+		clear
+		msg -bar
+		print_center -ama "REGISTRO DEL LIMITADOR"
+		msg -bar
+		[[ ! -e ${ADM_user}/limit.log ]] && touch ${ADM_user}/limit.log
+		if [[ -z $(cat ${ADM_user}/limit.log) ]]; then
+			print_center -ama "no ahy registro de limitador"
+			msg -bar
+			sleep 2
+			return
+		fi
+		msg -teal "$(cat ${ADM_user}/limit.log)"
+		msg -bar
+		print_center -ama "►► Presione enter para continuar o ◄◄"
+		print_center -ama "►► 0 para limpiar registro ◄◄"
+		read opcion
+		[[ $opcion = "0" ]] && echo "" > ${ADM_user}/limit.log
+	}
+
+	clear
+	msg -bar
+	print_center -ama "LIMITADOR DE CUENTAS"
+	msg -bar
+	menu_func "LIMTADOR DE CONECCIONES" "LIMITADOR DE DATOS $(msg -verm2 "(no diponible)")" "LOG DEL LIMITADOR"
+	back
+	msg -ne " opcion: "
+	read opcion
+	case $opcion in
+		1)ltr;;
+		2);;
+		3)log;;
+		0)return;;
+	esac
+}
+
+USER_MODE(){
+  title "SELECCIONE EL MODO QUE USARA POR DEFECTO"
+  menu_func "SSH" "TOKEN"
+  back
+  opcion=$(selection_fun 2)
+  case $opcion in
+    1) echo "userSSH" > ${ADM_user}/userMODE
+       clear
+       msg -bar
+       print_center -verd "MODO SSH ACTIVA"
+       enter;;
+    2) echo "userTOKEN" > ${ADM_user}/userMODE
+       clear
+       msg -bar
+       print_center -verd "MODO TOKEN ACTIVA"
+       enter;;
+    0)return 1;;
+  esac
+}
+
+while :
+do
+
+	[[ $(cat /var/spool/cron/crontabs/root|grep -w 'limitador.sh'|grep -w 'hwid') ]] && lim=$(msg -verd "[ON]") || lim=$(msg -verm2 "[OFF]")
+
+	title -ama "ADMINISTRACION DE USUARIOS HWID"
+
+	menu_func "NUEVO CLIENTE HWID ✏️ " \
+"$(msg -verm2 "REMOVER CLIENTE") 🗑 " \
+"$(msg -verd "EDITAR/RENOVAR CLIENTE") ♻️" \
+"BLOQ/DESBLOQ CLIENTE 🔒\n$(msg -bar3)" \
+"$(msg -verd "DETALLES DE TODOS CLIENTES") 🔎" \
+"MONITOR DE CLIENTES CONECTADOS" \
+"🔒 $(msg -ama "LIMITADOR-DE-CUENTAS-EXPIRADAS") 🔒 $lim\n$(msg -bar3)" \
+"ELIMINAR CLIENTES VENCIDOS" \
+"⚠️ $(msg -verm2 "ELIMINAR TODOS LOS CLIENTES") ⚠️\n$(msg -bar3)" \
+"BACKUP CLIENTES" \
+"-bar DESACTIVAR PASS ALFANUMERICO $(msg -blu "(VULTR)")" \
+"CAMBIAR A MODO SSH/TOKEN"
+
+	back
+	selection=$(selection_fun 12)
+	case ${selection} in
+		0)break;;
+		1)new_user;;
+		2)remove_user;;
+		3)renew_user;;
+		4)block_user;;
+		5)detail_user;;
+		6)sshmonitor;;
+		7)limiter;;
+		8)rm_vencidos;;
+		9)eliminar_all;;
+		10)backup;;
+		11)ULK_ALF;;
+    12)USER_MODE && break;;
+	esac
+done

+ 1055 - 0
R9/ADMRufu-31/install/userSSH

@@ -0,0 +1,1055 @@
+#!/bin/bash
+
+USRdatabase="${ADM_user}/ADMuser"
+[[ ! -d ${ADM_user}/B-ADMuser ]] && mkdir ${ADM_user}/B-ADMuser
+
+err_fun(){
+  case $1 in
+    1)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Usuario Nulo")"; sleep 2s; tput cuu1; tput dl1;;
+    2)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Usuario con nombre muy corto")"; sleep 2s; tput cuu1; tput dl1;;
+    3)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Usuario con nombre muy grande")"; sleep 2s; tput cuu1; tput dl1;;
+    4)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Contraseña Nula")"; sleep 2s; tput cuu1; tput dl1;;
+    5)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Contraseña muy corta")"; sleep 2s; tput cuu1; tput dl1;;
+    6)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Contraseña muy grande")"; sleep 2s; tput cuu1; tput dl1;;
+    7)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion Nula")"; sleep 2s; tput cuu1; tput dl1;;
+    8)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion invalida utilize numeros")"; sleep 2s; tput cuu1; tput dl1;;
+    9)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion maxima y de un año")"; sleep 2s; tput cuu1; tput dl1;;
+    11)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite Nulo")"; sleep 2s; tput cuu1; tput dl1;;
+    12)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite invalido utilize numeros")"; sleep 2s; tput cuu1; tput dl1;;
+    13)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite maximo de 999")"; sleep 2s; tput cuu1; tput dl1;;
+    14)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Usuario Ya Existe")"; sleep 2s; tput cuu1; tput dl1;;
+  esac
+}
+
+# Open VPN
+newclient(){
+  #Nome #Senha
+  #usermod -p $(openssl passwd -1 $2) $1
+  while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
+    msg -bar
+    read -p "Crear Archivo OpenVPN? [S/N]: " -e -i S newfile
+    tput cuu1 && tput dl1
+  done
+
+  if [[ ${newfile} = @(s|S) ]]; then
+    #Generates the custom client.ovpn
+    rm -rf /etc/openvpn/easy-rsa/pki/reqs/$1.req
+    rm -rf /etc/openvpn/easy-rsa/pki/issued/$1.crt
+    rm -rf /etc/openvpn/easy-rsa/pki/private/$1.key
+    cd /etc/openvpn/easy-rsa/
+    ./easyrsa build-client-full $1 nopass > /dev/null 2>&1
+    cd
+
+    cp /etc/openvpn/client-common.txt ~/$1.ovpn
+    echo "<ca>" >> ~/$1.ovpn
+    cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn
+    echo "</ca>" >> ~/$1.ovpn
+    echo "<cert>" >> ~/$1.ovpn
+    cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn
+    echo "</cert>" >> ~/$1.ovpn
+    echo "<key>" >> ~/$1.ovpn
+    cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn
+    echo "</key>" >> ~/$1.ovpn
+    echo "<tls-auth>" >> ~/$1.ovpn
+    cat /etc/openvpn/ta.key >> ~/$1.ovpn
+    echo "</tls-auth>" >> ~/$1.ovpn
+
+    while [[ ${ovpnauth} != @(s|S|y|Y|n|N) ]]; do
+      read -p "$(fun_trans "Colocar autenticacion de usuario en el archivo")? [S/N]: " -e -i S ovpnauth
+      tput cuu1 && tput dl1
+    done
+    [[ ${ovpnauth} = @(s|S) ]] && sed -i "s;auth-user-pass;<auth-user-pass>\n$1\n$2\n</auth-user-pass>;g" ~/$1.ovpn
+    cd $HOME
+    zip ./$1.zip ./$1.ovpn > /dev/null 2>&1
+    rm ./$1.ovpn > /dev/null 2>&1
+
+    echo -e "\033[1;31m$(fun_trans "Archivo creado"): ($HOME/$1.zip)"
+ fi
+}
+
+
+data_user(){
+	cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog')
+	[[ -z "$(echo "${cat_users}"|awk -F ':' '{print $5}'|cut -d ',' -f1|grep -v 'hwid'|grep -v 'token'|head -1)" ]] && print_center -verm2 "NO HAY USUARIOS SSH REGISTRADOS" && return 1
+	dat_us=$(printf '%-13s%-14s%-10s%-4s%-6s%s' 'Usuario' 'Contraseña' 'Fecha' 'Dia' 'Limit' 'Statu')
+	msg -azu "  $dat_us"
+	msg -bar
+
+	i=1
+	for u in `echo "${cat_users}"|awk -F ':' '{print $1}'`; do
+
+		fix_hwid_token=$(echo "${cat_users}"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f1) && [[ "${fix_hwid_token}" = @(hwid|token) ]] && continue
+
+		fecha=$(chage -l "$u"|sed -n '4p'|awk -F ': ' '{print $2}')
+
+		mes_dia=$(echo $fecha|awk -F ',' '{print $1}'|sed 's/ //g')
+		ano=$(echo $fecha|awk -F ', ' '{printf $2}'|cut -c 3-)
+		us=$(printf '%-12s' "$u")
+
+		pass=$(cat "/etc/passwd"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+		[[ "${#pass}" -gt '12' ]] && pass="Desconosida"
+		pass="$(printf '%-12s' "$pass")"
+
+		unset stat
+		if [[ $(passwd --status $u|cut -d ' ' -f2) = "P" ]]; then
+			stat="$(msg -verd "ULK")"
+		else
+			stat="$(msg -verm2 "LOK")"
+		fi
+
+		Limit=$(cat "/etc/passwd"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f1)
+		[[ "${#Limit}" = "1" ]] && Limit=$(printf '%2s%-4s' "$Limit") || Limit=$(printf '%-6s' "$Limit")
+
+		echo -ne "$(msg -verd "$i")$(msg -verm2 "-")$(msg -azu "${us}") $(msg -azu "${pass}")"
+		if [[ $(echo $fecha|awk '{print $2}') = "" ]]; then
+			exp="$(printf '%8s%-2s' '[X]')"
+			exp+="$(printf '%-6s' '[X]')"
+			echo " $(msg -verm2 "$fecha")$(msg -verd "$exp")$(echo -e "$stat")"	
+		else
+			if [[ $(date +%s) -gt $(date '+%s' -d "${fecha}") ]]; then
+				exp="$(printf '%-5s' "Exp")"
+				echo " $(msg -verm2 "$mes_dia/$ano")  $(msg -verm2 "$exp")$(msg -ama "$Limit")$(echo -e "$stat")"
+			else
+				EXPTIME="$(($(($(date '+%s' -d "${fecha}") - $(date +%s))) / 86400))"
+				[[ "${#EXPTIME}" = "1" ]] && exp="$(printf '%2s%-3s' "$EXPTIME")" || exp="$(printf '%-5s' "$EXPTIME")"
+				echo " $(msg -verm2 "$mes_dia/$ano")  $(msg -verd "$exp")$(msg -ama "$Limit")$(echo -e "$stat")"
+			fi
+		fi
+
+
+		let i++
+	done
+
+}
+
+#======CREAR NUEVO USUARIO===========
+#useradd -M -s /bin/false -e 2021-10-16 -K PASS_MAX_DAYS=1 ruso99
+add_user(){
+  Fecha=`date +%d-%m-%y-%R`
+  [[ $(cat /etc/passwd |grep $1: |grep -vi [a-z]$1 |grep -v [0-9]$1 > /dev/null) ]] && return 1
+  valid=$(date '+%C%y-%m-%d' -d " +$3 days")
+  clear
+  msg -bar
+
+  system=$(cat -n /etc/issue |grep 1 |cut -d ' ' -f6,7,8 |sed 's/1//' |sed 's/      //')
+  distro=$(echo "$system"|awk '{print $1}')
+  vercion=$(echo $system|awk '{print $2}'|cut -d '.' -f1)
+
+  if [[ ${distro} = @(Ubuntu|Debian) ]]; then
+    if [[ ${vercion} = "16" ]]; then
+      pass=$(openssl passwd -1 $2)
+    else
+      pass=$(openssl passwd -6 $2)
+    fi
+  fi
+
+  if useradd -M -s /bin/false -e ${valid} -K PASS_MAX_DAYS=$3 -p ${pass} -c $4,$2 $1 ; then
+
+    if [[ $5 = @(s|S) ]]; then
+      rm -rf /etc/openvpn/easy-rsa/pki/reqs/$1.req
+      rm -rf /etc/openvpn/easy-rsa/pki/issued/$1.crt
+      rm -rf /etc/openvpn/easy-rsa/pki/private/$1.key
+      cd /etc/openvpn/easy-rsa/
+      ./easyrsa build-client-full $1 nopass > /dev/null 2>&1
+      cd
+      cp /etc/openvpn/client-common.txt ~/$1.ovpn
+      echo "<ca>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn
+      echo "</ca>" >> ~/$1.ovpn
+      echo "<cert>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn
+      echo "</cert>" >> ~/$1.ovpn
+      echo "<key>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn
+      echo "</key>" >> ~/$1.ovpn
+      echo "<tls-auth>" >> ~/$1.ovpn
+      cat /etc/openvpn/ta.key >> ~/$1.ovpn
+      echo "</tls-auth>" >> ~/$1.ovpn
+
+      [[ $6 = @(s|S) ]] && sed -i "s;auth-user-pass;<auth-user-pass>\n$1\n$2\n</auth-user-pass>;g" ~/$1.ovpn
+      cd $HOME
+      zip ./$1.zip ./$1.ovpn > /dev/null 2>&1
+      rm ./$1.ovpn > /dev/null 2>&1
+
+      zip_ovpn="$HOME/$1.zip"
+
+    fi
+
+  	print_center -verd "$(fun_trans "Usuario Creado con Exito")"
+  else
+  	print_center -verm2 "$(fun_trans "Error, Usuario no creado")"
+  	msg -bar
+  	sleep 3
+  	return
+  fi
+  msg -bar
+}
+
+mostrar_usuarios(){
+  for u in `cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -v 'hwid'|grep -v 'token'|awk -F ':' '{print $1}'`; do
+    echo "$u"
+  done
+}
+
+new_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "CREAR USUARIOS")"
+  msg -bar
+  data_user
+  back
+
+  while true; do
+    msg -ne "$(fun_trans "Nombre Del Nuevo Usuario"): "
+    read nomeuser
+    nomeuser="$(echo $nomeuser|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    nomeuser="$(echo $nomeuser|sed -e 's/[^a-z0-9 -]//ig')"
+    if [[ -z $nomeuser ]]; then
+      err_fun 1 && continue
+    elif [[ "${nomeuser}" = "0" ]]; then
+      return
+    elif [[ "${#nomeuser}" -lt "4" ]]; then
+      err_fun 2 && continue
+    elif [[ "${#nomeuser}" -gt "12" ]]; then
+      err_fun 3 && continue
+    elif [[ "$(echo ${usuarios_ativos[@]}|grep -w "$nomeuser")" ]]; then
+      err_fun 14 && continue
+    fi
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "Contraseña Del Nuevo Usuario")"
+    read -p ": " senhauser
+    senhauser="$(echo $senhauser|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    if [[ -z $senhauser ]]; then
+      err_fun 4 && continue
+    elif [[ "${#senhauser}" -lt "4" ]]; then
+      err_fun 5 && continue
+    elif [[ "${#senhauser}" -gt "12" ]]; then
+      err_fun 6 && continue
+    fi
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "Tiempo de Duracion del Nuevo Usuario")"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      err_fun 9 && continue
+    fi 
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "Limite de Conexion del Nuevo Usuario")"
+    read -p ": " limiteuser
+    if [[ -z "$limiteuser" ]]; then
+      err_fun 11 && continue
+    elif [[ "$limiteuser" != +([0-9]) ]]; then
+      err_fun 12 && continue
+    elif [[ "$limiteuser" -gt "999" ]]; then
+      err_fun 13 && continue
+    fi
+    break
+  done
+
+  [[ $(dpkg --get-selections|grep -w "openvpn"|head -1) ]] && [[ -e /etc/openvpn/openvpn-status.log ]] && {
+
+    while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
+      msg -ne "$(fun_trans "Crear Archivo") OpenVPN? [S/N]: "
+      read -e -i S newfile
+    done
+
+    if [[ ${newfile} = @(s|S) ]]; then
+      while [[ ${ovpnauth} != @(s|S|y|Y|n|N) ]]; do
+        msg -ne "$(fun_trans "Autenticacion de usuario en el archivo")? [S/N]: "
+        read -e -i S ovpnauth
+      done
+    fi
+  }
+
+  add_user "${nomeuser}" "${senhauser}" "${diasuser}" "${limiteuser}" "${newfile}" "${ovpnauth}"
+  echo "${nomeuser}|${senhauser}" >> ${ADM_user}/passwd
+  #[[ $(dpkg --get-selections|grep -w "openvpn"|head -1) ]] && [[ -e /etc/openvpn/openvpn-status.log ]] && newclient "$nomeuser" "$senhauser"
+  msg -ne " $(fun_trans "IP del Servidor"): " && msg -ama "    $(fun_ip)"
+  msg -ne " $(fun_trans "Usuario"): " && msg -ama "            $nomeuser"
+  msg -ne " $(fun_trans "Contraseña"): " && msg -ama "         $senhauser"
+  msg -ne " $(fun_trans "Dias de Duracion"): " && msg -ama "   $diasuser"
+  msg -ne " $(fun_trans "Limite de Conexion"): " && msg -ama " $limiteuser"
+  msg -ne " $(fun_trans "Fecha de Expiracion"): " && msg -ama "$(date "+%F" -d " + $diasuser days")"
+  [[ ! -z "$zip_ovpn" ]] && msg -ne " $(fun_trans "Archivo OVPN"): " && msg -ama "       $zip_ovpn"
+  msg -bar
+  print_center -ama "►► Presione enter para continuar ◄◄"
+  read
+  return 1
+}
+#===================================
+
+#======CREAR USUARIO TEMPORAL======
+
+mktmpuser(){
+	while [[ -z $name ]]; do
+		msg -ne " Nombre del usuario: "
+		read name
+		if [[ -z $name ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva un nombre de usuario"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset name
+			continue
+		fi
+	done
+
+	if cat /etc/passwd |grep $name: |grep -vi [a-z]$name |grep -v [0-9]$name > /dev/null ; then
+		tput cuu1 && tput dl1
+		msg -verm2 " El usuario $name ya existe"
+		sleep 2
+		tput cuu1 && tput dl1
+		return
+	fi
+
+	while [[ -z $pass ]]; do
+		msg -ne " Contraseña: "
+		read pass
+		if [[ -z $pass ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva una Contraseña"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset pass
+			continue
+		fi
+	done
+
+	while [[ -z $tmp ]]; do
+		msg -ne " Duracion en minutos: "
+		read tmp
+		if [[ -z $tmp ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva un tiempo de duracion"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset tmp
+			continue
+		fi
+	done
+
+	if [[ -z $1 ]]; then
+		msg -ne " Aplicar a conf Default [S/N]: "
+		read def
+		if [[ ! "$def" != @(s|S|y|Y) ]]; then
+			echo -e "usuario=$name
+Contraseña=$pass
+Tiempo=$tmp" > ${Default}
+		fi
+	fi
+
+	useradd -M -s /bin/false -p $(openssl passwd -6 $pass) $name
+	#(echo $pass; echo $pass)|passwd $name 2>/dev/null
+	touch /tmp/$name
+
+	timer=$(( $tmp * 60 ))
+	timer2="'$timer's"
+	echo "#!/bin/bash
+sleep $timer2
+kill"' $(ps -u '"$name |awk '{print"' $tmp'"}') 1> /dev/null 2> /dev/null
+userdel --force $name
+rm -rf /tmp/$name
+exit" > /tmp/$name
+
+	chmod 777 /tmp/$name
+	touch /tmp/cmd
+	chmod 777 /tmp/cmd
+	echo "nohup /tmp/$name & >/dev/null" > /tmp/cmd
+	/tmp/cmd 2>/dev/null 1>/dev/null
+	rm -rf /tmp/cmd
+
+	title "USUARIO TEMPORAL CREADO"
+	echo -e " $(msg -verm2 "IP:        ") $(msg -ama "$(fun_ip)")"
+	echo -e " $(msg -verm2 "Usuario:   ") $(msg -ama "$name")"
+	echo -e " $(msg -verm2 "Contraseña:") $(msg -ama "$pass")"
+	echo -e " $(msg -verm2 "Duracion:  ") $(msg -ama "$tmp minutos")"
+	msg -bar
+	read foo
+	return
+}
+
+userTMP(){
+	tmp_f="${ADM_user}/userTMP" && [[ ! -d ${tmp_f} ]] && mkdir ${tmp_f}
+	Default="${tmp_f}/Default"
+	if [[ ! -e ${Default} ]]; then
+		echo -e "usuario=ADMRufu
+Contraseña=ADMRufu
+Tiempo=15" > ${Default}
+	fi
+
+	name="$(cat ${Default}|grep "usuario"|cut -d "=" -f2)"
+	pass="$(cat ${Default}|grep "Contraseña"|cut -d "=" -f2)"
+	tmp="$(cat ${Default}|grep "Tiempo"|cut -d "=" -f2)"
+
+	title "CONF DE USUARIO TEMPORAL"
+	print_center -teal "Usuario Default"
+	msg -bar3
+	echo -e " $(msg -verm2 "IP:        ") $(msg -ama "$(fun_ip)")"
+	echo -e " $(msg -verm2 "Usuario:   ") $(msg -ama "$name")"
+	echo -e " $(msg -verm2 "Contraseña:") $(msg -ama "$pass")"
+	echo -e " $(msg -verm2 "Duracion:  ") $(msg -ama "$tmp minutos")"
+	msg -bar
+	menu_func "APLICAR CONF DEFAULT" "CONF PERSONALIZADA"
+	back
+	opcion=$(selection_fun 2)
+	case $opcion in
+		1)mktmpuser "def";;
+		2)unset name
+		  unset pass
+		  unset tmp
+		  mktmpuser;;
+		0)return;;
+	esac
+}
+#===========================================
+
+#=====REMOVER USUARIO=======================
+rm_user(){
+  #nome
+  if userdel --force "$1" ; then
+    sed -i "/$1/d" ${ADM_user}/passwd
+  	print_center -verd "[$(fun_trans "Removido")]"
+  else
+  	print_center -verm "[$(fun_trans "No Removido")]"
+  fi
+}
+
+remove_user(){
+	clear
+	usuarios_ativos=('' $(mostrar_usuarios))
+	msg -bar
+	print_center -ama "$(fun_trans "REMOVER USUARIOS")"
+	msg -bar
+	data_user
+	back
+
+	print_center -ama "$(fun_trans "Escriba o Seleccione un Usuario")"
+	msg -bar
+	unset selection
+	while [[ -z ${selection} ]]; do
+		msg -nazu "$(fun_trans "Seleccione Una Opcion"): " && read selection
+		tput cuu1 && tput dl1
+	done
+	[[ ${selection} = "0" ]] && return
+	if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+		usuario_del="${usuarios_ativos[$selection]}"
+	else
+		usuario_del="$selection"
+	fi
+	[[ -z $usuario_del ]] && {
+		msg -verm "$(fun_trans "Error, Usuario Invalido")"
+		msg -bar
+		return 1
+	}
+	[[ ! $(echo ${usuarios_ativos[@]}|grep -w "$usuario_del") ]] && {
+		msg -verm "$(fun_trans "Error, Usuario Invalido")"
+		msg -bar
+		return 1
+	}
+
+	print_center -ama "$(fun_trans "Usuario Seleccionado"): $usuario_del"
+	pkill -u $usuario_del
+	droplim=`droppids|grep -w "$usuario_del"|awk '{print $2}'` 
+	kill -9 $droplim &>/dev/null
+	rm_user "$usuario_del"
+	msg -bar
+	sleep 3
+}
+
+#========RENOVAR USUARIOS==========
+
+renew_user_fun(){
+  #nome dias
+  datexp=$(date "+%F" -d " + $2 days") && valid=$(date '+%C%y-%m-%d' -d " + $2 days")
+  if chage -E $valid $1 ; then
+  	print_center -ama "$(fun_trans "Usuario Renovado Con Exito")"
+  else
+  	print_center -verm "$(fun_trans "Error, Usuario no Renovado")"
+  fi
+}
+
+renew_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "RENOVAR USUARIOS")"
+  msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o seleccione un Usuario")"
+  msg -bar
+  unset selection
+  while [[ -z ${selection} ]]; do
+    msg -nazu "$(fun_trans " Seleccione una Opcion"): " && read selection
+    tput cuu1 && tput dl1
+  done
+
+  [[ ${selection} = "0" ]] && return
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    useredit="${usuarios_ativos[$selection]}"
+  else
+    useredit="$selection"
+  fi
+
+  [[ -z $useredit ]] && {
+    msg -verm "$(fun_trans "Error, Usuario Invalido")"
+    msg -bar
+    sleep 3
+    return 1
+  }
+
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$useredit") ]] && {
+    msg -verm "$(fun_trans "Error, Usuario Invalido")"
+    msg -bar
+    sleep 3
+    return 1
+  }
+
+  while true; do
+    msg -ne "$(fun_trans "Nuevo Tiempo de Duracion de"): $useredit"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      echo -e '\n\n\n'
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      echo -e '\n\n\n'
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      echo -e '\n\n\n'
+      err_fun 9 && continue
+    fi
+    break
+  done
+  msg -bar
+  renew_user_fun "${useredit}" "${diasuser}"
+  msg -bar
+  sleep 3
+}
+
+edit_user_fun(){
+  datexp=$(date "+%F" -d " + $3 days") && valid=$(date '+%C%y-%m-%d' -d " + $3 days")
+  clear
+  msg -bar
+  if usermod -p $(openssl passwd -6 $2) -e $valid -c $4,$2 $1 ; then
+  	print_center -verd "Usuario Modificado Con Exito"
+  else
+  	print_center -verm2 "Error, Usuario no Modificado"
+  	msg -bar
+  	sleep 3
+  	return
+  fi
+  msg -bar
+}
+
+edit_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "EDITAR USUARIOS")"
+  msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o seleccione un Usuario")"
+  msg -bar
+  unset selection
+  while [[ -z ${selection} ]]; do
+    msg -nazu "$(fun_trans " Seleccione una Opcion"): " && read selection
+    tput cuu1; tput dl1
+  done
+  [[ ${selection} = "0" ]] && return
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    useredit="${usuarios_ativos[$selection]}"
+  else
+    useredit="$selection"
+  fi
+  [[ -z $useredit ]] && {
+    msg -verm "$(fun_trans "Error, Usuario Invalido")"
+    msg -bar
+    return 1
+  }
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$useredit") ]] && {
+    msg -verm "$(fun_trans "Error, Usuario Invalido")"
+    msg -bar
+    return 1
+  }
+  while true; do
+    msg -ne "$(fun_trans "Usuario Seleccionado"): " && echo -e "$useredit"
+    msg -ne "$(fun_trans "Nueva Contraseña de") $useredit"
+    read -p ": " senhauser
+    if [[ -z "$senhauser" ]]; then
+      err_fun 4 && continue
+    elif [[ "${#senhauser}" -lt "4" ]]; then
+      err_fun 5 && continue
+    elif [[ "${#senhauser}" -gt "12" ]]; then
+      err_fun 6 && continue
+    fi
+    break
+  done
+  while true; do
+    msg -ne "$(fun_trans "Dias de Duracion de"): $useredit"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      err_fun 9 && continue
+    fi
+    break
+  done
+  while true; do
+    msg -ne "$(fun_trans "Nuevo Limite de Conexion de"): $useredit"
+    read -p ": " limiteuser
+    if [[ -z "$limiteuser" ]]; then
+      err_fun 11 && continue
+    elif [[ "$limiteuser" != +([0-9]) ]]; then
+      err_fun 12 && continue
+    elif [[ "$limiteuser" -gt "999" ]]; then
+      err_fun 13 && continue
+    fi
+    break
+  done
+
+  edit_user_fun "${useredit}" "${senhauser}" "${diasuser}" "${limiteuser}"
+  
+  msg -ne " $(fun_trans "IP del Servidor"): " && msg -ama "    $(fun_ip)"
+  msg -ne " $(fun_trans "Usuario"): " && msg -ama "            $useredit"
+  msg -ne " $(fun_trans "Contraseña"): " && msg -ama "         $senhauser"
+  msg -ne " $(fun_trans "Dias de Duracion"): " && msg -ama "   $diasuser"
+  msg -ne " $(fun_trans "Limite de Conexion"): " && msg -ama " $limiteuser"
+  msg -ne " $(fun_trans "Fecha de Expiracion"): " && msg -ama "$(date "+%F" -d " + $diasuser days")"
+  msg -bar
+  print_center -ama "►► Presione enter para continuar ◄◄"
+  read
+  return
+}
+
+eliminar_all(){
+  title "ELIMINAR TODOS LOS USUARIOS"
+  msg -ne " [S/N]: "
+  read opcion
+  [[ "${opcion}" != @(S|s) ]] && return 1
+  service dropbear stop &>/dev/null
+  service sshd stop &>/dev/null
+  service ssh stop &>/dev/null
+  service stunnel4 stop &>/dev/null
+  service squid stop &>/dev/null
+
+  cat_users=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -v "hwid"|grep -v "token")
+
+  for user in `echo "$cat_users"|awk -F ':' '{print $1}'`; do
+    userpid=$(ps -u $user |awk {'print $1'})
+    kill "$userpid" 2>/dev/null
+    userdel --force $user
+    user2=$(printf '%-15s' "$user")
+    echo -e " $(msg -azu "USUARIO:") $(msg -ama "$user2")$(msg -verm2 "Eliminado")"
+  done
+  service sshd restart &>/dev/null
+  service ssh restart &>/dev/null
+  service dropbear start &>/dev/null
+  service stunnel4 start &>/dev/null
+  service squid restart &>/dev/null
+  msg -bar
+  print_center -ama "USUARIOS ELIMINANDOS"
+  enter
+  return 1
+}
+
+sshmonitor(){
+	clear
+	cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog')
+	cab=$(printf '%-15s%-13s%-15s%-9s' 'USUARIO' 'STATUS' 'CONEXIONES' 'TIEMPO')
+	msg -bar 
+	echo -e "\E[41;1;37m $cab\E[0m"
+	msg -bar
+    for i in `echo "$cat_users"|awk -F ':' '{print $1}'`; do
+        user="$i"
+        s2ssh="$(echo "$cat_users"|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f1)"
+
+        if [[ "$(echo "$cat_users"| grep -w $i| wc -l)" = "1" ]]; then
+          sqd="$(ps -u $user | grep sshd | wc -l)"
+        else
+          sqd=00
+        fi
+
+        [[ "$sqd" = "" ]] && sqd=0
+        if [[ -e /etc/openvpn/openvpn-status.log ]]; then
+          ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$i", | wc -l)"
+        else
+          ovp=0
+        fi
+
+        if netstat -nltp|grep 'dropbear'> /dev/null;then
+          drop="$(droppids | grep "$i" | wc -l)"
+        else
+          drop=0
+        fi
+        
+        cnx=$(($sqd + $drop))
+        conex=$(($cnx + $ovp))
+        if [[ $cnx -gt 0 ]]; then
+          tst="$(ps -o etime $(ps -u $i |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')"
+          tst1=$(echo "$tst" | wc -c)
+        if [[ "$tst1" == "9" ]]; then 
+          timerr="$(ps -o etime $(ps -u $i |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')"
+        else
+          timerr="$(echo "00:$tst")"
+        fi
+        elif [[ $ovp -gt 0 ]]; then
+          tmp2=$(printf '%(%H:%M:%S)T\n')
+          tmp1="$(grep -w "$i" /etc/openvpn/openvpn-status.log |awk '{print $4}'| head -1)"
+          [[ "$tmp1" = "" ]] && tmp1="00:00:00" && tmp2="00:00:00"
+          var1=`echo $tmp1 | cut -c 1-2`
+          var2=`echo $tmp1 | cut -c 4-5`
+          var3=`echo $tmp1 | cut -c 7-8`
+          var4=`echo $tmp2 | cut -c 1-2`
+          var5=`echo $tmp2 | cut -c 4-5`
+          var6=`echo $tmp2 | cut -c 7-8`
+          calc1=`echo $var1*3600 + $var2*60 + $var3 | bc`
+          calc2=`echo $var4*3600 + $var5*60 + $var6 | bc`
+          seg=$(($calc2 - $calc1))
+          min=$(($seg/60))
+          seg=$(($seg-$min*60))
+          hor=$(($min/60))
+          min=$(($min-$hor*60))
+          timerusr=`printf "%02d:%02d:%02d \n" $hor $min $seg;`
+          timerr=$(echo "$timerusr" | sed -e 's/[^0-9:]//ig' )
+        else
+          timerr="00:00:00"
+        fi
+
+        if [[ "$s2ssh" != @(hwid|token) ]]; then
+          user=$(printf '%-15s' "$i")
+          con=$(printf '%-11s' "$conex/$s2ssh")
+        else
+          fix="$(echo "$cat_users"|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f2)"
+          user=$(printf '%-15s' "$fix")
+          con=$(printf '%-11s' "$(echo $s2ssh|awk '{print toupper($0)}')")
+        fi
+
+        if [[ $conex -eq 0 ]]; then
+           status=$(printf '%-16s' 'Offline')
+           echo -e " $(msg -ama "$user")$(msg -verm2 "$status")$(msg -verd "$con")$(msg -ama "$timerr")"
+        else
+           status=$(printf '%-16s' 'Online')
+           echo -e " $(msg -ama "$user")$(msg -verd "$status")$(msg -verd "$con")$(msg -ama "$timerr")"
+        fi
+        msg -bar3
+      done
+    tput cuu1 && tput dl1
+    msg -bar
+    print_center -ama "►► Presione enter para continuar ◄◄"
+    read
+}
+
+detail_user(){
+	clear
+	usuarios_ativos=('' $(mostrar_usuarios))
+	if [[ -z ${usuarios_ativos[@]} ]]; then
+		msg -bar
+		print_center -verm2 "$(fun_trans "Ningun usuario registrado")"
+		msg -bar
+		sleep 3
+		return
+	else
+		msg -bar
+		print_center -ama "$(fun_trans "DETALLES DEL LOS USUARIOS")"
+		msg -bar
+	fi
+	data_user
+	msg -bar
+	print_center -ama "►► Presione enter para continuar ◄◄"
+	read
+}
+
+block_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "BLOQUEAR/DESBLOQUEAR USUARIOS")"
+  msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o Seleccione Un Usuario")"
+  msg -bar
+  unset selection
+  while [[ ${selection} = "" ]]; do
+    echo -ne "\033[1;37m Seleccione: " && read selection
+    tput cuu1 && tput dl1
+  done
+  [[ ${selection} = "0" ]] && return
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    usuario_del="${usuarios_ativos[$selection]}"
+  else
+    usuario_del="$selection"
+  fi
+  [[ -z $usuario_del ]] && {
+    msg -verm "$(fun_trans "Error, Usuario Invalido")"
+    msg -bar
+    return 1
+  }
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$usuario_del") ]] && {
+    msg -verm "$(fun_trans "Error, Usuario Invalido")"
+    msg -bar
+    return 1
+  }
+
+  msg -nama "   $(fun_trans "Usuario"): $usuario_del >>>> "
+
+  if [[ $(passwd --status $usuario_del|cut -d ' ' -f2) = "P" ]]; then
+    pkill -u $usuario_del &>/dev/null
+    droplim=`droppids|grep -w "$usuario_del"|awk '{print $2}'` 
+    kill -9 $droplim &>/dev/null
+    usermod -L $usuario_del &>/dev/null
+    sleep 2
+    msg -verm2 "$(fun_trans "Bloqueado")"
+  else
+  	usermod -U $usuario_del
+  	sleep 2
+  	msg -verd "$(fun_trans "Desbloqueado")"
+  fi
+  msg -bar
+  sleep 3
+}
+
+rm_vencidos(){
+	title "REMOVER USUARIOS VENCIDOS"
+	print_center -ama " Removera todo los usuarios ssh expirado"
+	msg -bar
+	msg -ne " Continua [S/N]: "
+	read opcion
+	tput cuu1 && tput dl1
+	[[ "$opcion" != @(s|S|y|Y) ]] && return
+
+	expired="$(fun_trans "Expirado")"
+	removido="$(fun_trans "Removido")"
+	DataVPS=$(date +%s)
+
+	while read user; do
+		DataUser=$(chage -l "$user"|sed -n '4p'|awk -F ': ' '{print $2}')
+		[[ "$DataUser" = @(never|nunca) ]] && continue
+		#[[ "$DataUser" = "ene 01, 1970" ]] && DataUser="Jan 01, 1970"
+		DataSEC=$(date +%s --date="$DataUser")
+
+		if [[ "$DataSEC" -lt "$DataVPS" ]]; then
+			pkill -u $user
+			droplim=`droppids|grep -w "$user"|awk '{print $2}'` 
+			kill -9 $droplim &>/dev/null
+			userdel $user
+			print_center -ama "$user $expired ($removido)"
+			sleep 1
+		fi
+	done <<< "$(mostrar_usuarios)"
+	enter
+}
+
+limiter(){
+
+	ltr(){
+		clear
+		msg -bar
+		for i in `atq|awk '{print $1}'`; do
+			if [[ ! $(at -c $i|grep 'limitador.sh') = "" ]]; then
+				atrm $i
+				sed -i '/limitador.sh/d' /var/spool/cron/crontabs/root
+				print_center -verd "limitador detenido"
+				msg -bar
+				print_center -ama "►► Presione enter para continuar ◄◄"
+				read
+				return
+			fi
+		done
+    print_center -ama "CONF LIMITADOR"
+    msg -bar
+    print_center -ama "Bloquea usuarios cuando exeden"
+    print_center -ama "el numero maximo conecciones"
+    msg -bar
+    unset opcion
+    while [[ -z $opcion ]]; do
+      msg -nama " Ejecutar limitdor cada: "
+      read opcion
+      if [[ ! $opcion =~ $numero ]]; then
+        tput cuu1 && tput dl1
+        print_center -verm2 " Solo se admiten nuemros"
+        sleep 2
+        tput cuu1 && tput dl1
+        unset opcion && continue
+      elif [[ $opcion -le 0 ]]; then
+        tput cuu1 && tput dl1
+        print_center -verm2 " tiempo minimo 1 minuto"
+        sleep 2
+        tput cuu1 && tput dl1
+        unset opcion && continue
+      fi
+      tput cuu1 && tput dl1
+      echo -e "$(msg -nama " Ejecutar limitdor cada:") $(msg -verd "$opcion minutos")"
+      echo "$opcion" > ${ADM_user}/limit
+    done
+
+    msg -bar
+    print_center -ama "Los usuarios bloqueados por el limitador"
+    print_center -ama "seran desbloqueado automaticamente"
+    print_center -ama "(ingresa 0 para desbloqueo manual)"
+    msg -bar
+
+    unset opcion
+    while [[ -z $opcion ]]; do
+      msg -nama " Desbloquear user cada: "
+      read opcion
+      if [[ ! $opcion =~ $numero ]]; then
+        tput cuu1 && tput dl1
+        print_center -verm2 " Solo se admiten nuemros"
+        sleep 2
+        tput cuu1 && tput dl1
+        unset opcion && continue
+      fi
+      tput cuu1 && tput dl1
+      [[ $opcion -le 0 ]] && echo -e "$(msg -nama " Desbloqueo:") $(msg -verd "manual")" || echo -e "$(msg -nama " Desbloquear user cada:") $(msg -verd "$opcion minutos")"
+      echo "$opcion" > ${ADM_user}/unlimit
+    done
+		nohup ${ADM_inst}/limitador.sh &>/dev/null &
+    msg -bar
+		print_center -verd "limitador en ejecucion"
+		msg -bar
+		print_center -ama "►► Presione enter para continuar ◄◄"
+		read		
+	}
+
+	l_exp(){
+		clear
+    	msg -bar
+    	l_cron=$(cat /var/spool/cron/crontabs/root|grep -w 'limitador.sh'|grep -w 'ssh')
+    	if [[ -z "$l_cron" ]]; then
+      		echo '@daily /etc/ADMRufu/install/limitador.sh --ssh' >> /var/spool/cron/crontabs/root
+      		print_center -verd "limitador de expirados programado\nse ejecutara todos los dias a las 00hs\nsegun la hora programada en el servidor"
+      		enter
+      		return
+    	else
+      		sed -i '/limitador.sh --ssh/d' /var/spool/cron/crontabs/root
+      		print_center -verm2 "limitador de expirados detenido"
+      		enter
+      		return   
+    	fi
+	}
+
+	log(){
+		clear
+		msg -bar
+		print_center -ama "REGISTRO DEL LIMITADOR"
+		msg -bar
+		[[ ! -e ${ADM_user}/limit.log ]] && touch ${ADM_user}/limit.log
+		if [[ -z $(cat ${ADM_user}/limit.log) ]]; then
+			print_center -ama "no ahy registro de limitador"
+			msg -bar
+			sleep 2
+			return
+		fi
+		msg -teal "$(cat ${ADM_user}/limit.log)"
+		msg -bar
+		print_center -ama "►► Presione enter para continuar o ◄◄"
+		print_center -ama "►► 0 para limpiar registro ◄◄"
+		read opcion
+		[[ $opcion = "0" ]] && echo "" > ${ADM_user}/limit.log
+	}
+
+	[[ $(cat /var/spool/cron/crontabs/root|grep -w 'limitador.sh'|grep -w 'ssh') ]] && lim_e=$(msg -verd "[ON]") || lim_e=$(msg -verm2 "[OFF]")
+
+	clear
+	msg -bar
+	print_center -ama "LIMITADOR DE CUENTAS"
+	msg -bar
+	menu_func "LIMTADOR DE CONECCIONES" "LIMITADOR DE EXPIRADOS $lim_e" "LIMITADOR DE DATOS $(msg -verm2 "(no diponible)")" "LOG DEL LIMITADOR"
+	back
+	msg -ne " opcion: "
+	read opcion
+	case $opcion in
+		1)ltr;;
+		2)l_exp;;
+		3);;
+		4)log;;
+		0)return;;
+	esac
+}
+
+USER_MODE(){
+	title "SELECCIONE EL MODO QUE USARA POR DEFECTO"
+	menu_func "HWID" "TOKEN"
+	back
+	opcion=$(selection_fun 2)
+	case $opcion in
+		1) echo "userHWID" > ${ADM_user}/userMODE
+		   clear
+		   msg -bar
+		   print_center -verd "MODO HWID ACTIVA"
+		   enter;;
+		2) echo "userTOKEN" > ${ADM_user}/userMODE
+		   clear
+		   msg -bar
+		   print_center -verd "MODO TOKEN ACTIVA"
+		   enter;;
+		0)return 1;;
+	esac
+}
+
+while :
+do
+	lim=$(msg -verm2 "[OFF]")
+	for i in `atq|awk '{print $1}'`; do
+		if [[ ! $(at -c $i|grep 'limitador.sh') = "" ]]; then
+			lim=$(msg -verd "[ON]")
+		fi
+	done
+
+	title -ama "ADMINISTRACION DE USUARIOS SSH"
+
+	menu_func "NUEVO USUARIO SSH ✏️ " \
+"CREAR USUARIO TEMPORAL✏️." \
+"$(msg -verm2 "REMOVER USUARIO") 🗑 " \
+"$(msg -verd "RENOVAR USUARIO") ♻️" \
+"EDITAR USUARIO 📝" \
+"BLOQ/DESBLOQ USUARIO 🔒\n$(msg -bar3)" \
+"$(msg -verd "DETALLES DE TODOS USUARIOS") 🔎" \
+"MONITOR DE USUARIOS CONECTADOS" \
+"🔒 $(msg -ama "LIMITADOR-DE-CUENTAS") 🔒 $lim\n$(msg -bar3)" \
+"ELIMINAR USUARIOS VENCIDOS" \
+"⚠️ $(msg -verm2 "ELIMINAR TODOS LOS USUARIOS") ⚠️\n$(msg -bar3)" \
+"BACKUP USUARIOS" \
+"-bar DESACTIVAR PASS ALFANUMERICO $(msg -blu "(VULTR)")" \
+"CAMBIAR A MODO HWID/TOKEN"
+
+	back
+	selection=$(selection_fun 14)
+	case ${selection} in
+		0)break;;
+		1)new_user;;
+		2)userTMP;;
+		3)remove_user;;
+		4)renew_user;;
+		5)edit_user;;
+		6)block_user;;
+		7)detail_user;;
+		8)sshmonitor;;
+		9)limiter;;
+		10)rm_vencidos;;
+		11)eliminar_all;;
+		12)backup;;
+		13)ULK_ALF;;
+		14)USER_MODE && break;;
+	esac
+done

+ 880 - 0
R9/ADMRufu-31/install/userTOKEN

@@ -0,0 +1,880 @@
+#!/bin/bash
+
+USRdatabase="${ADM_user}/ADMuser"
+[[ ! -d ${ADM_user}/B-ADMuser ]] && mkdir ${ADM_user}/B-ADMuser
+
+err_fun(){
+  case $1 in
+    1)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Cliente Nulo")"; sleep 2s; tput cuu1; tput dl1;;
+    2)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Nombre de Cliente muy corto")"; sleep 2s; tput cuu1; tput dl1;;
+    3)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Nombre de Cliente muy largo")"; sleep 2s; tput cuu1; tput dl1;;
+    4)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Contraseña Nula")"; sleep 2s; tput cuu1; tput dl1;;
+    5)tput cuu1; tput dl1 && msg -verm "$(fun_trans "TOKEN corto, verifi catidad caracteres")"; sleep 2s; tput cuu1; tput dl1;;
+    6)tput cuu1; tput dl1 && msg -verm "$(fun_trans "TOKEN largo, verifi catidad caracteres")"; sleep 2s; tput cuu1; tput dl1;;
+    7)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion Nula")"; sleep 2s; tput cuu1; tput dl1;;
+    8)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion invalida utilize numeros")"; sleep 2s; tput cuu1; tput dl1;;
+    9)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Duracion maxima y de un año")"; sleep 2s; tput cuu1; tput dl1;;
+    11)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite Nulo")"; sleep 2s; tput cuu1; tput dl1;;
+    12)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite invalido utilize numeros")"; sleep 2s; tput cuu1; tput dl1;;
+    13)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Limite maximo de 999")"; sleep 2s; tput cuu1; tput dl1;;
+    14)tput cuu1; tput dl1 && msg -verm "$(fun_trans "Cliente o TOKEN ya existe")"; sleep 2s; tput cuu1; tput dl1;;
+  esac
+}
+
+data_user(){
+	cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog')
+  [[ -z "$(echo "${cat_users}"|awk -F ':' '{print $5}'|cut -d ',' -f1|grep -w 'token'|head -1)" ]] && print_center -verm2 "NO HAY CLIENTES TOKEN REGISTRADOS" && return 1
+	dat_us=$(printf '%-20s%-12s%-8s%s' 'Cliente' 'Fecha' 'Dias' 'Statu')
+	msg -azu "  N°  $dat_us"
+	msg -bar
+
+	i=1
+	for u in `echo "${cat_users}"|awk -F ':' '{print $1}'`; do
+
+    fix_hwid_token=$(echo "${cat_users}"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f1) && [[ "${fix_hwid_token}" != @(token) ]] && continue
+
+		fecha=$(chage -l "$u"|sed -n '4p'|awk -F ': ' '{print $2}')
+
+		mes_dia=$(echo $fecha|awk -F ',' '{print $1}'|sed 's/ //g')
+		ano=$(echo $fecha|awk -F ', ' '{printf $2}'|cut -c 3-)
+		us=$(printf '%-12s' "$u")
+
+		pass=$(cat "/etc/passwd"|grep -w "$u"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+		[[ "${#pass}" -gt '12' ]] && pass="Desconosida"
+		pass="$(printf '%-19s' "$pass")"
+
+		unset stat
+		if [[ $(passwd --status $u|cut -d ' ' -f2) = "P" ]]; then
+			stat="$(msg -verd "ULK")"
+		else
+			stat="$(msg -verm2 "LOK")"
+		fi
+
+		echo -ne "  $(msg -verd "$i)")$(msg -verm2 "-") $(msg -azu "${pass}")"
+		if [[ $(echo $fecha|awk '{print $2}') = "" ]]; then
+			exp="$(printf '%8s%-2s' '[X]')"
+			exp+="$(printf '%-6s' '[X]')"
+			echo " $(msg -verm2 "$fecha")$(msg -verd "$exp")$(echo -e "$stat")"	
+		else
+			if [[ $(date +%s) -gt $(date '+%s' -d "${fecha}") ]]; then
+				exp="$(printf '%-5s' "Exp")"
+				echo " $(msg -verm2 "$mes_dia/$ano")  $(msg -verm2 "$exp")$(echo -e "$stat")"
+			else
+				EXPTIME="$(($(($(date '+%s' -d "${fecha}") - $(date +%s))) / 86400))"
+				if [[ "${#EXPTIME}" = "1" ]]; then
+            exp="$(printf '%6s%-7s' "$EXPTIME")"
+        elif [[ "${#EXPTIME}" = "2" ]]; then
+            exp="$(printf '%7s%-6s' "$EXPTIME")"
+        else
+            exp="$(printf '%7s%-5s' "$EXPTIME")"
+        fi
+				echo " $(msg -verm2 "$mes_dia/$ano")$(msg -verd "$exp")$(echo -e "$stat")"
+			fi
+		fi
+    echo -e "      $(msg -ama "TOKEN:") $(msg -azu "${us}")"
+    msg -bar3
+		let i++
+	done
+  tput cuu1 && tput dl1
+
+}
+
+#======CREAR NUEVO USUARIO===========
+#useradd -M -s /bin/false -e 2021-10-16 -K PASS_MAX_DAYS=1 ruso99
+add_user(){
+  Fecha=`date +%d-%m-%y-%R`
+  [[ $(cat /etc/passwd |grep $1: |grep -vi [a-z]$1 |grep -v [0-9]$1 > /dev/null) ]] && return 1
+  valid=$(date '+%C%y-%m-%d' -d " +$3 days")
+  clear
+  msg -bar
+
+  system=$(cat -n /etc/issue |grep 1 |cut -d ' ' -f6,7,8 |sed 's/1//' |sed 's/      //')
+  distro=$(echo "$system"|awk '{print $1}')
+  vercion=$(echo $system|awk '{print $2}'|cut -d '.' -f1)
+
+  tpass=$(cat ${ADM_user}/passwd_token)
+
+  if [[ ${distro} = @(Ubuntu|Debian) ]]; then
+    if [[ ${vercion} = "16" ]]; then
+      pass=$(openssl passwd -1 $tpass)
+    else
+      pass=$(openssl passwd -6 $tpass)
+    fi
+  fi
+
+  if useradd -M -s /bin/false -e ${valid} -K PASS_MAX_DAYS=$3 -p ${pass} -c token,$1 $2 ; then
+
+    if [[ $4 = @(s|S) ]]; then
+      rm -rf /etc/openvpn/easy-rsa/pki/reqs/$1.req
+      rm -rf /etc/openvpn/easy-rsa/pki/issued/$1.crt
+      rm -rf /etc/openvpn/easy-rsa/pki/private/$1.key
+      cd /etc/openvpn/easy-rsa/
+      ./easyrsa build-client-full $1 nopass > /dev/null 2>&1
+      cd
+      cp /etc/openvpn/client-common.txt ~/$1.ovpn
+      echo "<ca>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn
+      echo "</ca>" >> ~/$1.ovpn
+      echo "<cert>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn
+      echo "</cert>" >> ~/$1.ovpn
+      echo "<key>" >> ~/$1.ovpn
+      cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn
+      echo "</key>" >> ~/$1.ovpn
+      echo "<tls-auth>" >> ~/$1.ovpn
+      cat /etc/openvpn/ta.key >> ~/$1.ovpn
+      echo "</tls-auth>" >> ~/$1.ovpn
+
+      cd $HOME
+      zip ./$1.zip ./$1.ovpn > /dev/null 2>&1
+      rm ./$1.ovpn > /dev/null 2>&1
+
+      zip_ovpn="$HOME/$1.zip"
+
+    fi
+
+  	print_center -verd "$(fun_trans "Usuario Creado con Exito")"
+  else
+  	print_center -verm2 "$(fun_trans "Error, Usuario no creado")"
+  	msg -bar
+  	sleep 3
+  	return
+  fi
+  msg -bar
+}
+
+mostrar_usuarios(){
+  for u in `cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'token'|awk -F ':' '{print $1}'`; do
+    echo "$u"
+  done
+}
+
+new_user(){
+  fpass="${ADM_user}/passwd_token" && [[ ! -e "${fpass}" ]] && touch ${fpass}
+  apass=$(cat ${ADM_user}/passwd_token)
+  if [[ -z "$apass" ]]; then
+    clear
+    msg -bar
+    print_center -ama "NO HAY CONTRASEÑA TOKEN CONFIGURADA\nCONFIGURE UNA CONTRASEÑA PARA CONTINUAR"
+    enter
+    tpass
+  fi
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "CREAR USUARIOS")"
+  msg -bar
+  data_user
+  back
+
+  while true; do
+    msg -ne "$(fun_trans "Nombre De cliente"): "
+    read cliente
+    cliente="$(echo $cliente|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    cliente="$(echo $cliente|sed -e 's/[^a-z0-9 -]//ig')"
+    if [[ -z $cliente ]]; then
+      err_fun 1 && continue
+    elif [[ "${cliente}" = "0" ]]; then
+      return
+    elif [[ "${#cliente}" -lt "4" ]]; then
+      err_fun 2 && continue
+    elif [[ "${#cliente}" -gt "20" ]]; then
+      err_fun 3 && continue
+    elif [[ "$(echo ${usuarios_ativos[@]}|grep -w "$cliente")" ]]; then
+      err_fun 14 && continue
+    fi
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "TOKEN")"
+    read -p ": " token
+    token="$(echo $token|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    if [[ -z $token ]]; then
+      err_fun 4 && continue
+    elif [[ "${#token}" -lt "10" ]]; then
+      err_fun 5 && continue
+    elif [[ "${#token}" -gt "20" ]]; then
+      err_fun 6 && continue
+    fi
+    break
+  done
+
+  while true; do
+    msg -ne "$(fun_trans "Tiempo de coneccion")"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      err_fun 9 && continue
+    fi 
+    break
+  done
+
+  [[ $(dpkg --get-selections|grep -w "openvpn"|head -1) ]] && [[ -e /etc/openvpn/openvpn-status.log ]] && {
+
+    while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
+      msg -ne "$(fun_trans "Crear Archivo") OpenVPN? [S/N]: "
+      read -e -i S newfile
+    done
+  }
+
+  add_user "${cliente}" "${token}" "${diasuser}" "${newfile}"
+
+  msg -ne " $(fun_trans "IP del Servidor"): " && msg -ama "    $(fun_ip)"
+  msg -ne " $(fun_trans "Cliente"): " && msg -ama "            $cliente"
+  msg -ne " $(fun_trans "Dias de Duracion"): " && msg -ama "   $diasuser"
+  msg -ne " $(fun_trans "Fecha de Expiracion"): " && msg -ama "$(date "+%F" -d " + $diasuser days")"
+  [[ ! -z "$zip_ovpn" ]] && msg -ne " $(fun_trans "Archivo OVPN"): " && msg -ama "       $zip_ovpn"
+  msg -ne " $(fun_trans "TOKEN"): " && msg -ama "$token"
+  msg -bar
+  print_center -ama "►► Presione enter para continuar ◄◄"
+  read
+  return 1
+}
+#===================================
+
+#======CREAR USUARIO TEMPORAL======
+
+mktmpuser(){
+	while [[ -z $name ]]; do
+		msg -ne " Nombre del usuario: "
+		read name
+		if [[ -z $name ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva un nombre de usuario"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset name
+			continue
+		fi
+	done
+
+	if cat /etc/passwd |grep $name: |grep -vi [a-z]$name |grep -v [0-9]$name > /dev/null ; then
+		tput cuu1 && tput dl1
+		msg -verm2 " El usuario $name ya existe"
+		sleep 2
+		tput cuu1 && tput dl1
+		return
+	fi
+
+	while [[ -z $pass ]]; do
+		msg -ne " Contraseña: "
+		read pass
+		if [[ -z $pass ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva una Contraseña"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset pass
+			continue
+		fi
+	done
+
+	while [[ -z $tmp ]]; do
+		msg -ne " Duracion en minutos: "
+		read tmp
+		if [[ -z $tmp ]]; then
+			tput cuu1 && tput dl1
+			msg -ama " Escriva un tiempo de duracion"
+			sleep 2
+			tput cuu1 && tput dl1
+			unset tmp
+			continue
+		fi
+	done
+
+	if [[ -z $1 ]]; then
+		msg -ne " Aplicar a conf Default [S/N]: "
+		read def
+		if [[ ! "$def" != @(s|S|y|Y) ]]; then
+			echo -e "usuario=$name
+Contraseña=$pass
+Tiempo=$tmp" > ${Default}
+		fi
+	fi
+
+	useradd -M -s /bin/false -p $(openssl passwd -6 $pass) $name
+	#(echo $pass; echo $pass)|passwd $name 2>/dev/null
+	touch /tmp/$name
+
+	timer=$(( $tmp * 60 ))
+	timer2="'$timer's"
+	echo "#!/bin/bash
+sleep $timer2
+kill"' $(ps -u '"$name |awk '{print"' $tmp'"}') 1> /dev/null 2> /dev/null
+userdel --force $name
+rm -rf /tmp/$name
+exit" > /tmp/$name
+
+	chmod 777 /tmp/$name
+	touch /tmp/cmd
+	chmod 777 /tmp/cmd
+	echo "nohup /tmp/$name & >/dev/null" > /tmp/cmd
+	/tmp/cmd 2>/dev/null 1>/dev/null
+	rm -rf /tmp/cmd
+
+	title "USUARIO TEMPORAL CREADO"
+	echo -e " $(msg -verm2 "IP:        ") $(msg -ama "$(fun_ip)")"
+	echo -e " $(msg -verm2 "Usuario:   ") $(msg -ama "$name")"
+	echo -e " $(msg -verm2 "Contraseña:") $(msg -ama "$pass")"
+	echo -e " $(msg -verm2 "Duracion:  ") $(msg -ama "$tmp minutos")"
+	msg -bar
+	read foo
+	return
+}
+
+userTMP(){
+	tmp_f="${ADM_user}/userTMP" && [[ ! -d ${tmp_f} ]] && mkdir ${tmp_f}
+	Default="${tmp_f}/Default"
+	if [[ ! -e ${Default} ]]; then
+		echo -e "usuario=ADMRufu
+Contraseña=ADMRufu
+Tiempo=15" > ${Default}
+	fi
+
+	name="$(cat ${Default}|grep "usuario"|cut -d "=" -f2)"
+	pass="$(cat ${Default}|grep "Contraseña"|cut -d "=" -f2)"
+	tmp="$(cat ${Default}|grep "Tiempo"|cut -d "=" -f2)"
+
+	title "CONF DE USUARIO TEMPORAL"
+	print_center -teal "Usuario Default"
+	msg -bar3
+	echo -e " $(msg -verm2 "IP:        ") $(msg -ama "$(fun_ip)")"
+	echo -e " $(msg -verm2 "Usuario:   ") $(msg -ama "$name")"
+	echo -e " $(msg -verm2 "Contraseña:") $(msg -ama "$pass")"
+	echo -e " $(msg -verm2 "Duracion:  ") $(msg -ama "$tmp minutos")"
+	msg -bar
+	menu_func "APLICAR CONF DEFAULT" "CONF PERSONALIZADA"
+	back
+	opcion=$(selection_fun 2)
+	case $opcion in
+		1)mktmpuser "def";;
+		2)unset name
+		  unset pass
+		  unset tmp
+		  mktmpuser;;
+		0)return;;
+	esac
+}
+#===========================================
+
+#=====REMOVER USUARIO=======================
+rm_user(){
+  #nome
+  if userdel --force "$1" ; then
+    sed -i "/$1/d" ${ADM_user}/passwd
+  	print_center -verd "[$(fun_trans "Removido")]"
+  else
+  	print_center -verm "[$(fun_trans "No Removido")]"
+  fi
+}
+
+remove_user(){
+	clear
+	usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+	print_center -ama "$(fun_trans "REMOVER USUARIOS")"
+	msg -bar
+	data_user
+	back
+
+	print_center -ama "$(fun_trans "Escriba o Seleccione un Usuario")"
+	msg -bar
+	unset selection
+	while [[ -z ${selection} ]]; do
+		msg -nazu "$(fun_trans "Seleccione Una Opcion"): " && read selection
+		tput cuu1 && tput dl1
+	done
+	[[ ${selection} = "0" ]] && return
+
+  client_chek=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'token')
+
+	if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+		usuario_del="${usuarios_ativos[$selection]}"
+	else
+    usuario_del=$(echo "$client_chek"|grep -w "$selection"|awk -F ':' '{print $1}')
+	fi
+	[[ -z $usuario_del ]] && {
+		msg -verm "$(fun_trans "Error, Cliente Invalido")"
+		msg -bar
+		return 1
+	}
+	[[ ! $(echo ${usuarios_ativos[@]}|grep -w "$usuario_del") ]] && {
+		msg -verm "$(fun_trans "Error, Cliente Invalido")"
+		msg -bar
+		return 1
+	}
+
+	client=$(echo "$client_chek"|grep -w "$usuario_del"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+
+  print_center -ama "$(fun_trans "Cliente Seleccionado"): $client"
+	pkill -u $usuario_del
+	droplim=`droppids|grep -w "$usuario_del"|awk '{print $2}'` 
+	kill -9 $droplim &>/dev/null
+	rm_user "$usuario_del"
+	msg -bar
+	sleep 3
+}
+
+#========RENOVAR USUARIOS==========
+
+renew_user_fun(){
+  #nome dias
+  datexp=$(date "+%F" -d " + $2 days") && valid=$(date '+%C%y-%m-%d' -d " + $2 days")
+  if chage -E $valid $1 ; then
+    print_center -ama "$(fun_trans "Cliente Renovado Con Exito")"
+  else
+    print_center -verm "$(fun_trans "Error, Cliente no Renovado")"
+  fi
+}
+
+renew_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+  print_center -ama "$(fun_trans "RENOVAR CLIENTE")"
+  msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o seleccione un cliente")"
+  msg -bar
+  unset selection
+  while [[ -z ${selection} ]]; do
+    msg -nazu "$(fun_trans " Seleccione una Opcion"): " && read selection
+    tput cuu1 && tput dl1
+  done
+
+  [[ ${selection} = "0" ]] && return
+
+  client_chek=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'token')
+
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    useredit="${usuarios_ativos[$selection]}"
+  else
+    useredit=$(echo "$client_chek"|grep -w "$selection"|awk -F ':' '{print $1}')
+  fi
+
+  [[ -z $useredit ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    sleep 3
+    return 1
+  }
+
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$useredit") ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    sleep 3
+    return 1
+  }
+
+  client=$(echo "$client_chek"|grep -w "$useredit"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+
+  while true; do
+    msg -ne "$(fun_trans "Nuevo Tiempo de Duracion de"): $client"
+    read -p ": " diasuser
+    if [[ -z "$diasuser" ]]; then
+      echo -e '\n\n\n'
+      err_fun 7 && continue
+    elif [[ "$diasuser" != +([0-9]) ]]; then
+      echo -e '\n\n\n'
+      err_fun 8 && continue
+    elif [[ "$diasuser" -gt "360" ]]; then
+      echo -e '\n\n\n'
+      err_fun 9 && continue
+    fi
+    break
+  done
+  msg -bar
+  renew_user_fun "${useredit}" "${diasuser}"
+  msg -bar
+  sleep 3
+}
+
+eliminar_all(){
+  title "ELIMINAR TODOS LOS CLIENTES"
+  msg -ne " [S/N]: "
+  read opcion
+  [[ "${opcion}" != @(S|s) ]] && return 1
+  enter
+  service dropbear stop &>/dev/null
+  service sshd stop &>/dev/null
+  service ssh stop &>/dev/null
+  service stunnel4 stop &>/dev/null
+  service squid stop &>/dev/null
+
+  cat_users=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w "token")
+
+  for user in `echo "$cat_users"|awk -F ':' '{print $1}'`; do
+    userpid=$(ps -u $user |awk {'print $1'})
+    kill "$userpid" 2>/dev/null
+    client=$(echo "$cat_users"|grep -w "$user"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+    userdel --force $user
+    user2=$(printf '%-15s' "$client")
+    echo -e " $(msg -azu "CLIENTE:") $(msg -ama "$user2")$(msg -verm2 "Eliminado")"
+  done
+  service sshd restart &>/dev/null
+  service ssh restart &>/dev/null
+  service dropbear start &>/dev/null
+  service stunnel4 start &>/dev/null
+  service squid restart &>/dev/null
+  msg -bar
+  print_center -ama "CONEXIONES ELIMINANDOS"
+  enter
+  return 1
+}
+
+sshmonitor(){
+  clear
+  cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog')
+  cab=$(printf '%-15s%-13s%-15s%-9s' 'USUARIO' 'STATUS' 'CONEXIONES' 'TIEMPO')
+  msg -bar 
+  echo -e "\E[41;1;37m $cab\E[0m"
+  msg -bar
+    for i in `echo "$cat_users"|awk -F ':' '{print $1}'`; do
+        user="$i"
+        s2ssh="$(echo "$cat_users"|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f1)"
+
+        if [[ "$(echo "$cat_users"| grep -w $i| wc -l)" = "1" ]]; then
+          sqd="$(ps -u $user | grep sshd | wc -l)"
+        else
+          sqd=00
+        fi
+
+        [[ "$sqd" = "" ]] && sqd=0
+        if [[ -e /etc/openvpn/openvpn-status.log ]]; then
+          ovp="$(cat /etc/openvpn/openvpn-status.log | grep -E ,"$i", | wc -l)"
+        else
+          ovp=0
+        fi
+
+        if netstat -nltp|grep 'dropbear'> /dev/null;then
+          drop="$(droppids | grep "$i" | wc -l)"
+        else
+          drop=0
+        fi
+        
+        cnx=$(($sqd + $drop))
+        conex=$(($cnx + $ovp))
+        if [[ $cnx -gt 0 ]]; then
+          tst="$(ps -o etime $(ps -u $i |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')"
+          tst1=$(echo "$tst" | wc -c)
+        if [[ "$tst1" == "9" ]]; then 
+          timerr="$(ps -o etime $(ps -u $i |grep sshd |awk 'NR==1 {print $1}')|awk 'NR==2 {print $1}')"
+        else
+          timerr="$(echo "00:$tst")"
+        fi
+        elif [[ $ovp -gt 0 ]]; then
+          tmp2=$(printf '%(%H:%M:%S)T\n')
+          tmp1="$(grep -w "$i" /etc/openvpn/openvpn-status.log |awk '{print $4}'| head -1)"
+          [[ "$tmp1" = "" ]] && tmp1="00:00:00" && tmp2="00:00:00"
+          var1=`echo $tmp1 | cut -c 1-2`
+          var2=`echo $tmp1 | cut -c 4-5`
+          var3=`echo $tmp1 | cut -c 7-8`
+          var4=`echo $tmp2 | cut -c 1-2`
+          var5=`echo $tmp2 | cut -c 4-5`
+          var6=`echo $tmp2 | cut -c 7-8`
+          calc1=`echo $var1*3600 + $var2*60 + $var3 | bc`
+          calc2=`echo $var4*3600 + $var5*60 + $var6 | bc`
+          seg=$(($calc2 - $calc1))
+          min=$(($seg/60))
+          seg=$(($seg-$min*60))
+          hor=$(($min/60))
+          min=$(($min-$hor*60))
+          timerusr=`printf "%02d:%02d:%02d \n" $hor $min $seg;`
+          timerr=$(echo "$timerusr" | sed -e 's/[^0-9:]//ig' )
+        else
+          timerr="00:00:00"
+        fi
+
+        if [[ "$s2ssh" != @(hwid|token) ]]; then
+          user=$(printf '%-15s' "$i")
+          con=$(printf '%-11s' "$conex/$s2ssh")
+        else
+          fix="$(echo "$cat_users"|grep -w "$i"|awk -F ':' '{print $5}'|cut -d ',' -f2)"
+          user=$(printf '%-15s' "$fix")
+          con=$(printf '%-11s' "$(echo $s2ssh|awk '{print toupper($0)}')")
+        fi
+
+        if [[ $conex -eq 0 ]]; then
+           status=$(printf '%-16s' 'Offline')
+           echo -e " $(msg -ama "$user")$(msg -verm2 "$status")$(msg -verd "$con")$(msg -ama "$timerr")"
+        else
+           status=$(printf '%-16s' 'Online')
+           echo -e " $(msg -ama "$user")$(msg -verd "$status")$(msg -verd "$con")$(msg -ama "$timerr")"
+        fi
+        msg -bar3
+      done
+    tput cuu1 && tput dl1
+    msg -bar
+    print_center -ama "►► Presione enter para continuar ◄◄"
+    read
+}
+
+detail_user(){
+	clear
+	usuarios_ativos=('' $(mostrar_usuarios))
+	if [[ -z ${usuarios_ativos[@]} ]]; then
+		msg -bar
+		print_center -verm2 "$(fun_trans "Ningun Cliente registrado")"
+		msg -bar
+		sleep 3
+		return
+	else
+		msg -bar
+		print_center -ama "$(fun_trans "DETALLES DEL LOS CLIENTES")"
+		msg -bar
+	fi
+	data_user
+	enter
+}
+
+block_user(){
+  clear
+  usuarios_ativos=('' $(mostrar_usuarios))
+  msg -bar
+	print_center -ama "$(fun_trans "BLOQUEAR/DESBLOQUEAR CLIENTE")"
+	msg -bar
+  data_user
+  back
+
+  print_center -ama "$(fun_trans "Escriba o Seleccione Un Cliente")"
+  msg -bar
+  unset selection
+  while [[ ${selection} = "" ]]; do
+    echo -ne "\033[1;37m Seleccione: " && read selection
+    tput cuu1 && tput dl1
+  done
+  [[ ${selection} = "0" ]] && return
+
+  client_chek=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'token')
+
+  if [[ ! $(echo "${selection}" | egrep '[^0-9]') ]]; then
+    usuario_del="${usuarios_ativos[$selection]}"
+  else
+    usuario_del=$(echo "$client_chek"|grep -w "$selection"|awk -F ':' '{print $1}')
+  fi
+  [[ -z $usuario_del ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    return 1
+  }
+  [[ ! $(echo ${usuarios_ativos[@]}|grep -w "$usuario_del") ]] && {
+    msg -verm "$(fun_trans "Error, Cliente Invalido")"
+    msg -bar
+    return 1
+  }
+
+  client=$(echo "$client_chek"|grep -w "$usuario_del"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+
+  msg -nama "   $(fun_trans "Cliente"): $client >>>> "
+
+  if [[ $(passwd --status $usuario_del|cut -d ' ' -f2) = "P" ]]; then
+    pkill -u $usuario_del &>/dev/null
+    droplim=`droppids|grep -w "$usuario_del"|awk '{print $2}'` 
+    kill -9 $droplim &>/dev/null
+    usermod -L $usuario_del &>/dev/null
+    sleep 2
+    msg -verm2 "$(fun_trans "Bloqueado")"
+  else
+  	usermod -U $usuario_del
+  	sleep 2
+  	msg -verd "$(fun_trans "Desbloqueado")"
+  fi
+  enter
+}
+
+rm_vencidos(){
+	title "REMOVER CLIENTES VENCIDOS"
+	print_center -ama " Removera todo los clientes token expirado"
+	msg -bar
+	msg -ne " Continua [S/N]: "
+	read opcion
+	tput cuu1 && tput dl1
+	[[ "$opcion" != @(s|S|y|Y) ]] && return
+
+	expired="$(fun_trans "Expirado")"
+	removido="$(fun_trans "Removido")"
+	DataVPS=$(date +%s)
+
+	while read user; do
+		DataUser=$(chage -l "$user"|sed -n '4p'|awk -F ': ' '{print $2}')
+		[[ "$DataUser" = @(never|nunca) ]] && continue
+		#[[ "$DataUser" = "ene 01, 1970" ]] && DataUser="Jan 01, 1970"
+		DataSEC=$(date +%s --date="$DataUser")
+
+		if [[ "$DataSEC" -lt "$DataVPS" ]]; then
+			pkill -u $user
+			droplim=`droppids|grep -w "$user"|awk '{print $2}'` 
+			kill -9 $droplim &>/dev/null
+      client=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'token'|grep -w "$user"|awk -F ':' '{print $5}'|cut -d ',' -f2)
+			userdel $user
+			print_center -ama "$client $expired ($removido)"
+			sleep 1
+		fi
+	done <<< "$(mostrar_usuarios)"
+	enter
+}
+
+limiter(){
+
+	ltr(){
+		clear
+		msg -bar
+    l_cron=$(cat /var/spool/cron/crontabs/root|grep -w 'limitador.sh'|grep -w 'token')
+    if [[ -z "$l_cron" ]]; then
+      echo '@daily /etc/ADMRufu/install/limitador.sh --token' >> /var/spool/cron/crontabs/root
+      print_center -verd "limitador de expirados programado\nse ejecutara todos los dias a las 00hs\nsegun la hora programada en el servidor"
+      enter
+      return
+    else
+      sed -i '/limitador.sh --token/d' /var/spool/cron/crontabs/root
+      print_center -verm2 "limitador de expirados detenido"
+      enter
+      return   
+    fi
+	}
+
+	log(){
+		clear
+		msg -bar
+		print_center -ama "REGISTRO DEL LIMITADOR"
+		msg -bar
+		[[ ! -e ${ADM_user}/limit.log ]] && touch ${ADM_user}/limit.log
+		if [[ -z $(cat ${ADM_user}/limit.log) ]]; then
+			print_center -ama "no ahy registro de limitador"
+			msg -bar
+			sleep 2
+			return
+		fi
+		msg -teal "$(cat ${ADM_user}/limit.log)"
+		msg -bar
+		print_center -ama "►► Presione enter para continuar o ◄◄"
+		print_center -ama "►► 0 para limpiar registro ◄◄"
+		read opcion
+		[[ $opcion = "0" ]] && echo "" > ${ADM_user}/limit.log
+	}
+
+	clear
+	msg -bar
+	print_center -ama "LIMITADOR DE CUENTAS"
+	msg -bar
+	menu_func "LIMTADOR DE EXPIRADOS" "LIMITADOR DE DATOS $(msg -verm2 "(no diponible)")" "LOG DEL LIMITADOR"
+	back
+	msg -ne " opcion: "
+	read opcion
+	case $opcion in
+		1)ltr;;
+		2);;
+		3)log;;
+		0)return;;
+	esac
+}
+
+USER_MODE(){
+  title "SELECCIONE EL MODO QUE USARA POR DEFECTO"
+  menu_func "SSH" "HWID"
+  back
+  opcion=$(selection_fun 2)
+  case $opcion in
+    1) echo "userSSH" > ${ADM_user}/userMODE
+       clear
+       msg -bar
+       print_center -verd "MODO SSH ACTIVA"
+       enter;;
+    2) echo "userHWID" > ${ADM_user}/userMODE
+       clear
+       msg -bar
+       print_center -verd "MODO HWID ACTIVA"
+       enter;;
+    0)return 1;;
+  esac
+}
+
+tpass(){
+  fpass="${ADM_user}/passwd_token" && [[ ! -e "${fpass}" ]] && touch ${fpass}
+  apass=$(cat ${ADM_user}/passwd_token)
+  title -ama "CONFIGURACION DE CONTRASEÑA TOKEN"
+  if [[ ! -z "$apass" ]]; then
+    print_center -azu "CONTRASEÑA ACTUAL: $apass"
+    msg -bar
+  fi
+  while true; do
+    echo -e " $(msg -verm3 "╭╼╼╼[")$(msg -azu "INGRESE SU CONTRASEÑA, ENTER PARA CANSELAR")$(msg -verm3 "]")"
+    echo -ne " $(msg -verm3 "╰╼")\033[37;1m> " && read npass
+    npass="$(echo $npass|sed 'y/áÁàÀãÃâÂéÉêÊíÍóÓõÕôÔúÚñÑçǪº/aAaAaAaAeEeEiIoOoOoOuUnNcCao/')"
+    if [[ -z $npass ]]; then
+      break
+    elif [[ "${#npass}" -lt "6" ]]; then
+      err_fun 5 && tput cuu1 && tput dl1 && continue
+    elif [[ "${#npass}" -gt "32" ]]; then
+      err_fun 6 && tput cuu1 && tput dl1 && continue
+    fi
+    break
+  done
+  [[ -z "$npass" ]] && return 1
+  tput cuu1 && tput dl1 && tput cuu1 && tput dl1
+  printf "$npass" > ${ADM_user}/passwd_token
+  clear
+  msg -bar
+  echo -e " $(msg -verd "╭╼╼╼╼╼╼╼╼╼[")$(msg -azu "SE GUARDO LA NUEVA CONTRASEÑA")$(msg -verd "]")"
+  echo -ne " $(msg -verd "╰╼")\033[37;1m> " && msg -azu "$npass"
+  cat_users=$(cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog'|grep -w 'token'|awk -F ':' '{print $1}')
+  [[ ! -z "$cat_users" ]] && msg -bar && msg -nama " APLICAR A TODOS LOS CLIENTES [S/N]: " && read allpass
+  if [[ "$allpass" = @(S|s) ]]; then
+    msg -bar
+    print_center -ama "APLICADO CONTRASEÑA A TODO LOS CLIENTES"
+    for u in `echo "$cat_users"`; do
+      (echo $npass; echo $npass)|passwd $u 2>/dev/null
+    done
+    tput cuu1 && tput dl1
+    print_center -verd "CONTRASEÑA APLICADA A TODO LOS CLIENTES"
+  fi
+  enter
+  return 1
+}
+
+while :
+do
+
+  [[ $(cat /var/spool/cron/crontabs/root|grep -w 'limitador.sh'|grep -w 'token') ]] && lim=$(msg -verd "[ON]") || lim=$(msg -verm2 "[OFF]")
+
+	title -ama "ADMINISTRACION DE USUARIOS TOKEN"
+
+	menu_func "NUEVO CLIENTE TOKEN ✏️ " \
+"$(msg -verm2 "REMOVER CLIENTE") 🗑 " \
+"$(msg -verd "EDITAR/RENOVAR CLIENTE") ♻️" \
+"-bar3 BLOQ/DESBLOQ CLIENTE 🔒" \
+"-bar3 CONFIGURAR CONTRASEA TOKEN" \
+"$(msg -verd "DETALLES DE TODOS CLIENTES") 🔎" \
+"MONITOR DE CLIENTES CONECTADOS" \
+"-bar3 🔒 $(msg -ama "LIMITADOR-DE-CUENTAS-EXPIRADAS") 🔒 $lim" \
+"ELIMINAR CLIENTES VENCIDOS" \
+"-bar3 ⚠️ $(msg -verm2 "ELIMINAR TODOS LOS CLIENTES") ⚠️" \
+"BACKUP CLIENTES" \
+"-bar DESACTIVAR PASS ALFANUMERICO $(msg -blu "(VULTR)")" \
+"CAMBIAR A MODO SSH/HWID"
+
+	back
+	selection=$(selection_fun 13)
+	case ${selection} in
+		0)break;;
+		1)new_user;;
+		2)remove_user;;
+		3)renew_user;;
+		4)block_user;;
+    5)tpass;;
+		6)detail_user;;
+		7)sshmonitor;;
+		8)limiter;;
+		9)rm_vencidos;;
+		10)eliminar_all;;
+		11)backup;;
+		12)ULK_ALF;;
+    13)USER_MODE && break;;
+	esac
+done

+ 218 - 0
R9/ADMRufu-31/install/userV2ray.sh

@@ -0,0 +1,218 @@
+#!/bin/bash
+
+restart(){
+	title "REINICIANDO V2RAY"
+	if [[ "$(v2ray restart|awk '{printf $3}')" = "success" ]]; then
+		print_center -verd "v2ray restart success !"
+		msg -bar
+		sleep 3
+	else
+		print_center -verm2 "v2ray restart fail !"
+		msg -bar
+		sleep 3
+		return
+	fi
+}
+
+list(){
+	name=$(printf '%-25s' "$2")
+	fecha=$(printf '%-10s' "$3")
+	if [[ "$4" = "EXP" ]]; then
+		dias=$(msg -verm2 "[$4]")
+	else
+		dias=$(msg -verd "[$4]")
+	fi
+	echo -e "$(msg -verd " [$1]") $(msg -verm2 ">") $(msg -azu "$name") $(msg -verm2 "$fecha") $dias"
+ }
+
+userDat(){
+	n=$(printf '%-5s' 'N°')
+	u=$(printf '%-25s' 'Usuarios')
+	f=$(printf '%-10s' 'fech exp')
+	msg -azu "  $n $u $f dias"
+	msg -bar
+ }
+
+ list_user(){
+ 	unset seg
+	seg=$(date +%s)
+ 	userDat
+ 	users=$(jq '.inbounds[].settings.clients | length' $config)
+	for (( i = 0; i < $users; i++ )); do
+		user=$(jq -r --argjson a "$i" '.inbounds[].settings.clients[$a].email' < $config)
+		fecha=$(jq -r --argjson a "$i" '.inbounds[].settings.clients[$a].date' < $config)
+		[[ "$user" = "null" ]] && continue
+
+		seg_exp=$(date +%s --date="$fecha")
+		exp="$(($(($seg_exp - $seg)) / 86400))"
+
+		[[ "$exp" -lt "0" ]] && exp="EXP"
+
+		list "$i" "$user" "$fecha" "$exp"
+	done
+ }
+
+ col2(){
+ 	msg -ne "$1" && msg -ama " $2"
+ }
+
+ vmess(){
+ 	ps=$(jq -r .inbounds[].settings.clients[$1].email $config) && [[ $ps = null ]] && ps="default"
+	id=$(jq -r .inbounds[].settings.clients[$1].id $config)
+	aid=$(jq .inbounds[].settings.clients[$1].alterId $config)
+	add=$(jq -r .inbounds[].domain $config) && [[ $add = null ]] && add=$(wget -qO- ipv4.icanhazip.com)
+	host=$(jq -r .inbounds[].streamSettings.wsSettings.headers.Host $config) && [[ $host = null ]] && host=''
+	net=$(jq -r .inbounds[].streamSettings.network $config)
+	path=$(jq -r .inbounds[].streamSettings.wsSettings.path $config) && [[ $path = null ]] && path=''
+	port=$(jq .inbounds[].port $config)
+	tls=$(jq -r .inbounds[].streamSettings.security $config)
+
+	title "DATOS DE USUARIO: $ps"
+	col2 "Remarks:" "$ps"
+	col2 "Address:" "$add"
+	col2 "Port:" "$port"
+	col2 "id:" "$id"
+	col2 "alterId:" "$aid"
+	col2 "security:" "none"
+	col2 "network:" "$net"
+	col2 "Head Type:" "none"
+	[[ ! $host = '' ]] && col2 "Host/SNI:" "$host"
+	[[ ! $path = '' ]] && col2 "Path:" "$path"
+	col2 "TLS:" "$tls"
+	msg -bar
+ 	var="{\"v\":\"2\",\"ps\":\"$ps\",\"add\":\"$add\",\"port\":$port,\"aid\":$aid,\"type\":\"none\",\"net\":\"$net\",\"path\":\"$path\",\"host\":\"$host\",\"id\":\"$id\",\"tls\":\"$tls\"}"
+	msg -ama "vmess://$(echo "$var"|jq -r '.|@base64')"
+	msg -bar
+	read foo
+ }
+
+newuser(){
+	title "CREAR NUEVO USUARIO V2RAY"
+	list_user
+	back
+	in_opcion "Nuevo Usuario"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	if [[ "$opcion" = "0" ]]; then
+		return
+	elif [[ -z "$opcion" ]]; then
+		tput cuu1 && tput dl1
+		msg -verm2 " no se puede ingresar campos vacios..."
+		sleep 2
+		return
+	elif [[ ! "$opcion" =~ $tx_num ]]; then
+		tput cuu1 && tput dl1
+		msg -verm2 " ingrese solo letras y numeros..."
+		sleep 2
+		return
+	elif [[ "${#opcion}" -lt "4" ]]; then
+		tput cuu1 && tput dl1
+		msg -verm2 " nombre demaciado corto!"
+		sleep 2
+		return
+	elif [[ "$(jq -r '.inbounds[].settings.clients[].email' < $config|grep "$opcion")" ]]; then
+		tput cuu1 && tput dl1
+		msg -verm2 " este nombe de ususario ya existe..."
+		sleep 2
+		return
+	fi
+	email="$opcion"
+	in_opcion "Dias de duracion"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	if [[ "$opcion" = "0" ]]; then
+		return
+	elif [[ ! "$opcion" =~ $numero ]]; then
+		tput cuu1 && tput dl1
+		msg -verm2 " ingresa solo numeros"
+		sleep 2
+		return
+	fi
+
+	dias=$(date '+%y-%m-%d' -d " +$opcion days")
+	alterid=$(jq -r '.inbounds[].settings.clients[0].alterId' < $config)
+	uuid=$(uuidgen)
+	var="{\"alterId\":"$alterid",\"id\":\"$uuid\",\"email\":\"$email\",\"date\":\"$dias\"}"
+
+	
+	mv $config $temp
+	jq --argjson a "$users" --argjson b "$var" '.inbounds[].settings.clients[$a] += $b' < $temp > $config
+	chmod 777 $config
+	rm -rf $temp
+	restart
+	vmess "$users"
+}
+
+deluser(){
+	title "ELIMINAR USUARIOS"
+	list_user
+	back
+	in_opcion "Opcion"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	if [[ "$opcion" = "0" ]]; then
+		return
+	elif [[ ! "$opcion" =~ $numero ]]; then
+		tput cuu1 && tput dl1
+		msg -verm2 " ingresa solo numeros"
+		sleep 2
+		return
+	fi
+	mv $config $temp
+	jq --argjson a "$opcion" 'del(.inbounds[].settings.clients[$a])' < $temp > $config
+	chmod 777 $config
+	rm -rf $temp
+	restart
+}
+
+datos(){
+	title "DATOS DE USUARIOS"
+	list_user
+	back
+	in_opcion "Opcion"
+	vmess "$opcion"
+}
+
+respaldo(){
+	title "COPIAS DE SEGURIDAD DE USUARIOS"
+	menu_func "CREAR COPIA DE USUARIOS" "RESTAURAR COPIA DE USUARIO"
+	back
+	opcion=$(selection_fun 2)
+
+	case $opcion in
+		1)rm -rf /root/User-V2ray.txt
+		jq '.inbounds[].settings.clients' < $config > /root/User-V2ray.txt
+		title "COPIA REALIZADO CON EXITO"
+		msg -ne " Copia: " && msg -ama "/root/User-V2ray.txt"
+		msg -bar
+		read foo;;
+		2)[[ ! -e "/root/User-V2ray.txt" ]] && msg -verm2 " no hay copia de ususarios!" && sleep 3 && return
+		var=$(cat /root/User-V2ray.txt)
+		[[  -z "$var" ]] && msg -verm2 " copia de ususarios vacio!" && sleep 3 && return
+		mv $config $temp
+		jq --argjson a "$var" '.inbounds[].settings += {clients:$a}' < $temp > $config
+		chmod 777 $config
+		rm -rf $temp
+		title "COPIA RESTAURADA CON EXITO"
+		sleep 2
+		restart;;
+		0)return;;
+	esac
+}
+
+while :
+do
+	title "GESTION DE USUARIOS V2RAY"
+	menu_func "$(msg -verd "CREAR USUARIOS")" \
+	"$(msg -verm2 "ELIMINAR USUARIOS")" \
+	"BLOQUEAR USUARIOS $(msg -verm2 "(no diponible!)")" \
+	"$(msg -ama "VMESS DE USUARIOS")" \
+	"RESPALDO DE SEGURIDAD"
+	back
+	opcion=$(selection_fun 5)
+	case $opcion in
+		1)newuser;;
+		2)deluser;;
+		3);;
+		4)datos;;
+		5)respaldo;;
+		0)break;;
+	esac
+done

+ 283 - 0
R9/ADMRufu-31/install/v2ray.sh

@@ -0,0 +1,283 @@
+#!/bin/bash
+restart(){
+	title "REINICIANDO V2RAY"
+	if [[ "$(v2ray restart|awk '{printf $3}')" = "success" ]]; then
+		print_center -verd "v2ray restart success !"
+	else
+		print_center -verm2 "v2ray restart fail !"
+	fi
+	msg -bar
+	sleep 3
+}
+
+ins_v2r(){
+	title "ESTA POR INSTALAR V2RAY!"
+	print_center -ama "La instalacion puede tener alguna fallas!\npor favor observe atentamente el log de intalacion.\npodria contener informacion sobre algunos errores!\ny deveran corregirse de forma manual antes de\ncontinuar usando el script."
+	enter
+	source <(curl -sL https://multi.netlify.app/v2ray.sh)
+}
+
+v2ray_tls(){
+	db="$(ls ${ADM_crt})"
+    if [[ ! "$(echo "$db"|grep '.crt')" = "" ]]; then
+        cert=$(echo "$db"|grep '.crt')
+        key=$(echo "$db"|grep '.key')
+        DOMI=$(cat "${ADM_src}/dominio.txt")
+        title "CERTIFICADO SSL ENCONTRADO"
+        echo -e "$(msg -azu "DOMI:") $(msg -ama "$DOMI")"
+        echo -e "$(msg -azu "CERT:") $(msg -ama "$cert")"
+        echo -e "$(msg -azu "KEY:")  $(msg -ama "$key")"
+        msg -bar
+        msg -ne " Continuar, usando este certificado [S/N]: " && read opcion_tls
+
+        if [[ $opcion_tls = @(S|s) ]]; then
+            cert=$(jq --arg a "${ADM_crt}/$cert" --arg b "${ADM_crt}/$key" '.inbounds[].streamSettings.tlsSettings += {"certificates":[{"certificateFile":$a,"keyFile":$b}]}' < $config)
+            domi=$(echo "$cert"|jq --arg a "$DOMI" '.inbounds[] += {"domain":$a}')
+            echo "$domi"|jq --arg a 'tls' '.inbounds[].streamSettings += {"security":$a}' > $temp
+            chmod 777 $temp
+            mv -f $temp $config
+            restart
+            return
+        fi
+    fi
+
+	title "CERTIFICADO TLS V2RAY"
+	echo -e "\033[1;37m"
+	v2ray tls
+	enter
+ }
+
+removeV2Ray(){
+    #V2ray
+    bash <(curl -L -s https://multi.netlify.app/go.sh) --remove >/dev/null 2>&1
+    rm -rf /etc/v2ray >/dev/null 2>&1
+    rm -rf /var/log/v2ray >/dev/null 2>&1
+
+    #Xray
+    bash <(curl -L -s https://multi.netlify.app/go.sh) --remove -x >/dev/null 2>&1
+    rm -rf /etc/xray >/dev/null 2>&1
+    rm -rf /var/log/xray >/dev/null 2>&1
+
+    #v2ray iptable
+    bash <(curl -L -s https://multi.netlify.app/v2ray_util/global_setting/clean_iptables.sh)
+
+    #multi-v2ray
+    pip uninstall v2ray_util -y
+    rm -rf /usr/share/bash-completion/completions/v2ray.bash >/dev/null 2>&1
+    rm -rf /usr/share/bash-completion/completions/v2ray >/dev/null 2>&1
+    rm -rf /usr/share/bash-completion/completions/xray >/dev/null 2>&1
+    rm -rf /etc/bash_completion.d/v2ray.bash >/dev/null 2>&1
+    rm -rf /usr/local/bin/v2ray >/dev/null 2>&1
+    rm -rf /etc/v2ray_util >/dev/null 2>&1
+
+    #v2ray
+    crontab -l|sed '/SHELL=/d;/v2ray/d'|sed '/SHELL=/d;/xray/d' > crontab.txt
+    crontab crontab.txt >/dev/null 2>&1
+    rm -f crontab.txt >/dev/null 2>&1
+
+    systemctl restart cron >/dev/null 2>&1
+
+    #multi-v2ray
+    sed -i '/v2ray/d' ~/.bashrc
+    sed -i '/xray/d' ~/.bashrc
+    source ~/.bashrc
+
+    clear
+    msg -bar
+    print_center "V2RAY REMOVIDO!"
+    enter
+    return 1
+}
+
+ v2ray_stream(){
+ 	title "PROTOCOLOS V2RAY"
+ 	echo -e "\033[1;37m"
+	v2ray stream
+	msg -bar
+	read foo
+ }
+
+ port(){
+ 	port=$(jq -r '.inbounds[].port' $config)
+ 	title "CONFING PERTO V2RAY"
+	print_center -azu "puerto actual: $(msg -ama "$port")"
+	back
+	in_opcion "Nuevo puerto"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	tput cuu1 && tput dl1
+	if [[ -z "$opcion" ]]; then
+		msg -ne " deves ingresar una opcion"
+		sleep 2
+		return
+	elif [[ ! $opcion =~ $numero ]]; then
+		msg -ne " solo deves ingresar numeros"
+		sleep 2
+		return
+	elif [[ "$opcion" = "0" ]]; then
+		return
+	fi
+	mv $config $temp
+	jq --argjson a "$opcion" '.inbounds[] += {"port":$a}' < $temp >> $config
+	chmod 777 $config
+	rm $temp
+	restart
+ }
+
+ alterid(){
+ 	aid=$(jq -r '.inbounds[].settings.clients[0].alterId' $config)
+ 	title "CONFING alterId V2RAY"
+	print_center -azu "alterid actual: $(msg -ama "$aid")"
+	back
+	in_opcion "Nuevo alterid"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	tput cuu1 && tput dl1
+	if [[ -z "$opcion" ]]; then
+		msg -ne " deves ingresar una opcion"
+		sleep 2
+		return
+	elif [[ ! $opcion =~ $numero ]]; then
+		msg -ne " solo deves ingresar numeros"
+		sleep 2
+		return
+	elif [[ "$opcion" = "0" ]]; then
+		return
+	fi
+	mv $config $temp
+	jq --argjson a "$opcion" '.inbounds[].settings.clients[] += {"alterId":$a}' < $temp >> $config
+	chmod 777 $config
+	rm $temp
+	restart
+ }
+
+ n_v2ray(){
+ 	title "CONFIGRACION NATIVA V2RAY"
+ 	echo -ne "\033[1;37m"
+	v2ray
+ }
+
+ address(){
+ 	add=$(jq -r '.inbounds[].domain' $config) && [[ $add = null ]] && add=$(wget -qO- ipv4.icanhazip.com)
+ 	title "CONFING address V2RAY"
+	print_center -azu "actual: $(msg -ama "$add")"
+	back
+	in_opcion "Nuevo address"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	tput cuu1 && tput dl1
+	if [[ -z "$opcion" ]]; then
+		msg -ne " deves ingresar una opcion"
+		sleep 2
+		return
+	elif [[ "$opcion" = "0" ]]; then
+		return
+	fi
+	mv $config $temp
+	jq --arg a "$opcion" '.inbounds[] += {"domain":$a}' < $temp >> $config
+	chmod 777 $config
+	rm $temp
+	restart
+ }
+
+ host(){
+ 	host=$(jq -r '.inbounds[].streamSettings.wsSettings.headers.Host' $config) && [[ $host = null ]] && host='sin host'
+ 	title "CONFING host V2RAY"
+	print_center -azu "Actual: $(msg -ama "$host")"
+	back
+	in_opcion "Nuevo host"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	tput cuu1 && tput dl1
+	if [[ -z "$opcion" ]]; then
+		msg -ne " deves ingresar una opcion"
+		sleep 2
+		return
+	elif [[ "$opcion" = "0" ]]; then
+		return
+	fi
+	mv $config $temp
+	jq --arg a "$opcion" '.inbounds[].streamSettings.wsSettings.headers += {"Host":$a}' < $temp >> $config
+	chmod 777 $config
+	rm $temp
+	restart
+ }
+
+ path(){
+ 	path=$(jq -r '.inbounds[].streamSettings.wsSettings.path' $config) && [[ $path = null ]] && path=''
+ 	title "CONFING path V2RAY"
+	print_center -azu "Actual: $(msg -ama "$path")"
+	back
+	in_opcion "Nuevo path"
+	opcion=$(echo "$opcion" | tr -d '[[:space:]]')
+	tput cuu1 && tput dl1
+	if [[ -z "$opcion" ]]; then
+		msg -ne " deves ingresar una opcion"
+		sleep 2
+		return
+	elif [[ "$opcion" = "0" ]]; then
+		return
+	fi
+	mv $config $temp
+	jq --arg a "$opcion" '.inbounds[].streamSettings.wsSettings += {"path":$a}' < $temp >> $config
+	chmod 777 $config
+	rm $temp
+	restart
+ }
+
+ reset(){
+ 	title "RESTAURANDO AJUSTES V2RAY"
+ 	#resolver imprecion de texto
+ 	user=$(jq -c '.inbounds[].settings.clients' < $config)
+
+ 	v2ray new
+ 	jq 'del(.inbounds[].streamSettings.kcpSettings[])' < $config > $temp
+ 	rm $config
+    jq '.inbounds[].streamSettings += {"network":"ws","wsSettings":{"path": "/ADMRufu/","headers": {"Host": "ejemplo.com"}}}' < $temp > $config
+    chmod 777 $config
+    rm $temp
+    sleep 2
+    if [[ ! -z "$user" ]]; then
+    	title "RESATURANDO USUARIOS"
+    	mv $config $temp
+    	jq --argjson a "$user" '.inbounds[].settings += {"clients":$a}' < $temp > $config
+    	chmod 777 $config
+    	sleep 2
+    	restart
+    fi
+ }
+
+while :
+do
+	clear
+	msg -bar
+	print_center -verd "v2ray manager by @Rufu99"
+	msg -bar
+	msg -ama "INSTALACION"
+	msg -bar3
+	menu_func "$(msg -verd "INSTALL/RE-REINSTALL V2RAY")" \
+	"$(msg -verm2 "DESINSTALAR V2RAY")\n$(msg -bar3)\n$(msg -ama "CONFIGRACION")\n$(msg -bar3)" \
+	"Certif ssl/tls $(msg -ama "(menu nativo)")" \
+	"Protocolos $(msg -ama "(menu nativo)")" \
+	"puerto" \
+	"alterId" \
+	"Conf v2ray $(msg -ama "(menu nativo)")\n$(msg -bar3)\n$(msg -ama "CLIENTES")\n$(msg -bar3)" \
+	"address" \
+	"Host" \
+	"Path\n$(msg -bar3)\n$(msg -ama "EXTRAS")\n$(msg -bar3)" \
+	"Restablecer ajustes"
+	back
+	opcion=$(selection_fun 12)
+	case $opcion in
+		1)ins_v2r;;
+		2)removeV2Ray;;
+		3)v2ray_tls;;
+		4)v2ray_stream;;
+		5)port;;
+		6)alterid;;
+		7)n_v2ray;;
+		8)address;;
+		9)host;;
+		10)path;;
+		11)reset;;
+		0)break;;
+	esac
+	[[ "$?" = "1" ]] && break
+done
+return 1

+ 164 - 0
R9/ADMRufu-31/install/ws-cdn.sh

@@ -0,0 +1,164 @@
+#!/bin/bash
+clear
+check_drop(){
+	ins=$(dpkg --get-selections|grep -w "dropbear"|grep -v "dropbear-"|awk '{printf $2}')
+	[[ -z "$ins" ]] && ins="deinstall"
+	if [[ "$ins" = "deinstall" ]]; then
+		encab
+		print_center -ama "Dropbear no se encuentra instalado"
+		msg -bar
+		echo -ne "\033[1;37m desea instalarlo [s/n]: "
+		read opcion
+		[[ $opcion = @(s|S|y|Y) ]] && clear && msg -bar && ${ADM_inst}/dropbear.sh
+	fi
+ }
+
+drop_port () {
+	local portasVAR=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
+	local NOREPEAT
+	local reQ
+	local Port
+
+	while read port; do
+		reQ=$(echo ${port}|awk '{print $1}')
+		Port=$(echo {$port} | awk '{print $9}' | awk -F ":" '{print $2}')
+		[[ $(echo -e $NOREPEAT|grep -w "$Port") ]] && continue
+		NOREPEAT+="$Port\n"
+
+		case ${reQ} in
+			dropbear)
+					 if [[ ! $Port = 22 ]]; then
+					 	DPB+=" $Port"
+					 fi;;
+		esac
+	done <<< "${portasVAR}"
+ }
+
+conf(){
+	check_drop
+	[[ $opcion = @(n|N) ]] && return 1
+	drop_port
+	encab
+	print_center -azu "Selecciones puerto de redireccion de trafico"
+	msg -bar
+
+	n=1
+	for i in $DPB; do
+		echo -e " \033[1;32m[$n] \033[1;31m> \033[1;37m$i\033[0m"
+		drop[$n]=$i
+		num_opc=$n
+		let n++	
+	done
+	back
+	opc=$(selection_fun $num_opc)
+	[[ $opc = 0 ]] && return 1
+	encab
+	echo -e "\033[1;33m Puerto de redireccion de trafico: \033[1;32m${drop[$opc]}"
+	msg -bar
+ while [[ -z $opc2 ]]; do
+	echo -ne "\033[1;37m Ingrese un puerto para WEBSOCKET: " && read opc2
+	tput cuu1 && tput dl1
+
+        [[ $(mportas|grep -w "${opc2}") = "" ]] && {
+        	echo -e "\033[1;33m $(fun_trans  "Puerto de websocket:")\033[1;32m ${opc2} OK"
+        	msg -bar
+        } || {
+        	echo -e "\033[1;33m $(fun_trans  "Puerto de websocket:")\033[1;31m ${opc2} FAIL" && sleep 2
+        	tput cuu1 && tput dl1
+        	unset opc2
+        }
+ done
+
+ 	while :
+ 	do
+	echo -ne "\033[1;37m Desea continuar [s/n]: " && read start
+	tput cuu1 && tput dl1
+	if [[ -z $start ]]; then
+		echo -e "\033[1;37m deves ingresar una opcion \033[1;32m[S] \033[1;37mpara Si \033[1;31m[n] \033[1;37mpara No." && sleep 2
+		tput cuu1 && tput dl1
+	else
+		[[ $start = @(n|N) ]] && break
+		if [[ $start = @(s|S) ]]; then
+			node_v="$(which nodejs)" && [[ $(ls -l ${node_v}|grep -w 'node') ]] && node_v="$(which node)"
+echo -e "[Unit]
+Description=P7COM-nodews1
+Documentation=https://p7com.net/
+After=network.target nss-lookup.target\n
+[Service]
+User=nobody
+CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
+AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
+NoNewPrivileges=true
+ExecStart=${node_v} /etc/ADMRufu/install/WS-Proxy.js -dhost 127.0.0.1 -dport ${drop[$opc]} -mport $opc2
+Restart=on-failure
+RestartSec=3s\n
+[Install]
+WantedBy=multi-user.target" > /etc/systemd/system/nodews.$opc2.service
+
+			systemctl enable nodews.$opc2 &>/dev/null
+			systemctl start nodews.$opc2 &>/dev/null
+			print_center -verd "Ejecucion con exito"
+			enter
+			break
+		fi
+	fi
+	done
+	return 1
+ }
+
+stop_ws () {
+	ck_ws=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "node")
+	if [[ -z $(echo "$ck_ws" | awk '{print $1}' | head -n 1) ]]; then
+		print_center -verm2 "WEBSOCKET no encontrado"
+	else
+		ck_port=$(echo "$ck_ws" | awk '{print $9}' | awk -F ":" '{print $2}')
+		for i in $ck_port; do
+			systemctl stop nodews.${i} &>/dev/null
+			systemctl disable nodews.${1} &>/dev/null
+			rm /etc/systemd/system/nodews.${i}.service &>/dev/null
+		done
+		print_center -verm2 "WEBSOCKET detenido"	
+	fi
+	enter
+	return 1
+ }
+
+ stop_port () {
+ 	clear
+	STWS=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep "node" | awk '{print $9}' | awk -F ":" '{print $2}')
+	title "DETENER UN PUERTO"
+ 	n=1
+	for i in $STWS; do
+		echo -e " \033[1;32m[$n] \033[1;31m> \033[1;37m$i\033[0m"
+		wspr[$n]=$i
+		let n++	
+	done
+ 	back
+ 	echo -ne "\033[1;37m opcion: " && read prws
+ 	tput cuu1 && tput dl1
+ 	[[ $prws = "0" ]] && return
+ 	systemctl stop nodews.${wspr[$prws]} &>/dev/null
+	systemctl disable nodews.${wspr[$prws]} &>/dev/null
+	rm /etc/systemd/system/nodews.${wspr[$prws]}.service &>/dev/null
+	print_center -verm2 "PUERTO WEBSOCKET ${wspr[$prws]} detenido"
+ 	enter
+	return 1
+ }
+
+encab(){
+	title "SSH OVER WEBSOCKET CDN CLOUDFLARE"
+ }
+
+encab
+menu_func "INICIAR/AGREGAR PROXY WS CDN" "DETENER PROXY WS CDN"
+
+sf=2
+[[ $(lsof -V -i tcp -P -n|grep -v "ESTABLISHED"|grep -v "COMMAND"|grep "node"|wc -l) -ge "2" ]] && echo -e "$(msg -verd " [3]") $(msg -verm2 ">") $(msg -azu "DETENER UN PUERTO")" && sf=3
+back
+selection=$(selection_fun ${sf})
+case ${selection} in
+	1) conf;;
+	2) stop_ws && read foo;;
+	3) stop_port;;
+	0)return 1;;
+esac

+ 0 - 0
R9/ADMRufu/main → R9/ADMRufu-31/main


+ 779 - 0
R9/ADMRufu-31/menu

@@ -0,0 +1,779 @@
+#!/bin/bash
+# -*- ENCODING: UTF-8 -*-
+rm -rf instalscript.sh &>/dev/null
+module="/etc/ADMRufu/module"
+[[ ! -e ${module} ]] && exit
+source ${module}
+
+export _hora=$(printf '%(%H:%M:%S)T') 
+export _fecha=$(printf '%(%D)T')
+
+export ADMRufu="/etc/ADMRufu" && [[ ! -d ${ADMRufu} ]] && mkdir ${ADMRufu}
+export ADM_inst="${ADMRufu}/install" && [[ ! -d ${ADM_inst} ]] && mkdir ${ADM_inst}
+export ADM_src="${ADMRufu}/source" && [[ ! -d ${ADM_src} ]] && mkdir ${ADM_src}
+export ADM_crt="${ADM_src}/cert" && [[ ! -d ${ADM_crt} ]] && mkdir ${ADM_crt}
+export ADM_slow="${ADM_src}/slowdns" && [[ ! -d ${ADM_slow} ]] && mkdir ${ADM_slow}
+export ADM_user="${ADMRufu}/user" && [[ ! -d ${ADM_user} ]] && mkdir ${ADM_user}
+export ADM_tmp="${ADMRufu}/tmp" && [[ ! -d ${ADM_tmp} ]] && mkdir ${ADM_tmp}
+export numero='^[0-9]+$'
+export letra='^[A-Za-z]+$'
+export tx_num='^[A-Za-z0-9]+$'
+
+export v2rdir="${ADMRufu}/v2r" && [[ ! -d ${v2rdir} ]] && mkdir ${v2rdir}
+export user_conf="${v2rdir}/user" && [[ ! -e $user_conf ]] && touch $user_conf
+export backdir="${v2rdir}/back" && [[ ! -d ${backdir} ]] && mkdir ${backdir}
+export tmpdir="$backdir/tmp"
+export config="/etc/v2ray/config.json"
+export temp="/etc/v2ray/temp.json"
+export fstab="/etc/fstab"
+export sysctl="/etc/sysctl.conf"
+export swap="/swapfile"
+
+#======cloudflare========
+export correo='tellooou@gmail.com'
+export _dns='2473a8a21bd6a727d7d6eed58a6751a0'
+export apikey='7928850c217279ed8c0227313d2f3c7c0d5ef'
+export _domain='admrufu.online'
+export url='https://api.cloudflare.com/client/v4/zones'
+#========================
+
+#PROCESSADOR
+export _core=$(printf '%-1s' "$(grep -c cpu[0-9] /proc/stat)")
+export _usop=$(printf '%-1s' "$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }')")
+
+#SISTEMA-USO DA CPU-MEMORIA RAM
+export ram1=$(free -h | grep -i mem | awk {'print $2'})
+export ram2=$(free -h | grep -i mem | awk {'print $4'})
+export ram3=$(free -h | grep -i mem | awk {'print $3'})
+
+export _ram=$(printf ' %-9s' "$(free -h | grep -i mem | awk {'print $2'})")
+export _usor=$(printf '%-8s' "$(free -m | awk 'NR==2{printf "%.2f%%", $3*100/$2 }')")
+
+if [[ ! -f ${ADM_tmp}/style ]]; then
+  echo -e "infsys 1\nport 0\nresel 0\ncontador 1\nlimit 0" > ${ADM_tmp}/style
+fi
+
+if [[ ! $(id -u) = 0 ]]; then
+	clear
+	msg -bar
+	print_center -ama "ERROR DE EJECUCION"
+	msg -bar
+	print_center -ama "DEVE EJECUTAR DESDE EL USUSRIO ROOT"
+	echo ''
+	print_center -ama 'TAMBIEN "sudo su"'
+	print_center -ama 'O BIEN'
+	print_center -ama '"sudo menu"'
+	msg -bar
+	exit
+fi
+
+if [[ ! $(cat '/etc/passwd'|grep 'root'|grep -v 'false'|awk -F ':' '{print $2}') = 'x' ]]; then
+	msg -bar
+	print_center -ama 'CAMBIO DE CONTRASEÑA ROOT REQUERIDO'
+	msg -bar
+	msg -ne " Ingrese la Nueva Contraseña: "
+	read opcion
+	pwconv
+	(echo "$opcion" ; echo "$opcion")|passwd root &>/dev/null
+	tput cuu1 && tput dl1
+	print_center -verd "SE CAMBIO LA CONTRASEÑA ROOT"
+	enter
+fi
+
+[[ ! -e "/var/spool/cron/crontabs/root" ]] && touch /var/spool/cron/crontabs/root
+
+#======BODY=========
+
+ in_opcion(){
+ 	msg -ne " $1: "
+ 	read opcion
+ }
+
+fun_trans(){ 
+	local texto
+	local retorno
+	declare -A texto
+	SCPidioma="${ADM_tmp}/idioma"
+	[[ ! -e ${SCPidioma} ]] && touch ${SCPidioma}
+	local LINGUAGE=$(cat ${SCPidioma})
+	[[ -z $LINGUAGE ]] && LINGUAGE=es
+	[[ $LINGUAGE = "es" ]] && echo "$@" && return
+	[[ ! -e /usr/bin/trans ]] && wget -O /usr/bin/trans https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/Herramientas-main/trans &> /dev/null
+	[[ ! -e ${ADM_tmp}/texto-adm ]] && touch ${ADM_tmp}/texto-adm
+	source ${ADM_tmp}/texto-adm
+	if [[ -z "$(echo ${texto[$@]})" ]]; then
+		#ENGINES=(aspell google deepl bing spell hunspell apertium yandex)
+		#NUM="$(($RANDOM%${#ENGINES[@]}))"
+		retorno="$(source trans -e bing -b es:${LINGUAGE} "$@"|sed -e 's/[^a-z0-9 -]//ig' 2>/dev/null)"
+		echo "texto[$@]='$retorno'"  >> ${ADM_tmp}/texto-adm
+		echo "$retorno"
+	else
+		echo "${texto[$@]}"
+	fi
+}
+
+mine_port(){
+	unset puertos
+	declare -A port
+	local portasVAR=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN" | grep -E 'squid|apache|dropbear|ssh|openvpn|stunnel|python|node|v2ray|badvpn-ud')
+	local NOREPEAT
+	local reQ
+	local Port
+	while read port; do
+		reQ=$(echo ${port}|awk '{print $1}')
+		Port=$(echo ${port} | awk '{print $9}' | awk -F ":" '{print $2}')
+		[[ $(echo -e $NOREPEAT|grep -w "$Port") ]] && continue
+		NOREPEAT+="$Port\n"
+		case ${reQ} in
+			squid|squid3)
+			[[ -z ${port[SQD]} ]] && local port[SQD]="\033[1;31m SQUID: \033[1;32m"
+			port[SQD]+="$Port ";;
+			apache|apache2)
+			[[ -z ${port[APC]} ]] && local port[APC]="\033[1;31m APACHE: \033[1;32m"
+			port[APC]+="$Port ";;
+			ssh|sshd)
+			[[ -z ${port[SSH]} ]] && local port[SSH]="\033[1;31m SSH: \033[1;32m"
+			port[SSH]+="$Port ";;
+			dropbear)
+			[[ -z ${port[DPB]} ]] && local port[DPB]="\033[1;31m DROPBEAR: \033[1;32m"
+			port[DPB]+="$Port ";;
+			ssserver|ss-server)
+			[[ -z ${port[SSV]} ]] && local port[SSV]="\033[1;31m SHADOWSOCKS: \033[1;32m"
+			port[SSV]+="$Port ";;
+			openvpn)
+			[[ -z ${port[OVPN]} ]] && local port[OVPN]="\033[1;31m OPENVPN(TCP): \033[1;32m"
+			port[OVPN]+="$Port ";;
+			stunnel4|stunnel)
+			[[ -z ${port[SSL]} ]] && local port[SSL]="\033[1;31m SSL: \033[1;32m"
+			port[SSL]+="$Port ";;
+			python|python3)
+			[[ -z ${port[PY3]} ]] && local port[PY3]="\033[1;31m PYTHON: \033[1;32m"
+			port[PY3]+="$Port ";;
+			node|nodejs)
+			[[ -z ${port[WS]} ]] && local port[WS]="\033[1;31m WEBSOCKET: \033[1;32m"
+			port[WS]+="$Port ";;
+			v2ray)
+			[[ -z ${port[V2R]} ]] && local port[V2R]="\033[1;31m V2RAY: \033[1;32m"
+			port[V2R]+="$Port ";;
+			badvpn-ud)
+			[[ -z ${port[BAD]} ]] && local port[BAD]="\033[1;31m BADVPN: \033[1;32m"
+			port[BAD]+="$Port ";;
+		esac
+	done <<< "${portasVAR}"
+
+	#UDP
+	local portasVAR=$(lsof -V -i UDP -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep -E 'openvpn|dns-serve|v2ray')
+	local NOREPEAT
+	local reQ
+	local Port
+	while read port; do
+		reQ=$(echo ${port}|awk '{print $1}')
+		Port=$(echo ${port} | awk '{print $9}' | awk -F ":" '{print $2}')
+		[[ $(echo -e $NOREPEAT|grep -w "$Port") ]] && continue
+		NOREPEAT+="$Port\n"
+		case ${reQ} in
+			openvpn)
+			[[ -z ${port[OVPN]} ]] && local port[OVPN]="\033[1;31m OPENVPN(UDP): \033[1;32m"
+			port[OVPN]+="$Port ";;
+			dns-serve)
+			[[ -z ${port[SLOW]} ]] && local port[SLOW]="\033[1;31m SlowDNS: \033[1;32m"
+			port[SLOW]+="$Port ";;
+			#v2ray)
+			#[[ -z ${port[V2R]} ]] && local port[V2R]="\033[1;31m V2RAY(UDP): \033[1;32m"
+			#port[V2R]+="$Port ";;
+		esac
+	done <<< "${portasVAR}"
+
+	k=1
+
+	for line in "${port[@]}"; do
+		[[ -z "$line" ]] && continue
+		let RESTO=k%2
+
+		if [[ $RESTO -eq 0 ]]; then
+			puertos+="$line\n"
+		else
+			puertos+="$line-"
+		fi
+		let k++
+
+	done
+
+	echo -e "$puertos"|column -t -s '-'
+
+}
+
+ofus () {
+  unset server
+  server=$(echo ${txt_ofuscatw}|cut -d':' -f1)
+  unset txtofus
+  number=$(expr length $1)
+  for((i=1; i<$number+1; i++)); do
+    txt[$i]=$(echo "$1" | cut -b $i)
+    case ${txt[$i]} in
+      ".")txt[$i]="*";;
+      "*")txt[$i]=".";;
+      "_")txt[$i]="@";;
+      "@")txt[$i]="_";;
+      #"1")txt[$i]="@";;
+      #"@")txt[$i]="1";;
+      #"2")txt[$i]="?";;
+      #"?")txt[$i]="2";;
+      #"4")txt[$i]="%";;
+      #"%")txt[$i]="4";;
+      "-")txt[$i]="K";;
+      "K")txt[$i]="-";;
+      "1")txt[$i]="f";;
+      "2")txt[$i]="e";;
+      "3")txt[$i]="d";;
+      "4")txt[$i]="c";;
+      "5")txt[$i]="b";;
+      "6")txt[$i]="a";;
+      "7")txt[$i]="9";;
+      "8")txt[$i]="8";;
+      "9")txt[$i]="7";;
+      "a")txt[$i]="6";;
+      "b")txt[$i]="5";;
+      "c")txt[$i]="4";;
+      "d")txt[$i]="3";;
+      "e")txt[$i]="2";;
+      "f")txt[$i]="1";;
+    esac
+    txtofus+="${txt[$i]}"
+  done
+  echo "$txtofus" | rev
+}
+
+fun_bar(){
+	comando="$1"
+	txt="$2"
+	_=$(
+	$comando > /dev/null 2>&1
+	) & > /dev/null
+	pid=$!
+	while [[ -d /proc/$pid ]]; do
+		echo -ne " \033[1;33m$txt["
+		for((i=0; i<10; i++)); do
+			echo -ne "\033[1;31m##"
+			sleep 0.2
+		done
+		echo -ne "\033[1;33m]"
+		sleep 1s
+		echo
+		tput cuu1 && tput dl1
+	done
+	echo -e " \033[1;33m$txt[\033[1;31m####################\033[1;33m] - \033[1;32m100%\033[0m"
+	sleep 1s
+}
+
+fun_ip(){
+  if [[ -e ${ADM_tmp}/MEUIPADM ]]; then
+    echo "$(cat ${ADM_tmp}/MEUIPADM)"
+  else
+    MEU_IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
+    MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
+    [[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" && echo "$MEU_IP2" || IP="$MEU_IP" && echo "$MEU_IP"
+    echo "$MEU_IP2" > ${ADM_tmp}/MEUIPADM
+  fi
+}
+
+fun_eth(){
+	eth=$(ifconfig | grep -v inet6 | grep -v lo | grep -v 127.0.0.1 | grep "encap:Ethernet" | awk '{print $1}')
+    [[ $eth != "" ]] && {
+    	msg -bar
+    	msg -ama " $(fun_trans "Aplicar el sistema para mejorar los paquetes SSH?")"
+    	msg -ama " $(fun_trans "Opciones para usuarios avanzados")"
+    	msg -bar
+    	read -p " [S/N]: " -e -i n sshsn
+    	[[ "$sshsn" = @(s|S|y|Y) ]] && {
+    		echo -e "${cor[1]} $(fun_trans "Correccion de problemas de paquetes en SSH ...")"
+            echo -e " $(fun_trans "¿Cual es la tasa RX?")"
+            echo -ne "[ 1 - 999999999 ]: "; read rx
+            [[ "$rx" = "" ]] && rx="999999999"
+            echo -e " $(fun_trans "¿Cual es la tasa TX?")"
+            echo -ne "[ 1 - 999999999 ]: "; read tx
+            [[ "$tx" = "" ]] && tx="999999999"
+            apt-get install ethtool -y > /dev/null 2>&1
+            ethtool -G $eth rx $rx tx $tx > /dev/null 2>&1
+        }
+        msg -bar
+    }
+}
+
+mportas2(){
+	unset portas
+	portas_var=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
+	while read port; do
+		var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
+		[[ "$(echo -e $portas|grep "$var1 $var2")" ]] || portas+="$var1 $var2\n"
+	done <<< "$portas_var"
+	i=1
+	echo -e "$portas"
+}
+
+mportas(){
+	unset portas
+	portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND")
+	while read port; do
+		var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
+		[[ "$(echo -e $portas|grep "$var1 $var2")" ]] || portas+="$var1 $var2\n"
+	done <<< "$portas_var"
+	i=1
+	echo -e "$portas"
+}
+
+
+os_system(){
+  system=$(echo $(cat -n /etc/issue |grep 1 |cut -d' ' -f6,7,8 |sed 's/1//' |sed 's/      //'))
+  echo $system|awk '{print $1, $2}'
+}
+
+reiniciar_vps () {
+  echo -ne " \033[1;31m[ ! ] Sudo Reboot"
+  sleep 3s
+  echo -e "\033[1;32m [OK]"
+  (
+    sudo reboot
+    ) > /dev/null 2>&1
+  msg -bar
+  return
+}
+
+# Menu Ferramentas
+systen_info(){
+  msg -ama "$(fun_trans "DETALLES DEL SISTEMA")"
+  null="\033[1;31m"
+  msg -bar
+  if [ ! /proc/cpuinfo ]; then msg -verm "$(fun_trans "Sistema No Soportado")" && msg -bar; return 1; fi
+  if [ ! /etc/issue.net ]; then msg -verm "$(fun_trans "Sistema No Soportado")" && msg -bar; return 1; fi
+  if [ ! /proc/meminfo ]; then msg -verm "$(fun_trans "Sistema No Soportado")" && msg -bar; return 1; fi
+  totalram=$(free | grep Mem | awk '{print $2}')
+  usedram=$(free | grep Mem | awk '{print $3}')
+  freeram=$(free | grep Mem | awk '{print $4}')
+  swapram=$(cat /proc/meminfo | grep SwapTotal | awk '{print $2}')
+  system=$(cat /etc/issue.net)
+  clock=$(lscpu | grep "CPU MHz" | awk '{print $3}')
+  based=$(cat /etc/*release | grep ID_LIKE | awk -F "=" '{print $2}')
+  processor=$(cat /proc/cpuinfo | grep "model name" | uniq | awk -F ":" '{print $2}')
+  cpus=$(cat /proc/cpuinfo | grep processor | wc -l)
+  [[ "$system" ]] && msg -ama "$(fun_trans "Sistema"): ${null}$system" || msg -ama "$(fun_trans "Sistema"): ${null}???"
+  [[ "$based" ]] && msg -ama "$(fun_trans "Base"): ${null}$based" || msg -ama "$(fun_trans "Base"): ${null}???"
+  [[ "$processor" ]] && msg -ama "$(fun_trans "Procesador"): ${null}$processor x$cpus" || msg -ama "$(fun_trans "Procesador"): ${null}???"
+  [[ "$clock" ]] && msg -ama "$(fun_trans "Frecuencia de Operacion"): ${null}$clock MHz" || msg -ama "$(fun_trans "Frecuencia de Operacion"): ${null}???"
+  msg -ama "$(fun_trans "Uso del Procesador"): ${null}$(ps aux  | awk 'BEGIN { sum = 0 }  { sum += sprintf("%f",$3) }; END { printf " " "%.2f" "%%", sum}')"
+  msg -ama "$(fun_trans "Memoria Virtual Total"): ${null}$(($totalram / 1024))"
+  msg -ama "$(fun_trans "Memoria Virtual En Uso"): ${null}$(($usedram / 1024))"
+  msg -ama "$(fun_trans "Memoria Virtual Libre"): ${null}$(($freeram / 1024))"
+  msg -ama "$(fun_trans "Memoria Virtual Swap"): ${null}$(($swapram / 1024))MB"
+  msg -ama "$(fun_trans "Tempo Online"): ${null}$(uptime)"
+  msg -ama "$(fun_trans "Nombre De La Maquina"): ${null}$(hostname)"
+  msg -ama "$(fun_trans "IP De La  Maquina"): ${null}$(ip addr | grep inet | grep -v inet6 | grep -v "host lo" | awk '{print $2}' | awk -F "/" '{print $1}')"
+  msg -ama "$(fun_trans "Version de Kernel"): ${null}$(uname -r)"
+  msg -ama "$(fun_trans "Arquitectura"): ${null}$(uname -m)"
+  msg -bar
+  return 0
+}
+
+# Menu Instalaciones
+pid_inst(){
+	[[ $1 = "" ]] && echo -e "\033[1;31m[OFF]" && return 0
+	unset portas
+	portas_var=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND")
+	i=0
+	while read port; do
+		var1=$(echo $port | awk '{print $1}') && var2=$(echo $port | awk '{print $9}' | awk -F ":" '{print $2}')
+		[[ "$(echo -e ${portas[@]}|grep "$var1 $var2")" ]] || {
+			portas[$i]="$var1 $var2\n"
+			let i++
+		}
+	done <<< "$portas_var"
+	[[ $(echo "${portas[@]}"|grep "$1") ]] && echo -e "\033[1;32m[ON]" || echo -e "\033[1;31m[OFF]"
+}
+
+info_sys(){
+	#v=$(date '+%s' -d $(cat $ADMRufu/vercion)))
+	info_so=$(printf '%-17s' "$(os_system)")
+	info_ip=$(printf '%-18s' "$(fun_ip)")
+	info_ram1=$(printf '%-7s' "${ram1}")
+	info_ram2=$(printf '%-7s' "${ram2}")
+	info_ram3=$(printf '%-7s' "${ram3}")
+	info_fecha=$(printf '%-15s' "${_fecha}")
+	info_hora=$(printf '%-15s' "${_hora}")
+
+	systema=$(printf '%-23s' 'SISTEMA')
+	systema+=$(printf '%-16s' 'MEMORIA')
+	systema+='PROSESADOR'
+
+	msg -verd " $systema"
+
+	echo -e " $(msg -teal "S.O:") $(msg -azu "$info_so") $(msg -teal "RAM:")    $(msg -verd "$info_ram1") $(msg -teal "CPU:") $(msg -verd "$_core")"
+	echo -e " $(msg -teal "IP:") $(msg -azu "$info_ip") $(msg -teal "USADA:")  $(msg -verd "$info_ram3") $(msg -teal "EN USO:")$(msg -verd "$_usop")"
+	echo -e " $(msg -teal "FECHA:") $(msg -azu "$info_fecha") $(msg -teal "LIBRE:")  $(msg -verd "$info_ram2")"
+	echo -e " $(msg -teal "HORA:")  $(msg -azu "$info_hora") $(msg -teal "EN USO:") $(msg -verd "$_usor")"
+}
+
+cabesera(){
+	msg -bar
+	print_center -azu "=====>>>> ADMRufu <<<<====="|lolcat
+	msg -bar
+}
+
+droppids(){
+  port_dropbear=`ps aux|grep 'dropbear'|awk NR==1|awk '{print $17;}'`
+
+  log=/var/log/auth.log
+  loginsukses='Password auth succeeded'
+
+  pids=`ps ax|grep 'dropbear'|grep " $port_dropbear"|awk -F " " '{print $1}'`
+
+  for pid in $pids; do
+    pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'`
+
+    i=0
+    for pidend in $pidlogs; do
+      let i=i+1
+    done
+
+    if [ $pidend ];then
+       login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"`
+       PID=$pid
+       user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"`
+       waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'`
+       while [ ${#waktu} -lt 13 ]; do
+           waktu=$waktu" "
+       done
+       while [ ${#user} -lt 16 ]; do
+           user=$user" "
+       done
+       while [ ${#PID} -lt 8 ]; do
+           PID=$PID" "
+       done
+       echo "$user $PID $waktu"
+    fi
+done
+}
+
+contador(){
+	users=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|awk -F ':' '{print $1}')
+	dpids=$(droppids)
+	time=$(date +%s)
+	[[ -e /etc/openvpn/openvpn-status.log ]] && ovpn_log=$(cat /etc/openvpn/openvpn-status.log)
+
+	n='0'
+	i='0'
+	conect='0'
+	for _user in $users; do
+		[[ -z "$(ps -u $_user|grep sshd)" ]] && sqd=0 || sqd=1
+		[[ -z "$(echo $ovpn_log|grep -E ,"$_user",)" ]] && ovp=0 || ovp=1
+        [[ -z "$(echo $dpids|grep -w "$_user")" ]] && drop=0 || drop=1
+
+        conex=$(($sqd + $ovp + $drop))
+        [[ $conex -ne 0 ]] && let conect++
+
+		if [[ $(chage -l $_user |grep 'Account expires' |awk -F ': ' '{print $2}') != never ]]; then
+			[[ $time -gt $(date '+%s' -d "$(chage -l $_user |grep "Account expires" |awk -F ': ' '{print $2}')") ]] && let n++
+		fi
+		[[ $(passwd --status $_user|cut -d ' ' -f2) = "L" ]] && let i++
+	done
+
+	_onlin=$(printf '%-7s' "$conect")
+	_userexp=$(printf '%-7s' "$n")
+	_lok=$(printf '%-7s' "$i")
+	_tuser=$(echo "$users"|sed '/^$/d'|wc -l)
+
+	echo -e " $(msg -verd "ONLI:") $(msg -azu "$_onlin") $(msg -verm2 "EXP:") $(msg -azu "$_userexp") $(msg -teal "LOK:") $(msg -azu "$_lok") $(msg -ama "TOTAL:") $(msg -azu "$_tuser")"
+}
+
+lou(){
+  source <(echo -e "$(cat /etc/bash.bashrc)\nTMOUT=1")
+}
+
+ULK_ALF(){
+	title "Desactivar contraseñas Alfanumericas"
+	msg -ama " Esto desactivara el uso de contraseñas Alfanumericas\n en vps de VULTR, y otros. Permitiendo usar cualquier\n combinacion de caracteres mayor a 4 digitos."
+	msg -bar
+	msg -ne " Continuar? [S/N]: "
+	read opcion
+	[[ "$opcion" != @(s|S|y|Y) ]] && return
+	tput cuu1 && tput dl1
+	apt-get install libpam-cracklib -y > /dev/null 2>&1
+	echo -e '#
+password [success=1 default=ignore] pam_unix.so obscure sha512
+password requisite pam_deny.so
+password required pam_permit.so' > /etc/pam.d/common-password
+    chmod +x /etc/pam.d/common-password
+    print_center -verd "Contraseña Alfanumerica Desactivada"
+    msg -bar
+    print_center -ama "►► Presione enter para continuar ◄◄"
+    read
+}
+
+backup(){
+
+	bkusr(){
+    all_user=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog')
+    all_name=('' $(echo "$all_user"|awk -F ':' '{print $1}'))
+		clear
+		msg -bar
+		if [[ -z ${all_name[@]} ]]; then
+			print_center -ama "No se encontraron usuarios"
+			msg -bar
+			enter
+			return
+		fi
+		print_center -ama "CREANDO COPIA DE SEGURIDAD"
+		msg -bar
+		sleep 2
+		local userback
+		for u in `echo ${all_name[@]}`; do
+      dat=$(echo "$all_user"|grep -w "$u"|cut -d ':' -f5)
+      Limit_mode=$(echo "$dat"|cut -d ',' -f1)
+      case $Limit_mode in
+        token)pass=$(cat ${ADM_user}/passwd_token);;
+         hwid)pass="$u";;
+            *)pass=$(echo "$dat"|cut -d ',' -f2);;
+      esac
+			fecha=$(chage -l "$u"|sed -n '4p'|awk -F ': ' '{print $2}')
+			EXPTIME="$(($(($(date '+%s' -d "${fecha}") - $(date +%s))) / 86400))"
+			stat=$(passwd --status $u|cut -d ' ' -f2)
+      userback+="$u|$pass|$EXPTIME|$dat|$stat\n"
+		done
+		echo -e "$userback" > ${ADM_tmp}/userback.txt
+    echo -e "$userback" > /root/userback.txt
+		openssl enc -aes-128-cbc -salt -in ${ADM_tmp}/userback.txt -pass pass:ADMRufu -out ${ADM_tmp}/userback.enc > /dev/null 2>&1
+		mv ${ADM_tmp}/userback.enc /root/user_$(printf '%(%d-%m-%y_%H:%M:%S)T').ADMRufu
+		rm ${ADM_tmp}/userback.txt
+		print_center -verd "Copia de seguridad creada."
+		enter
+		return
+	}
+
+  restor(){
+    openssl enc -aes-128-cbc -d -in ${ADM_tmp}/userback.enc -pass pass:ADMRufu -out ${ADM_tmp}/userback.txt &>/dev/null 2>&1
+    msg -nama " Eliminar todos los usuarios? [S/N]: " && read del_all
+    [[ "$del_all" != @(S|s) ]] && msg -nama " Sobrescrivir usuarios exixtentes? [S/N]: " && read reset_user
+    all_user=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog')
+    if [[ "$del_all" = @(S|s) ]]; then
+      service dropbear stop &>/dev/null
+      service sshd stop &>/dev/null
+      service ssh stop &>/dev/null
+      service stunnel4 stop &>/dev/null
+      service squid stop &>/dev/null
+      title -ama "ELIMINADO TODOS LO USUARIOS...."
+      for user_d in `echo "$all_user"|awk -F ':' '{print $1}'`; do
+        userpid=$(ps -u $user_d |awk {'print $1'})
+        kill "$userpid" 2>/dev/null
+        userdel --force $user_d
+      done
+      service sshd restart &>/dev/null
+      service ssh restart &>/dev/null
+      service dropbear start &>/dev/null
+      service stunnel4 start &>/dev/null
+      service squid restart &>/dev/null
+    fi
+    clear
+    msg -bar
+    print_center -ama "RESTAURANDO COPIA"
+    msg -bar
+    all_name=($(echo "$all_user"|awk -F ':' '{print $1}'))
+    while read line; do
+      user=$(echo $line|cut -d '|' -f1)
+      pass=$(echo $line|cut -d '|' -f2)
+
+      dias=$(( $(echo $line|cut -d '|' -f3) + 1 ))
+
+      if [[ "$dias" -lt 1 ]]; then dias=0 ;fi
+
+      dat=$(echo $line|cut -d '|' -f4)
+      stat=$(echo $line|cut -d '|' -f5)
+
+      if [[ $(echo "${all_name[@]}"|grep "$user") = "" ]]; then
+        valid=$(date '+%C%y-%m-%d' -d " +$dias days")
+        msg -nama " $user"
+        if useradd -M -s /bin/false -e ${valid} -K PASS_MAX_DAYS=$dias -p $(openssl passwd -6 $pass) -c $dat $user ; then
+          [[ "$stat" = "P" ]] && usermod -U $user || usermod -L $user
+          msg -verd " $(fun_trans "Restaurado")"
+        else
+          msg -verm2 " $(fun_trans "NO, Usuario no Restaurado")"
+        fi 
+      else
+        if [[ "$reset_user" = @(S|s) ]]; then
+          userpid=$(ps -u $user |awk {'print $1'})
+          kill "$userpid" 2>/dev/null
+          userdel --force $user
+          if useradd -M -s /bin/false -e ${valid} -K PASS_MAX_DAYS=$dias -p $(openssl passwd -6 $pass) -c $dat $user ; then
+            [[ "$stat" = "P" ]] && usermod -U $user || usermod -L $user
+            msg -verd " $(fun_trans "Restaurado")"
+          else
+            msg -verm2 " $(fun_trans "NO, Usuario no Restaurado")"
+          fi
+        else
+            echo -e " $(msg -ama "$user") $(msg -verm2 "Ya Existe")"
+        fi
+      fi
+    done <<< $(cat "${ADM_tmp}/userback.txt")
+
+    rm ${ADM_tmp}/userback.enc
+    rm ${ADM_tmp}/userback.txt
+    enter
+
+  }
+
+	rsurs(){
+		clear
+		msg -bar
+		print_center -ama "RESTAURAR COPIA DE SEGURIDAD"
+		msg -bar
+		n=0
+		for i in ${backls[@]}; do
+      let n++
+			echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -azu "$i")"
+		done
+		back
+    opcion=$(selection_fun $n)
+		[[ "$opcion" = "0" ]] && return
+		let opcion--
+		cp /root/${backls[$opcion]} ${ADM_tmp}/userback.enc
+    restor
+    return
+	}
+
+	clbk(){
+		rm -rf /root/*.ADMRufu
+		clear
+		msg -bar
+		print_center -ama "REGITRO DE COPIAS ELIMINADO"
+		enter
+	}
+
+  rest_online(){
+    title -ama "URL DE COPIA EN LINEA"
+    echo -e " $(msg -verm3 "╭╼╼╼╼╼╼╼╼╼╼╼╼╼╼╼╼[")$(msg -azu "INGRESA EL URL")$(msg -verm3 "]")"
+    echo -ne " $(msg -verm3 "╰╼")\033[37;1m> " && read url
+    [[ -z "$url" ]] && return
+    wget -O ${ADM_tmp}/userback.enc "${url}" &>/dev/null; chmod +x ${ADM_tmp}/userback.enc
+    restor
+    return
+  }
+
+	backls=($(ls /root|grep '.ADMRufu'))
+	var="${#backls[@]}"
+	[[ ${var} = "0" ]] && bkusr && return
+	title "RESPALDO DE USUARIOS"
+	menu_func "CREAR NUEVO RESPALDO DE USUARIOS" "RESTAURAR RESPALDO DE USUARIOS" "RESPALDO EN LINEA $(msg -verm2 "beta")" "LIMPIAR REGISTRO DE COPIAS"
+	back
+	msg -ne " opcion: "
+	read opcion
+	case $opcion in
+		1)bkusr;;
+		2)rsurs;;
+		3)rest_online;;
+		4)clbk;;
+		0)return;;
+	esac
+}
+
+remove_script(){
+	title "REMOVER SCRIPT ADMRufu"
+	in_opcion "Remover script [S/N]"
+	[[ "$opcion" != @(s|S|y|Y) ]] && return
+	sed -i '/Rufu/d' /root/.bashrc
+	sed -i '/Rufu/d' /etc/bash.bashrc
+	rm -rf /usr/bin/menu
+	rm -rf /usr/bin/adm
+	rm -rf /usr/bin/ADMRufu
+	rm -rf /etc/ADMRufu
+	echo "SCRIPT REMOVIDO, REINICIANDO VPS"
+	sleep 5
+	reboot
+}
+
+update(){
+	title "ESTA POR ACTUALIZAR ADMRufu"
+	print_center -ama "Para actualizar ADMRufu, requiere de una key"
+	msg -bar
+	in_opcion "DESA CONTINUAR [S/N]"
+
+	if [[ "$opcion" = @(s|S|y|Y) ]]; then
+		rm -rf /root/install.sh*
+		wget -O /root/install.sh https://raw.githubusercontent.com/NetVPS/VPS-MX_Oficial/master/Instalador/Install-Sin-Key.sh &>/dev/null
+		chmod +x /root/install.sh*
+		/root/install.sh --update
+	fi
+}
+
+acount_mode(){
+	[[ ! -e ${ADM_user}/userMODE ]] && echo "userSSH" > ${ADM_user}/userMODE
+	mode=$(cat ${ADM_user}/userMODE)
+	case $mode in
+		userSSH)${ADM_inst}/userSSH;;
+		userHWID)${ADM_inst}/userHWID;;
+		userTOKEN)${ADM_inst}/userTOKEN;;
+	esac
+}
+
+# EXECUCION DE MENU
+export -f fun_trans
+export -f fun_ip
+export -f info_sys
+export -f mine_port
+export -f os_system
+export -f fun_bar
+export -f fun_eth
+export -f mportas
+export -f in_opcion
+export -f droppids
+export -f backup
+export -f ULK_ALF
+clear
+#########VISUALIZACION DE MENU
+cabesera
+if [[ $(cat ${ADM_tmp}/style|grep -w "infsys"|awk '{print $2}') = "1" ]] ; then
+  info_sys
+  msg -bar
+fi
+
+if [[ $(cat ${ADM_tmp}/style|grep -w "port"|awk '{print $2}') = "1" ]] ; then
+  mine_port
+  msg -bar
+fi
+
+if [[ $(cat ${ADM_tmp}/style|grep -w "resel"|awk '{print $2}') = "1" ]] ; then
+  echo -e "\033[1;34m $(cat ${ADM_tmp}/message.txt)\033[0m"
+  msg -bar
+fi
+
+if [[ $(cat ${ADM_tmp}/style|grep -w "contador"|awk '{print $2}') = "1" ]] ; then
+  contador
+  msg -bar
+fi
+
+v=$(cat $ADMRufu/vercion)
+up=$v && [[ -e "$ADMRufu/new_vercion" ]] && up=$(cat $ADMRufu/new_vercion)
+
+menu_func "ADMINISTRAR CUENTAS (SSH/DROPBEAR)" \
+"-bar3 ADMINISTRAR CUENTAS (V2ray)" \
+"-bar3 \033[1;100mPREPARACION DEL SISTEMA\033[0m" \
+"-vm DESINSTALAR PANEL"
+
+r='5'; u='u'
+if [[ "$(date '+%s' -d "$up")" -gt "$(date '+%s' -d "$v")" ]]; then
+	msg -bar3
+	r='6'; u='5'
+	echo -e "$(msg -verd " [$u]") $(msg -verm2 ">") $(msg -azu "ACTUALIZAR:") $(msg -ama "$v") $(msg -verm2 ">>>") $(msg -verd "$up")"
+fi
+msg -bar && echo -ne "$(msg -verd " [0]") $(msg -verm2 ">") $(msg -bra "\033[1;41m SALIR DEL SCRIPT ")" && echo -e "$(msg -verd " [$r]") $(msg -verm2 ">") $(msg -bra "\033[1;44m REINICIAR VPS \033[0m")"
+msg -bar
+selection=$(selection_fun -nama $r)
+
+case ${selection} in
+	1)acount_mode;;
+	2)${ADM_inst}/userV2ray.sh;;
+	3)${ADMRufu}/menu_inst.sh;;
+	4)remove_script;;
+ "$r")reiniciar_vps;;
+ "$u")update;;
+	0)clear && cd $HOME && exit 0;;
+esac
+${ADMRufu}/menu
+

+ 363 - 0
R9/ADMRufu-31/menu_inst.sh

@@ -0,0 +1,363 @@
+#!/bin/bash
+
+cache_ram() {
+  clear
+  msg -bar
+  msg -ama  "          REFRESCANDO CACHE Y RAM"
+  msg -bar
+  (
+    VE="\033[1;33m" && MA="\033[1;31m" && DE="\033[1;32m"
+
+    while [[ ! -e /tmp/abc ]]; do
+      A+="#"
+      echo -e "${VE}[${MA}${A}${VE}]" >&2
+      sleep 0.3s
+      tput cuu1 && tput dl1
+    done
+
+    echo -e "${VE}[${MA}${A}${VE}] - ${DE}[100%]" >&2
+    rm /tmp/abc
+    ) &
+
+  echo 3 > /proc/sys/vm/drop_caches &>/dev/null
+  sleep 1s
+  sysctl -w vm.drop_caches=3 &>/dev/null
+  apt-get autoclean -y &>/dev/null
+  sleep 1s
+  apt-get clean -y &>/dev/null
+  rm /tmp/* &>/dev/null
+  touch /tmp/abc
+  sleep 0.5s
+  msg -bar
+  msg -verd "       Cache/Ram limpiada con Exito!"
+  msg -bar
+
+  if [[ ! -z $(crontab -l|grep -w "vm.drop_caches=3") ]]; then
+    msg -azu " Tarea programada cada $(msg -verd "[ $(crontab -l|grep -w "vm.drop_caches=3"|awk '{print $2}'|sed $'s/[^[:alnum:]\t]//g')HS ]")"
+    msg -bar
+    while :
+    do
+    echo -ne "$(msg -azu " Quitar tarea programada [S/N]: ")" && read t_ram
+    tput cuu1 && tput dl1
+    case $t_ram in
+      s|S) crontab -l > /root/cron && sed -i '/vm.drop_caches=3/ d' /root/cron && crontab /root/cron && rm /root/cron
+           msg -azu " Tarea automatica removida!" && msg -bar && sleep 2
+           return 1;;
+      n|N)return 1;;
+      *)msg -azu " Selecciona S para si, N para no" && sleep 2 && tput cuu1 && tput dl1;;
+    esac
+    done
+  fi 
+
+  echo -ne "$(msg -azu "Desea programar una tarea automatica [s/n]:") "
+  read c_ram
+  if [[ $c_ram = @(s|S|y|Y) ]]; then
+    tput cuu1 && tput dl1
+    echo -ne "$(msg -azu " PERIODO DE EJECUCION DE LA TAREA [1-12HS]:") "
+    read ram_c
+    if [[ $ram_c =~ $numero ]]; then
+      crontab -l > /root/cron
+      echo "0 */$ram_c * * * sudo sysctl -w vm.drop_caches=3 > /dev/null 2>&1" >> /root/cron
+      crontab /root/cron
+      rm /root/cron
+      tput cuu1 && tput dl1
+      msg -azu " Tarea automatica programada cada: $(msg -verd "${ram_c}HS")" && msg -bar && sleep 2
+    else
+      tput cuu1 && tput dl1
+      msg -verm2 " ingresar solo numeros entre 1 y 12"
+      sleep 2
+      msg -bar
+    fi
+  fi
+  return 1
+}
+
+new_banner(){
+  clear
+  local="/etc/bannerssh"
+  chk=$(cat /etc/ssh/sshd_config | grep Banner)
+  if [ "$(echo "$chk" | grep -v "#Banner" | grep Banner)" != "" ]; then
+    local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
+  else
+    echo "" >> /etc/ssh/sshd_config
+    echo "Banner /etc/bannerssh" >> /etc/ssh/sshd_config
+    local="/etc/bannerssh"
+  fi
+  title -ama "Instalador del BANNER-SSH/DROPBEAR"
+  in_opcion_down "Escriba el BANNER de preferencia en HTML"
+  msg -bar
+  if [[ "${opcion}" ]]; then
+    rm -rf $local  > /dev/null 2>&1
+    echo "$opcion" > $local
+    [[ ! -e ${ADM_tmp}/message.txt ]] && echo "@Rufu99" > ${ADM_tmp}/message.txt
+    credi="$(less ${ADM_tmp}/message.txt)"
+    echo '<h4 style=text-align:center><font color="#00FF40">A</font><font color="#00FFBF">D</font><font color="#00FFFF">M</font><font color="#00FFFF">R</font><font color="#2ECCFA">u</font><font color="#2E9AFE">f</font><font color="#819FF7">u</font><br><font color="#819FEB">'$credi'</font></h4>' >> $local
+    service sshd restart 2>/dev/null
+    service dropbear restart 2>/dev/null
+    print_center -verd "Banner Agregado!!!"
+    enter
+    return 1
+  fi
+  print_center -ama "Edicion de Banner Canselada!"
+  enter
+  return 1
+}
+
+banner_edit(){
+  clear
+  chk=$(cat /etc/ssh/sshd_config | grep Banner)
+  local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
+  nano $local
+  service sshd restart 2>/dev/null
+  service dropbear restart 2>/dev/null
+  msg -bar
+  print_center -ama "Edicion de Banner Terminada!"
+  enter
+  return 1
+}
+
+banner_reset(){
+  clear
+  chk=$(cat /etc/ssh/sshd_config | grep Banner)
+  local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
+  rm -rf $local
+  touch $local
+  service sshd restart 2>/dev/null
+  service dropbear restart 2>/dev/null
+  msg -bar
+  print_center -ama "EL BANNER SSH FUE LIMPIADO"
+  enter
+  return 1
+}
+
+baner_fun(){
+  chk=$(cat /etc/ssh/sshd_config | grep Banner)
+  local=$(echo "$chk" |grep -v "#Banner" | grep Banner | awk '{print $2}')
+  n=1
+  title -ama "MENU DE EDICION DE BANNER SSH"
+  echo -e " $(msg -verd "[1]") $(msg -verm2 ">") $(msg -azu "NUEVO BANNER SSH")"
+  if [[ -e "${local}" ]]; then
+    echo -e " $(msg -verd "[2]") $(msg -verm2 ">") $(msg -azu "EDITAR BANNER CON NANO")"
+    echo -e " $(msg -verd "[3]") $(msg -verm2 ">") $(msg -azu "RESET BANNER SSH")"
+    n=3
+  fi
+  back
+  opcion=$(selection_fun $n)
+  case $opcion in
+    1)new_banner;;
+    2)banner_edit;;
+    3)banner_reset;;
+    0)return 1;;
+  esac
+}
+
+fun_autorun () {
+  clear
+  msg -bar
+if [[ $(cat /etc/bash.bashrc | grep -w ${ADMRufu}/menu) ]]; then
+  cat /etc/bash.bashrc | grep -v ${ADMRufu}/menu > /tmp/bash
+  mv -f /tmp/bash /etc/bash.bashrc
+  msg -ama "               $(fun_trans "AUTO-INICIO REMOVIDO")"
+  msg -bar
+else
+  cp /etc/bash.bashrc /tmp/bash
+  echo "${ADMRufu}/menu" >> /tmp/bash
+  mv -f /tmp/bash /etc/bash.bashrc
+  msg -verd "              $(fun_trans "AUTO-INICIO AGREGADO")"
+  msg -bar
+fi
+return 1
+}
+
+#       comfiguracion menu principal
+#==================================================
+
+C_MENU2(){
+  unset m_conf
+  m_conf="$(cat ${ADM_tmp}/style|grep -w "$1"|awk '{print $2}')"
+
+  case $m_conf in
+    0)sed -i "s;$1 0;$1 1;g" ${ADM_tmp}/style;;
+    1)sed -i "s;$1 1;$1 0;g" ${ADM_tmp}/style;;
+  esac
+}
+
+c_stat(){
+  unset m_stat
+  m_stat="$(cat ${ADM_tmp}/style|grep -w "$1"|awk '{print $2}')"
+  case $m_stat in
+    0)msg -verm2 "[OFF]";;
+    1)msg -verd "[ON]";;
+  esac
+}
+
+c_resel(){
+  clear
+  msg -bar
+  msg -ama "               CAMBIAR RESELLER"
+  msg -bar
+  echo -ne "$(msg -azu " CAMBIAR RESELLER [S/N]:") "
+  read txt_r
+  if [[ $txt_r = @(s|S|y|Y) ]]; then
+    tput cuu1 && tput dl1
+    echo -ne "$(msg -azu " ESCRIBE TU RESELLER:") "
+    read r_txt
+    echo -e "$r_txt" > ${ADM_tmp}/message.txt
+  fi
+  C_MENU2 resel
+}
+
+conf_menu(){
+  while :
+  do
+    clear
+    msg -bar
+    msg -ama "        CONFIGURACION DEL MENU PRINCIPAL"
+    msg -bar
+    echo -ne "$(msg -verd "  [1]") $(msg -verm2 ">") " && msg -azu "INF SISTEMA (SYS/MEM/CPU) $(c_stat infsys)"
+    echo -ne "$(msg -verd "  [2]") $(msg -verm2 ">") " && msg -azu "PUERTOS ACTIVOS           $(c_stat port)"
+    echo -ne "$(msg -verd "  [3]") $(msg -verm2 ">") " && msg -azu "RESELLER                  $(c_stat resel)"
+    echo -ne "$(msg -verd "  [4]") $(msg -verm2 ">") " && msg -azu "CONTADOR (Only/Exp/Total) $(c_stat contador)"
+    msg -bar
+    echo -ne "$(msg -verd "  [0]") $(msg -verm2 ">") " && msg -bra "   \033[1;41m VOLVER \033[0m"
+    msg -bar
+    echo -ne "$(msg -azu " opcion: ")"
+    read C_MENU
+
+    case $C_MENU in
+      1)C_MENU2 infsys;;
+      2)C_MENU2 port;;
+      3)c_resel;; #C_MENU2 resel;;
+      4)C_MENU2 contador;;
+      0)break;;
+      esac
+  done
+  return 0
+}
+#================================================
+
+root_acces () {
+	sed -i '/PermitRootLogin/d' /etc/ssh/sshd_config
+	echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
+
+	sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config
+	echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config
+
+	service sshd restart
+}
+
+root_pass () {
+  clear
+  msg -bar
+  [[ -z $1 ]] && msg -ama "             CAMBIAR CONTRASEÑA ROOT" || msg -ama "               ACTIVAR ACCESO ROOT"
+  msg -bar
+  msg -azu "    Esto cambiara la contraseña de acceso root"
+  msg -bar3
+  msg -azu "    Esta contraseña podra ser utilizada para\n    acceder al vps como usuario root."
+  msg -bar
+  echo -ne " $(msg -azu "Cambiar contraseña root? [S/N]:") "; read x
+  tput cuu1 && tput dl1
+  [[ $x = @(n|N) ]] && msg -bar && return
+  if [[ ! -z $1 ]]; then
+    msg -azu "    Activando acceso root..."
+    root_acces
+    sleep 3
+    tput cuu1 && tput dl1
+    msg -azu "    Acceso root Activado..."
+    msg -bar
+  fi
+  echo -ne "\033[1;37m Nueva contraseña: \033[0;31m"
+  read pass
+  tput cuu1 && tput dl1
+  (echo $pass; echo $pass)|passwd root 2>/dev/null
+  sleep 1s
+  msg -azu "    Contraseña root actulizada!"
+  msg -azu "    Contraseña actual:\033[0;31m $pass"
+  msg -bar
+  enter
+  return 1
+}
+
+pid_inst(){
+  v_node="$(which nodejs)" && [[ $(ls -l ${node_v}|grep -w 'node') ]] && v_node="nodejs" || v_node="node"
+  proto="dropbear python stunnel4 v2ray $v_node badvpn squid openvpn dns-serve"
+  portas=$(lsof -V -i -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND")
+  for list in $proto; do
+    case $list in
+      dropbear|python|stunnel4|v2ray|badvpn|squid|openvpn|"$v_node") portas2=$(echo "$portas"|grep -w "LISTEN"|grep -w "$list") && [[ $(echo "${portas2}"|grep "$list") ]] && inst[$list]="\033[1;32m[ON] " || inst[$list]="\033[1;31m[OFF]";;
+      dns-serve) portas2=$(echo "$portas"|grep -w "$list") && [[ $(echo "${portas2}"|grep "$list") ]] && inst[$list]="\033[1;32m[ON] " || inst[$list]="\033[1;31m[OFF]";;
+    esac
+  done
+}
+
+menu_inst () {
+clear
+declare -A inst
+pid_inst
+
+if [[ $(cat /etc/bash.bashrc | grep -w ${ADMRufu}/menu) ]]; then
+  AutoRun="\033[1;32m[ON]"
+else
+  AutoRun="\033[1;31m[OFF]"
+fi
+
+v=$(cat $ADMRufu/vercion)
+
+msg -bar
+echo -e "\033[1;93m      INFORMACION DEL SISTEMA Y PUERTOS ACTIVOS"
+msg -bar
+info_sys
+msg -bar
+mine_port
+echo -e "\e[0m\e[31m================ \e[1;33mMENU DE PROTOCOLOS\e[0m\e[31m =================\e[0m"
+echo -ne "$(msg -verd "  [1]")$(msg -verm2 ">") $(msg -azu "DROPBEAR      ${inst[dropbear]}")" && echo -e "$(msg -verd "  [7]")$(msg -verm2 ">") $(msg -azu "SQUID         ${inst[squid]}")"
+echo -ne "$(msg -verd "  [2]")$(msg -verm2 ">") $(msg -azu "SOCKS PYTHON  ${inst[python]}")" && echo -e "$(msg -verd "  [8]")$(msg -verm2 ">") $(msg -azu "OPENVPN       ${inst[openvpn]}")"
+echo -ne "$(msg -verd "  [3]")$(msg -verm2 ">") $(msg -azu "SSL           ${inst[stunnel4]}")" && echo -e "$(msg -verd "  [9]")$(msg -verm2 ">") $(msg -azu "SlowDNS       ${inst[dns-serve]}")" #&& echo -e "$(msg -verd "  [9]")$(msg -verm2 ">") $(msg -azu "SHADOW-LIBEV  $(pid_inst ss-server)")"
+echo -e "$(msg -verd "  [4]")$(msg -verm2 ">") $(msg -azu "V2RAY         ${inst[v2ray]}")" #&& echo -e "$(msg -verd " [10]")$(msg -verm2 ">") $(msg -azu "SHADOW-NORMAL $(pid_inst ssserver)")"
+echo -e "$(msg -verd "  [5]")$(msg -verm2 ">") $(msg -azu "OVER WEBSOCKET${inst[$v_node]}")" #&& echo -e "$(msg -verd " [11]")$(msg -verm2 ">") $(msg -azu "SHADOW-R      $(pid_inst)")"
+echo -e "$(msg -verd "  [6]")$(msg -verm2 ">") $(msg -azu "BADVPN-UDP    ${inst[badvpn]}")" #&& echo -e "$(msg -verd "  [X]")$(msg -verm2 ">") $(msg -azu "SlowDNS       $(pid_inst openvpn)")" 
+echo -e "\e[31m============== \e[1;33mCONFIGURACIONES RAPIDAS\e[0m\e[31m ==============\e[0m"
+echo -ne "$(msg -verd " [12]")$(msg -verm2 ">") $(msg -azu "BANNER SSH")" && echo -e "$(msg -verd "          [17]")$(msg -verm2 ">") $(msg -azu "TCP (BBR/PLUS)")"
+echo -ne "$(msg -verd " [13]")$(msg -verm2 ">") $(msg -azu "REFREES CACHE/RAM") $(crontab -l|grep -w "vm.drop_caches=3" > /dev/null && echo -e "\033[1;32m◉ " || echo -e "\033[1;31m○ ")" && echo -e "$(msg -verd "[18]")$(msg -verm2 ">") $(msg -azu "CAMBIAR PASS ROOT")"
+echo -ne "$(msg -verd " [14]")$(msg -verm2 ">") $(msg -azu "MEMORIA SWAP")  $([[ $(cat /proc/swaps | wc -l) -le 1 ]] && echo -e "\033[1;31m○ " || echo -e "\033[1;32m◉ ")" && echo -e "$(msg -verd "    [19]")$(msg -verm2 ">") $(msg -azu "ACTIVAR ACCESO ROOT")"
+echo -ne "$(msg -verd " [15]")$(msg -verm2 ">") $(msg -azu "ADMIN PORTS ACTIVOS")" && echo -e "$(msg -verd " [20]")$(msg -verm2 ">") $(msg -azu "CONF MENU PRINCIPAL")"
+echo -e "$(msg -verd " [16]")$(msg -verm2 ">") $(msg -azu "GEN DOMI/CERT-SSL") $([[ -z $(ls "${ADM_crt}") ]] && echo -e "\033[1;31m○ " || echo -e "\033[1;32m◉ ")"
+msg -bar
+echo -e "$(msg -verd " [21]") $(msg -verm2 ">") $(msg -azu "HERRAMIENTAS y EXTRAS")"
+msg -bar
+echo -ne "$(msg -verd "  [0]") $(msg -verm2 ">") " && msg -bra "   \033[1;41m VOLVER \033[0m $(msg -verd "       [22]") $(msg -verm2 ">") $(msg -azu AUTO-INICIAR) ${AutoRun}" 
+msg -bar
+selection=$(selection_fun 22)
+case $selection in
+  0)return 0;;
+  1)${ADM_inst}/dropbear.sh;;
+  2)${ADM_inst}/sockspy.sh;;
+  3)${ADM_inst}/ssl.sh;;
+  4)${ADM_inst}/v2ray.sh;;
+  5)${ADM_inst}/ws-cdn.sh;;
+  6)${ADM_inst}/budp.sh;;
+  7)${ADM_inst}/squid.sh;;
+  8)${ADM_inst}/openvpn.sh;;
+  9)${ADM_inst}/slowdns.sh;;
+  #9)${ADM_inst}/Shadowsocks-libev.sh;;
+  #10)${ADM_inst}/shadowsocks.sh;;
+  #11)${ADM_inst}/Shadowsocks-R.sh;;
+  12)baner_fun;;
+  13)cache_ram;;
+  14)${ADM_inst}/swapfile.sh;;
+  15)${ADM_inst}/ports.sh;;
+  16)${ADM_inst}/cert.sh;;
+  17)${ADM_inst}/tcp.sh;;
+  18)root_pass;;
+  19)root_pass 1;;
+  20)conf_menu;;
+  21)${ADMRufu}/tool_extras.sh;;
+  22)fun_autorun;;
+esac
+}
+
+while [[ ${back} != @(0) ]]; do
+  menu_inst
+  back="$?"
+  [[ ${back} != @(0|[1]) ]] && msg -azu " Enter para continuar..." && read foo
+done

+ 179 - 0
R9/ADMRufu-31/module

@@ -0,0 +1,179 @@
+#!/bin/bash
+
+# interfas de colores
+msg(){
+  COLOR[0]='\033[1;37m' #BRAN='\033[1;37m'
+  COLOR[1]='\e[31m' #VERMELHO='\e[31m'
+  COLOR[2]='\e[32m' #VERDE='\e[32m'
+  COLOR[3]='\e[33m' #AMARELO='\e[33m'
+  COLOR[4]='\e[34m' #AZUL='\e[34m'
+  COLOR[5]='\e[91m' #MAGENTA='\e[35m'
+  COLOR[6]='\033[1;97m' #MAG='\033[1;36m'
+  COLOR[7]='\e[36m' #teal='\e[36m'
+  COLOR[8]='\e[30m' #negro='\e[30m'
+  COLOR[9]='\033[34m' #blue='\033[1;34m'
+
+  NEGRITO='\e[1m'
+  SEMCOR='\e[0m'
+
+  case $1 in
+    -ne)   cor="${COLOR[1]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
+    -nazu) cor="${COLOR[6]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
+    -nverd)cor="${COLOR[2]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
+    -nama) cor="${COLOR[3]}${NEGRITO}" && echo -ne "${cor}${2}${SEMCOR}";;
+    -ama)  cor="${COLOR[3]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -verm) cor="${COLOR[3]}${NEGRITO}[!] ${COLOR[1]}" && echo -e "${cor}${2}${SEMCOR}";;
+    -verm2)cor="${COLOR[1]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -verm3)cor="${COLOR[1]}" && echo -e "${cor}${2}${SEMCOR}";;
+    -teal) cor="${COLOR[7]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -teal2)cor="${COLOR[7]}" && echo -e "${cor}${2}${SEMCOR}";;
+    -blak) cor="${COLOR[8]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -blak2)cor="${COLOR[8]}" && echo -e "${cor}${2}${SEMCOR}";;
+    -azu)  cor="${COLOR[6]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -blu)  cor="${COLOR[9]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -blu1) cor="${COLOR[9]}" && echo -e "${cor}${2}${SEMCOR}";;
+    -verd) cor="${COLOR[2]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -bra)  cor="${COLOR[0]}${NEGRITO}" && echo -e "${cor}${2}${SEMCOR}";;
+    -bar)  cor="${COLOR[1]}=====================================================" && echo -e "${SEMCOR}${cor}${SEMCOR}";;
+    -bar2) cor="${COLOR[7]}=====================================================" && echo -e "${SEMCOR}${cor}${SEMCOR}";;
+    -bar3) cor="${COLOR[1]}-----------------------------------------------------" && echo -e "${SEMCOR}${cor}${SEMCOR}";;
+    -bar4) cor="${COLOR[7]}-----------------------------------------------------" && echo -e "${SEMCOR}${cor}${SEMCOR}";;
+  esac
+}
+
+# centrado de texto
+print_center(){
+  if [[ -z $2 ]]; then
+    text="$1"
+  else
+    col="$1"
+    text="$2"
+  fi
+
+  while read line; do
+    unset space
+    x=$(( ( 54 - ${#line}) / 2))
+    for (( i = 0; i < $x; i++ )); do
+      space+=' '
+    done
+    space+="$line"
+    if [[ -z $2 ]]; then
+      msg -azu "$space"
+    else
+      msg "$col" "$space"
+    fi
+  done <<< $(echo -e "$text")
+}
+#print_center2(){
+#    local x
+#    local y
+#    #text="$*"
+#    text="$2"
+#    #x=$(( ($(tput cols) - ${#text}) / 2))
+#    x=$(( ( 54 - ${#text}) / 2))
+#    echo -ne "\E[6n";read -sdR y; y=$(echo -ne "${y#*[}" | cut -d';' -f1)
+#    #echo -e "\033[${y};${x}f$*"
+#    msg "$1" "\033[${y};${x}f$2"
+#}
+
+# titulos y encabesados
+title(){
+    clear
+    msg -bar
+    if [[ -z $2 ]]; then
+      print_center -azu "$1"
+    else
+      print_center "$1" "$2"
+    fi
+    msg -bar
+ }
+
+# finalizacion de tareas
+ enter(){
+  msg -bar
+  text="►► Presione enter para continuar ◄◄"
+  if [[ -z $1 ]]; then
+    print_center -ama "$text"
+  else
+    print_center "$1" "$text"
+  fi
+  read
+ }
+
+# opcion, regresar volver/atras
+back(){
+    msg -bar
+    echo -ne "$(msg -verd " [0]") $(msg -verm2 ">") " && msg -bra "\033[1;41mVOLVER"
+    msg -bar
+ }
+
+# menu maker (opciones 1, 2, 3,.....)
+menu_func(){
+  local options=${#@}
+  local array
+  for((num=1; num<=$options; num++)); do
+    echo -ne "$(msg -verd " [$num]") $(msg -verm2 ">") "
+    array=(${!num})
+    case ${array[0]} in
+      "-vd")echo -e "\033[1;33m[!]\033[1;32m ${array[@]:1}";;
+      "-vm")echo -e "\033[1;33m[!]\033[1;31m ${array[@]:1}";;
+      "-fi")echo -e "${array[@]:2} ${array[1]}";;
+      -bar|-bar2|-bar3|-bar4)echo -e "\033[1;37m${array[@]:1}\n$(msg ${array[0]})";;
+      *)echo -e "\033[1;37m${array[@]}";;
+    esac
+  done
+ }
+
+# opcion de seleccion numerica
+selection_fun(){
+  local selection="null"
+  local range
+  if [[ -z $2 ]]; then
+    opcion=$1
+    col="-nazu"
+  else
+    opcion=$2
+    col=$1
+  fi
+  for((i=0; i<=$opcion; i++)); do range[$i]="$i "; done
+  while [[ ! $(echo ${range[*]}|grep -w "$selection") ]]; do
+    msg "$col" " Selecione una Opcion: " >&2
+    read selection
+    tput cuu1 >&2 && tput dl1 >&2
+  done
+  echo $selection
+}
+
+in_opcion(){
+  unset opcion
+  if [[ -z $2 ]]; then
+      msg -nazu " $1: " >&2
+  else
+      msg $1 " $2: " >&2
+  fi
+  read opcion
+  echo "$opcion"
+}
+
+in_opcion_down(){
+  dat=$1
+  length=${#dat}
+  cal=$(( 22 - $length / 2 ))
+  line=''
+  for (( i = 0; i < $cal; i++ )); do
+    line+='╼'
+  done
+  echo -e " $(msg -verm3 "╭$line╼[")$(msg -azu "$dat")$(msg -verm3 "]")"
+  echo -ne " $(msg -verm3 "╰╼")\033[37;1m> " && read opcion
+}
+
+export -f msg
+export -f selection_fun
+export -f menu_func
+export -f print_center
+export -f title
+export -f back
+export -f enter
+export -f in_opcion
+export -f in_opcion_down
+

+ 1 - 0
R9/ADMRufu-31/new_vercion

@@ -0,0 +1 @@
+2022-03-21

+ 5 - 0
R9/ADMRufu-31/tmp/style

@@ -0,0 +1,5 @@
+infsys 1
+port 0
+resel 0
+contador 1
+limit 0

+ 90 - 0
R9/ADMRufu-31/tool_extras.sh

@@ -0,0 +1,90 @@
+#!/bin/bash
+
+install_h(){
+  clear
+  msg -bar
+  [[ -z $1 ]] && print_center -ama "INTALANDO ARCHIVO ONLINE" || print_center -ama "ACTUALIZANDO ARCHIVOS ONLINE"
+  msg -bar
+  arq=$(curl -sSL https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/online/list-arq)
+  mkdir ${ADM_src}/tool
+
+  while IFS= read -r line
+  do
+    line2=$(echo "$line"|cut -d "=" -f1)
+    line3="$(echo "$line"|cut -d "=" -f2|tr -d '[[:space:]]')"
+
+    if echo -ne $(msg -azu "  Descargando $line3....") && wget -O ${ADM_src}/tool/$line3 https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/online/$line3 &>/dev/null; then
+      chmod +x ${ADM_src}/tool/$line3
+      echo "$line" >> ${ADM_src}/tool/tool
+      msg -verd "[ok]"
+    else
+      msg -verm2 "[fail]"
+      rm ${ADM_src}/tool/$line3
+    fi
+    
+  done <<< $arq
+  msg -bar
+  [[ -z $1 ]] && print_center -verd "INSTALACION COMPLETA" || print_center -verd "ACTULIZACION COMPLETA"
+  enter
+}
+
+ferramentas_fun () {
+clear
+msg -bar
+print_center -ama "MENU DE HERRAMIENTAS ONLINE"
+msg -bar
+if [[ ! -d ${ADM_src}/tool ]]; then
+	print_center -ama "NO HAY HERRAMINETAS INSTALADAS"
+else
+
+	local Numb=1
+	while IFS= read -r line
+	do
+		line2=$(echo "$line"|cut -d "=" -f1)
+		line3="$(echo "$line"|cut -d "=" -f2)"
+
+		echo -ne "  $(msg -verd "[$Numb]") $(msg -verm2 ">") " && msg -azu "$line2"
+		script[$Numb]="$line3"
+
+		let Numb++
+	done <<< $(cat ${ADM_src}/tool/tool)
+
+	msg -bar
+	echo -ne "  $(msg -verd "[$Numb]") $(msg -verm2 ">") " && msg -verm2 "LIMPIAR LISTA DE HERRAMIENTAS"
+  script[$Numb]="clear_h"
+	let Numb++
+fi
+
+msg -bar
+echo -ne "$(msg -verd "  [0]") $(msg -verm2 ">") $(msg -bra "   \033[1;41m VOLVER \033[0m")"
+
+if [[ ! -d ${ADM_src}/tool ]]; then
+	echo -e " $(msg -verd "   [1]") $(msg -verm2 ">") $(msg -azu "INSTALAR HERRAMIENTAS")"
+  local Numb=1
+  script[$Numb]="install_h"
+else
+	echo -e " $(msg -verd "   [$Numb]") $(msg -verm2 ">") $(msg -azu "ACTUALIZAR HERRAMIENTAS")"
+  script[$Numb]="up_h"
+fi
+msg -bar
+script[0]="volver"
+selection=$(selection_fun $Numb)
+if [[ -e "${ADM_src}/tool/$(echo ${script[$selection]}|tr -d '[[:space:]]')" ]]; then
+  ${ADM_src}/tool/$(echo ${script[$selection]}|tr -d '[[:space:]]')
+elif [[ ${script[1]} = "install_h" ]]; then
+  install_h
+elif [[ ${script[$selection]} = "clear_h" ]]; then
+  rm -rf ${ADM_src}/tool
+  clear
+  msg -bar
+  print_center -ama "ALMACEN DE HERRAMIENTAS ONLINES ELIMINADO"
+  enter
+elif [[ ${script[$selection]} = "up_h" ]]; then
+  rm -rf ${ADM_src}/tool
+  install_h up
+fi
+
+return 1
+}
+
+ferramentas_fun

+ 0 - 0
R9/ADMRufu-31/v2r/user


+ 2 - 0
R9/ADMRufu-31/vercion

@@ -0,0 +1,2 @@
+2022-04-11
+

BIN
R9/ADMRufu.tar.xz


+ 1 - 1
R9/ADMRufu/chekup.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 #!/bin/bash
-key_word=$(wget --no-check-certificate -t3 -T5 -qO- "https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/ADMRufu/vercion")
+key_word=$(wget --no-check-certificate -t3 -T5 -qO- "https://raw.githubusercontent.com/rudi9999/ADMRufu/main/vercion")
 echo "${key_word}" > /etc/ADMRufu/new_vercion && chmod +x /etc/ADMRufu/new_vercion
 echo "${key_word}" > /etc/ADMRufu/new_vercion && chmod +x /etc/ADMRufu/new_vercion

+ 1 - 1
R9/ADMRufu/install/budp.sh

@@ -54,7 +54,7 @@ install(){
         fi
         fi
         cd ${ADM_src}
         cd ${ADM_src}
         echo -ne "$(msg -azu " DESCARGANDO BADVPN......") "
         echo -ne "$(msg -azu " DESCARGANDO BADVPN......") "
-        if wget https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/Utils/badvpn/badvpn-master.zip &>/dev/null; then
+        if wget https://github.com/rudi9999/ADMRufu/raw/main/Utils/badvpn/badvpn-master.zip &>/dev/null; then
             msg -verd "[OK]"
             msg -verd "[OK]"
         else
         else
             msg -verm2 "[fail]"
             msg -verm2 "[fail]"

+ 3 - 6
R9/ADMRufu/install/cert.sh

@@ -230,8 +230,7 @@ gen_domi(){
 	sleep 2
 	sleep 2
 
 
 	ls_dom=$(curl -s -X GET "$url/$_dns/dns_records?per_page=100" \
 	ls_dom=$(curl -s -X GET "$url/$_dns/dns_records?per_page=100" \
-     -H "X-Auth-Email: $correo" \
-     -H "X-Auth-Key: $apikey" \
+     -H "Authorization: Bearer $apikey" \
      -H "Content-Type: application/json" | jq '.')
      -H "Content-Type: application/json" | jq '.')
 
 
     num_line=$(echo $ls_dom | jq '.result | length')
     num_line=$(echo $ls_dom | jq '.result | length')
@@ -251,8 +250,7 @@ gen_domi(){
 		print_center -azu "ya existe un sub-dominio asociado a esta IP"
 		print_center -azu "ya existe un sub-dominio asociado a esta IP"
 		msg -bar
 		msg -bar
 		echo -e " $(msg -verm2 "sub-dominio:") $(msg -ama "$domain")"
 		echo -e " $(msg -verm2 "sub-dominio:") $(msg -ama "$domain")"
-		msg -bar
-		read foo
+		enter
 		return 1
 		return 1
     fi
     fi
 
 
@@ -325,8 +323,7 @@ gen_domi(){
 EOF
 EOF
 )
 )
     chek_domain=$(curl -s -X POST "$url/$_dns/dns_records" \
     chek_domain=$(curl -s -X POST "$url/$_dns/dns_records" \
-    -H "X-Auth-Email: $correo" \
-    -H "X-Auth-Key: $apikey" \
+    -H "Authorization: Bearer $apikey" \
     -H "Content-Type: application/json" \
     -H "Content-Type: application/json" \
     -d $(echo $var|jq -c '.')|jq '.')
     -d $(echo $var|jq -c '.')|jq '.')
 
 

+ 1 - 0
R9/ADMRufu/install/ports.sh

@@ -57,6 +57,7 @@ edit_squid(){
     if [[ ! -z "$(echo "$varline"|grep 'ADMR_port')" ]]; then
     if [[ ! -z "$(echo "$varline"|grep 'ADMR_port')" ]]; then
       for i in `echo $PORT`; do
       for i in `echo $PORT`; do
         echo -e "http_port ${i}" >> ${CONF}
         echo -e "http_port ${i}" >> ${CONF}
+        ufw allow $i/tcp &>/dev/null 2>&1
       done
       done
       continue
       continue
     fi
     fi

+ 1 - 1
R9/ADMRufu/install/slowdns.sh

@@ -92,7 +92,7 @@ ini_slow(){
 
 
     if [[ ! -e ${ADM_inst}/dns-server ]]; then
     if [[ ! -e ${ADM_inst}/dns-server ]]; then
     	msg -nama " Descargando binario...."
     	msg -nama " Descargando binario...."
-    	if wget -O ${ADM_inst}/dns-server https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/Utils/SlowDNS/dns-server &>/dev/null ; then
+    	if wget -O ${ADM_inst}/dns-server https://github.com/rudi9999/ADMRufu/raw/main/Utils/SlowDNS/dns-server &>/dev/null ; then
     		chmod +x ${ADM_inst}/dns-server
     		chmod +x ${ADM_inst}/dns-server
     		msg -verd "[OK]"
     		msg -verd "[OK]"
     	else
     	else

+ 332 - 50
R9/ADMRufu/install/squid.sh

@@ -8,11 +8,22 @@ lshost(){
     done
     done
 }
 }
 
 
+lsexpre(){
+    n=1
+    while read line; do
+    	echo -e " $(msg -verd "$n)") $(msg -verm2 ">") $(msg -teal "$line")"
+    	pay[$n]=$line
+    	let n++
+    done <<< $(cat $payload2)
+}
+
 fun_squid(){
 fun_squid(){
   if [[ -e /etc/squid/squid.conf ]]; then
   if [[ -e /etc/squid/squid.conf ]]; then
     var_squid="/etc/squid/squid.conf"
     var_squid="/etc/squid/squid.conf"
+    mipatch="/etc/squid"
   elif [[ -e /etc/squid3/squid.conf ]]; then
   elif [[ -e /etc/squid3/squid.conf ]]; then
     var_squid="/etc/squid3/squid.conf"
     var_squid="/etc/squid3/squid.conf"
+    mipatch="/etc/squid3"
   fi
   fi
 
 
   [[ -e $var_squid ]] && {
   [[ -e $var_squid ]] && {
@@ -39,7 +50,7 @@ fun_squid(){
     msg -bar
     msg -bar
     print_center -verd "$(fun_trans "Squid removido")"
     print_center -verd "$(fun_trans "Squid removido")"
     [[ -e $var_squid ]] && rm -rf $var_squid
     [[ -e $var_squid ]] && rm -rf $var_squid
-    [[ -e /etc/payloads ]] && rm -rf /etc/payloads
+    [[ -e /etc/dominio-denie ]] && rm -rf /etc/dominio-denie
     enter
     enter
     return 1
     return 1
   }
   }
@@ -71,37 +82,12 @@ fun_squid(){
   msg -bar
   msg -bar
   print_center -ama " $(fun_trans "INICIANDO CONFIGURACION")"
   print_center -ama " $(fun_trans "INICIANDO CONFIGURACION")"
  
  
-cat <<-EOF > /etc/payloads
-.bookclaro.com.br/
-.claro.com.ar/
-.claro.com.br/
-.claro.com.co/
-.claro.com.ec/
-.claro.com.gt/
-.cloudfront.net/
-.claro.com.ni/
-.claro.com.pe/
-.claro.com.sv/
-.claro.cr/
-.clarocurtas.com.br/
-.claroideas.com/
-.claroideias.com.br/
-.claromusica.com/
-.clarosomdechamada.com.br/
-.clarovideo.com/
-.facebook.net/
-.facebook.com/
-.netclaro.com.br/
-.oi.com.br/
-.oimusica.com.br/
-.speedtest.net/
-.tim.com.br/
-.timanamaria.com.br/
-.vivo.com.br/
-.rdio.com/
-.compute-1.amazonaws.com/
-.portalrecarga.vivo.com.br/
-.vivo.ddivulga.com/  
+cat <<-EOF > /etc/dominio-denie
+.ejemplo.com/  
+EOF
+
+cat <<-EOF > /etc/exprecion-denie
+torrent  
 EOF
 EOF
 
 
   unset var_squid
   unset var_squid
@@ -115,16 +101,29 @@ EOF
 
 
 cat <<-EOF > $var_squid
 cat <<-EOF > $var_squid
 #Configuracion SquiD
 #Configuracion SquiD
-acl url1 dstdomain -i $ip
-acl url2 dstdomain -i 127.0.0.1
-acl url3 url_regex -i '/etc/payloads'
-acl url4 dstdomain -i localhost
-acl all src 0.0.0.0/0
-http_access allow url1
-http_access allow url2
-http_access allow url3
-http_access allow url4
-http_access deny all
+acl localhost src 127.0.0.1/32 ::1
+acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
+acl SSL_ports port 443
+acl Safe_ports port 80
+acl Safe_ports port 21
+acl Safe_ports port 443
+acl Safe_ports port 70
+acl Safe_ports port 210
+acl Safe_ports port 1025-65535
+acl Safe_ports port 280
+acl Safe_ports port 488
+acl Safe_ports port 591
+acl Safe_ports port 777
+acl CONNECT method CONNECT
+acl SSH dst $ip-$ip/255.255.255.255
+acl exprecion-denie url_regex '/etc/exprecion-denie'
+acl dominio-denie dstdomain '/etc/dominio-denie'
+http_access deny exprecion-denie
+http_access deny dominio-denie
+http_access allow SSH
+http_access allow manager localhost
+http_access deny manager
+http_access allow localhost
 
 
 #puertos
 #puertos
 EOF
 EOF
@@ -135,12 +134,15 @@ for pts in $(echo -e $PORT); do
 done
 done
 
 
 cat <<-EOF >> $var_squid
 cat <<-EOF >> $var_squid
+http_access allow all
+coredump_dir /var/spool/squid
+refresh_pattern ^ftp: 1440 20% 10080
+refresh_pattern ^gopher: 1440 0% 1440
+refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
+refresh_pattern . 0 20% 4320
+
 #Nombre Squid
 #Nombre Squid
 visible_hostname ADMRufu
 visible_hostname ADMRufu
-
-via off
-forwarded_for off
-pipeline_prefetch off
 EOF
 EOF
 
 
 print_center -ama "$(fun_trans "REINICIANDO SERVICIOS")"
 print_center -ama "$(fun_trans "REINICIANDO SERVICIOS")"
@@ -213,6 +215,56 @@ add_host(){
   return 1
   return 1
 }
 }
 
 
+add_expre(){
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Expreciones regulares Dentro de Squid")"
+  msg -bar
+  lsexpre
+  back
+
+  while [[ -z $hos ]]; do
+      msg -nazu " $(fun_trans "Digita una palabla"): " && read hos
+      [[ $hos = 0 ]] && return 1
+      tput cuu1 && tput dl1
+      [[ $hos != "" ]] && continue
+      print_center -ama "$(fun_trans "Escriba una palabla regular") Ej: torrent"
+      sleep 3s
+      tput cuu1 && tput dl1
+  done
+
+  host="$hos"
+  [[ -z $host ]] && return 1
+
+  if [[ `grep -c "^$host" $payload2` -eq 1 ]]; then
+      print_center -ama " $(fun_trans "Exprecion regular ya exciste")"
+      enter
+      return 1
+  fi
+
+  echo "$host" >> $payload2 && grep -v "^$" $payload2 > /tmp/a && mv -f /tmp/a $payload2
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Exprecion regular Agregada con Exito")"
+  msg -bar
+  lsexpre
+  msg -bar
+  print_center -ama "Reiniciando servicios"
+
+  if [[ ! -f "/etc/init.d/squid" ]]; then
+      service squid3 reload &>/dev/null
+      service squid3 restart &>/dev/null
+   else
+      /etc/init.d/squid reload &>/dev/null
+      service squid restart &>/dev/null
+  fi
+
+  tput cuu1 && tput dl1
+  tput cuu1 && tput dl1
+  enter
+  return 1
+}
+
 del_host(){
 del_host(){
   unset opcion
   unset opcion
   clear
   clear
@@ -265,20 +317,250 @@ del_host(){
   return 1
   return 1
 }
 }
 
 
+del_expre(){
+  unset opcion
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Exprecion regular Dentro del Squid")"
+  msg -bar
+  lsexpre
+  back
+  while [[ -z $opcion ]]; do
+      msg -ne " Eliminar la palabra numero: " && read opcion
+      if [[ ! $opcion =~ $numero ]]; then
+        tput cuu1 && tput dl1
+        print_center -verm2 "ingresa solo numeros"
+        sleep 2s
+        tput cuu1 && tput dl1
+        unset opcion
+      elif [[ $opcion -gt ${#pay[@]} ]]; then
+        tput cuu1 && tput dl1
+        print_center -ama "solo numeros entre 0 y ${#pay[@]}"
+        sleep 2s
+        tput cuu1 && tput dl1
+        unset opcion
+      fi
+  done
+  [[ $opcion = 0 ]] && return 1
+  host="${pay[$opcion]}"
+  [[ -z $host ]] && return 1
+  [[ `grep -c "^$host" $payload2` -ne 1 ]] && print_center -ama "$(fun_trans  "Palabra No Encontrado")" && return 1
+  grep -v "^$host" $payload2 > /tmp/a && mv -f /tmp/a $payload2
+  clear
+  msg -bar
+  print_center -ama "$(fun_trans "Palabra Removida Con Exito")"
+  msg -bar
+  lsexpre
+  msg -bar
+  print_center -ama "Reiniciando servicios"
+  if [[ ! -f "/etc/init.d/squid" ]]; then
+      service squid3 reload &>/dev/null
+      service squid3 restart &>/dev/null
+  else
+      /etc/init.d/squid reload &>/dev/null
+      service squid restart &>/dev/null
+  fi
+  tput cuu1 && tput dl1
+  tput cuu1 && tput dl1
+  enter
+  return 1
+}
+
+add_port(){
+	if [[ -e /etc/squid/squid.conf ]]; then
+    	local CONF="/etc/squid/squid.conf"
+  	elif [[ -e /etc/squid3/squid.conf ]]; then
+    	local CONF="/etc/squid3/squid.conf"
+  	fi
+  	local miport=$(cat ${CONF}|grep -w 'http_port'|awk -F ' ' '{print $2}'|tr '\n' ' ')
+  	local line="$(cat ${CONF}|sed -n '/http_port/='|head -1)"
+  	local NEWCONF="$(cat ${CONF}|sed "$line c ADMR_port"|sed '/http_port/d')"
+  	title -ama "$(fun_trans "AGREGAR UN PUERTOS SQUID")"
+ 	echo -e " $(msg -verm2 "Ingrese Sus Puertos:") $(msg -verd "80 8080 8799 3128")"
+  	msg -bar
+  	msg -ne " $(fun_trans " Digite Puertos"): " && read DPORT
+  	tput cuu1 && tput dl1
+  	TTOTAL=($DPORT)
+  	for((i=0; i<${#TTOTAL[@]}; i++)); do
+  		[[ $(mportas|grep -v squid|grep -v '>'|grep -w "${TTOTAL[$i]}") = "" ]] && {
+      		echo -e "\033[1;33m Puerto Elegido:\033[1;32m ${TTOTAL[$i]} OK"
+      		PORT="$PORT ${TTOTAL[$i]}"
+    	} || {
+      		echo -e "\033[1;33m Puerto Elegido:\033[1;31m ${TTOTAL[$i]} FAIL"
+    	}
+  	done
+  	[[  -z $PORT ]] && {
+    	msg -bar
+    	print_center -verm2 "Ningun Puerto Valido"
+    	return 1
+  	}
+  	PORT="$miport $PORT"
+  	rm ${CONF}
+  	while read varline; do
+  		if [[ ! -z "$(echo "$varline"|grep 'ADMR_port')" ]]; then
+      		for i in `echo $PORT`; do
+        	echo -e "http_port ${i}" >> ${CONF}
+        	ufw allow $i/tcp &>/dev/null 2>&1
+      		done
+      		continue
+    	fi
+    	echo -e "${varline}" >> ${CONF}
+  	done <<< "${NEWCONF}"
+  	msg -bar
+  	print_center -azu "$(fun_trans "AGUARDE REINICIANDO SERVICIOS")"
+  	[[ -d "/etc/squid/" ]] && {
+    	service ssh restart > /dev/null 2>&1
+    	/etc/init.d/squid start > /dev/null 2>&1
+    	service squid restart > /dev/null 2>&1
+  	}
+  	[[ -d "/etc/squid3/" ]] && {
+    	service ssh restart > /dev/null 2>&1
+    	/etc/init.d/squid3 start > /dev/null 2>&1
+    	service squid3 restart > /dev/null 2>&1
+  	}
+  	sleep 2s
+  	tput cuu1 && tput dl1
+  	print_center -verd "$(fun_trans "PUERTOS AGREGADOS")"
+  	enter
+  	return 1
+}
+
+del_port(){
+	squidport=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN"|grep -E 'squid|squid3')
+
+	if [[ $(echo "$squidport"|wc -l) -lt '2' ]];then
+		clear
+		msg -bar
+		print_center -ama "Un solo puerto para eliminar\ndesea detener el servicio?	"
+		msg -bar
+		msg -ne " opcion [S/N]: " && read a
+
+		if [[ "$a" = @(S|s) ]]; then
+			title -ama "AGUARDE DETENIEDO SERVICIOS"
+			[[ -d "/etc/squid/" ]] && {
+				if service squid stop &> /dev/null ; then
+					print_center -verd "Servicio squid detenido"
+				else
+					print_center -verm2 "Falla al detener Servicio squid"
+				fi
+			}
+			[[ -d "/etc/squid3/" ]] && {
+				if service squid3 stop &> /dev/null ; then
+					print_center -verd "Servicio squid3 detenido"
+				else
+					print_center -verm2 "Falla al detener Servicio squid3"
+				fi
+			}		
+		fi
+		enter
+		return 1
+	fi
+
+	if [[ -e /etc/squid/squid.conf ]]; then
+    	local CONF="/etc/squid/squid.conf"
+  	elif [[ -e /etc/squid3/squid.conf ]]; then
+    	local CONF="/etc/squid3/squid.conf"
+  	fi
+	title -ama "Quitar un puertos squid"
+    n=1
+    while read i; do
+        port=$(echo $i|awk -F ' ' '{print $9}'|cut -d ':' -f2)
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done <<< $(echo "$squidport")
+    back
+    while [[ -z $opc ]]; do
+        msg -ne " opcion: "
+        read opc
+        tput cuu1 && tput dl1
+        if [[ -z $opc ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ ! $opc =~ $numero ]]; then
+            msg -verm2 " selecciona solo numeros entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ "$opc" -gt "$num_opc" ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            sleep 2
+            tput cuu1 && tput dl1
+            unset opc
+            continue
+        fi
+    done
+    sed -i "/http_port ${drop[$opc]}/d" $CONF
+  	print_center -azu "$(fun_trans "AGUARDE REINICIANDO SERVICIOS")"
+  	[[ -d "/etc/squid/" ]] && {
+    	service ssh restart > /dev/null 2>&1
+    	/etc/init.d/squid start > /dev/null 2>&1
+    	service squid restart > /dev/null 2>&1
+  	}
+  	[[ -d "/etc/squid3/" ]] && {
+    	service ssh restart > /dev/null 2>&1
+    	/etc/init.d/squid3 start > /dev/null 2>&1
+    	service squid3 restart > /dev/null 2>&1
+  	}
+  	sleep 2s
+  	tput cuu1 && tput dl1
+  	print_center -verd "$(fun_trans "PUERTO REMOVIDO")"
+  	enter
+  	return 1	
+}
+
+restart_squid(){
+	title -ama "AGUARDE REINICIANDO SERVICIOS"
+  	[[ -d "/etc/squid/" ]] && {
+    	service ssh restart > /dev/null 2>&1
+    	/etc/init.d/squid start > /dev/null 2>&1
+    	service squid restart > /dev/null 2>&1
+  	}
+  	[[ -d "/etc/squid3/" ]] && {
+    	service ssh restart > /dev/null 2>&1
+    	/etc/init.d/squid3 start > /dev/null 2>&1
+    	service squid3 restart > /dev/null 2>&1
+  	}
+  	sleep 2s
+  	tput cuu1 && tput dl1
+  	print_center -verd "$(fun_trans "SERVICIO REINICIANDO")"
+  	enter
+  	return 1
+}
+
+
 online_squid(){
 online_squid(){
-  payload="/etc/payloads"
+  payload="/etc/dominio-denie"
+  payload2="/etc/exprecion-denie"
   clear
   clear
   msg -bar
   msg -bar
   print_center -ama "$(fun_trans "CONFIGURACION DE SQUID")"
   print_center -ama "$(fun_trans "CONFIGURACION DE SQUID")"
   msg -bar
   msg -bar
-  menu_func "$(fun_trans "Colocar Host en Squid")" "$(fun_trans "Remover Host de Squid")" "$(fun_trans "Desinstalar Squid")"
+  menu_func "Bloquear un host" \
+  "-bar3 Desbloquear un host" \
+  "Bloquear exprecion regular" \
+  "-bar3 Desbloquear exprecion regular" \
+  "Agregar puerto" \
+  "-bar Quitar puerto" \
+  "\e[31mDesinstalar Squid" \
+  "\e[33mReiniciar squid"
   back
   back
-  opcion=$(selection_fun 3)
+  opcion=$(selection_fun 8)
 
 
   case $opcion in
   case $opcion in
     1)add_host;;
     1)add_host;;
     2)del_host;;
     2)del_host;;
-    3)fun_squid;;
+    3)add_expre;;
+    4)del_expre;;
+    5)add_port;;
+    6)del_port;;
+    7)fun_squid;;
+    8)restart_squid;;
     0)return 1;;
     0)return 1;;
   esac
   esac
 }
 }

+ 230 - 9
R9/ADMRufu/install/ssl.sh

@@ -197,20 +197,241 @@ add_port(){
     service stunnel4 restart > /dev/null 2>&1
     service stunnel4 restart > /dev/null 2>&1
     msg -bar
     msg -bar
     print_center -verd "PUERTO AGREGADO CON EXITO"
     print_center -verd "PUERTO AGREGADO CON EXITO"
-    msg -bar
-    sleep 3
+    enter
     return 1
     return 1
 }
 }
 
 
+start-stop(){
+	clear
+	msg -bar
+	if [[ $(service stunnel4 status|grep -w 'Active'|awk -F ' ' '{print $2}') = 'inactive' ]]; then
+		if service stunnel4 start &> /dev/null ; then
+			print_center -verd "Servicio stunnel4 iniciado"
+		else
+			print_center -verm2 "Falla al iniciar Servicio stunnel4"
+		fi
+	else
+		if service stunnel4 stop &> /dev/null ; then
+			print_center -verd "Servicio stunnel4 detenido"
+		else
+			print_center -verm2 "Falla al detener Servicio stunnel4"
+		fi
+	fi
+	enter
+	return 1
+}
+
+del_port(){
+	sslport=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN"|grep -E 'stunnel|stunnel4')
+	if [[ $(echo "$sslport"|wc -l) -lt '2' ]];then
+		clear
+		msg -bar
+		print_center -ama "Un solo puerto para eliminar\ndesea detener el servicio?	"
+		msg -bar
+		msg -ne " opcion [S/N]: " && read a
+
+		if [[ "$a" = @(S|s) ]]; then
+			clear
+			msg -bar
+			if service stunnel4 stop &> /dev/null ; then
+				print_center -verd "Servicio stunnel4 detenido"
+			else
+				print_center -verm2 "Falla al detener Servicio stunnel4"
+			fi		
+		fi
+		enter
+		return 1
+	fi
+
+	title "seleccione el num de puerto a quitar"
+    n=1
+    while read i; do
+        port=$(echo $i|awk -F ' ' '{print $9}'|cut -d ':' -f2)
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done <<< $(echo "$sslport")
+    back
+
+    while [[ -z $opc ]]; do
+        msg -ne " opcion: "
+        read opc
+        tput cuu1 && tput dl1
+
+        if [[ -z $opc ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ ! $opc =~ $numero ]]; then
+            msg -verm2 " selecciona solo numeros entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ "$opc" -gt "$num_opc" ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            sleep 2
+            tput cuu1 && tput dl1
+            unset opc
+            continue
+        fi
+    done
+
+    in=$(( $(cat "/etc/stunnel/stunnel.conf"|grep -n "accept = ${drop[$opc]}"|cut -d ':' -f1) - 3 ))
+    en=$(( $in + 4))
+    sed -i "$in,$en d" /etc/stunnel/stunnel.conf
+    sed -i '2 s/\[SSL+\]/\[SSL\]/' /etc/stunnel/stunnel.conf
+
+    title "Puerto ssl ${drop[$opc]} eliminado"
+
+    if service stunnel4 restart &> /dev/null ; then
+    	print_center -verd "Servicio stunnel4 reiniciado"
+	else
+		print_center -verm2 "Falla al reiniciar Servicio stunnel4"
+	fi
+	enter
+	return 1
+
+}
+
+edit_port(){
+	sslport=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN"|grep -E 'stunnel|stunnel4')
+	title "seleccione el num de puerto a editar"
+    n=1
+    while read i; do
+        port=$(echo $i|awk -F ' ' '{print $9}'|cut -d ':' -f2)
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done <<< $(echo "$sslport")
+    back
+    while [[ -z $opc ]]; do
+        msg -ne " opcion: "
+        read opc
+        tput cuu1 && tput dl1
+        if [[ -z $opc ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ ! $opc =~ $numero ]]; then
+            msg -verm2 " selecciona solo numeros entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ "$opc" -gt "$num_opc" ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            sleep 2
+            tput cuu1 && tput dl1
+            unset opc
+            continue
+        fi
+    done
+    title "Configuracion actual"
+    in=$(( $(cat "/etc/stunnel/stunnel.conf"|grep -n "accept = ${drop[$opc]}"|cut -d ':' -f1) + 1 ))
+    en=$(sed -n "${in}p" /etc/stunnel/stunnel.conf|cut -d ':' -f2)
+    print_center -ama "${drop[$opc]} >>> $en"
+    msg -bar
+    drop_port
+    n=1
+    for i in $DPB; do
+    	port=$(echo $i|awk -F ":" '{print $2}')
+        [[ "$port" = "$en" ]] && continue
+        proto=$(echo $i|awk -F ":" '{print $1}')
+        proto2=$(printf '%-12s' "$proto")
+        echo -e " $(msg -verd "[$n]") $(msg -verm2 ">") $(msg -ama "$proto2")$(msg -azu "$port")"
+        drop[$n]=$port
+        num_opc="$n"
+        let n++ 
+    done
+    msg -bar
+    unset opc
+    while [[ -z $opc ]]; do
+        msg -ne " opcion: "
+        read opc
+        tput cuu1 && tput dl1
+
+        if [[ -z $opc ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ ! $opc =~ $numero ]]; then
+            msg -verm2 " selecciona solo numeros entre 1 y $num_opc"
+            unset opc
+            sleep 2
+            tput cuu1 && tput dl1
+            continue
+        elif [[ "$opc" -gt "$num_opc" ]]; then
+            msg -verm2 " selecciona una opcion entre 1 y $num_opc"
+            sleep 2
+            tput cuu1 && tput dl1
+            unset opc
+            continue
+        fi
+    done
+    sed -i "$in s/$en/${drop[$opc]}/" /etc/stunnel/stunnel.conf
+    title "Puerto de redirecion modificado"
+    if service stunnel4 restart &> /dev/null ; then
+    	print_center -verd "Servicio stunnel4 reiniciado"
+	else
+		print_center -verm2 "Falla al reiniciar Servicio stunnel4"
+	fi
+	enter
+	return 1
+}
+
+restart(){
+	clear && msg -bar
+	if service stunnel4 restart &> /dev/null ; then
+    	print_center -verd "Servicio stunnel4 reiniciado"
+	else
+		print_center -verm2 "Falla al reiniciar Servicio stunnel4"
+	fi
+	enter
+	return 1
+}
+
+edit_nano(){
+	nano /etc/stunnel/stunnel.conf
+	restart
+	return 1
+}
+
+
+
+
 title "INSTALADOR SSL By @Rufu99"
 title "INSTALADOR SSL By @Rufu99"
-menu_func "ININICIAR O PARAR SSL" "AGREGAR PUERTOS SSL"
-msg -bar
-echo -ne "$(msg -verd " [0]") $(msg -verm2 ">") " && msg -bra "\033[1;41mVOLVER"
-msg -bar
-msg -ne " Opcion: "
-read opcao
-case $opcao in
+echo -e "$(msg -verd " [1]") $(msg -verm2 ">") $(msg -verd "INSTALAR") $(msg -ama "-") $(msg -verm2 "DESINSTALAR")"
+n=1
+if [[ $(dpkg -l|grep 'stunnel'|awk -F ' ' '{print $2}') ]]; then
+	msg -bar3
+	echo -e "$(msg -verd " [2]") $(msg -verm2 ">") $(msg -verd "AGREGAR PUERTOS SSL")"
+	echo -e "$(msg -verd " [3]") $(msg -verm2 ">") $(msg -verm2 "QUITAR PUERTOS SSL")"
+	msg -bar3
+	echo -e "$(msg -verd " [4]") $(msg -verm2 ">") $(msg -ama "EDITAR PUERTO DE REDIRECCION")"
+	echo -e "$(msg -verd " [5]") $(msg -verm2 ">") $(msg -azu "EDITAR MANUAL (NANO)")"
+	msg -bar3
+	echo -e "$(msg -verd " [6]") $(msg -verm2 ">") $(msg -azu "INICIAR/PARAR SERVICIO SSL")"
+	echo -e "$(msg -verd " [7]") $(msg -verm2 ">") $(msg -azu "REINICIAR SERVICIO SSL")"
+	n=7
+fi
+back
+opcion=$(selection_fun $n)
+case $opcion in
     1)ssl_stunel;;
     1)ssl_stunel;;
     2)add_port;;
     2)add_port;;
+    3)del_port;;
+    4)edit_port;;
+    5)edit_nano;;
+    6)start-stop;;
+    7)restart;;
     0) return 1;;
     0) return 1;;
 esac
 esac

+ 2 - 1
R9/ADMRufu/install/v2ray.sh

@@ -14,7 +14,8 @@ ins_v2r(){
 	title "ESTA POR INSTALAR V2RAY!"
 	title "ESTA POR INSTALAR V2RAY!"
 	print_center -ama "La instalacion puede tener alguna fallas!\npor favor observe atentamente el log de intalacion.\npodria contener informacion sobre algunos errores!\ny deveran corregirse de forma manual antes de\ncontinuar usando el script."
 	print_center -ama "La instalacion puede tener alguna fallas!\npor favor observe atentamente el log de intalacion.\npodria contener informacion sobre algunos errores!\ny deveran corregirse de forma manual antes de\ncontinuar usando el script."
 	enter
 	enter
-	source <(curl -sL https://multi.netlify.app/v2ray.sh)
+	source <(curl -sSL https://raw.githubusercontent.com/rudi9999/ADMRufu/main/Utils/v2ray/v2ray.sh)
+	#source <(curl -sL https://multi.netlify.app/v2ray.sh)
 }
 }
 
 
 v2ray_tls(){
 v2ray_tls(){

+ 3 - 4
R9/ADMRufu/menu

@@ -30,9 +30,8 @@ export sysctl="/etc/sysctl.conf"
 export swap="/swapfile"
 export swap="/swapfile"
 
 
 #======cloudflare========
 #======cloudflare========
-export correo='tellooou@gmail.com'
 export _dns='2473a8a21bd6a727d7d6eed58a6751a0'
 export _dns='2473a8a21bd6a727d7d6eed58a6751a0'
-export apikey='7928850c217279ed8c0227313d2f3c7c0d5ef'
+export apikey='ZN685I3ss0lEvQOr79SVYsYVDviz9GGRys_Upgu0'
 export _domain='admrufu.online'
 export _domain='admrufu.online'
 export url='https://api.cloudflare.com/client/v4/zones'
 export url='https://api.cloudflare.com/client/v4/zones'
 #========================
 #========================
@@ -98,7 +97,7 @@ fun_trans(){
 	local LINGUAGE=$(cat ${SCPidioma})
 	local LINGUAGE=$(cat ${SCPidioma})
 	[[ -z $LINGUAGE ]] && LINGUAGE=es
 	[[ -z $LINGUAGE ]] && LINGUAGE=es
 	[[ $LINGUAGE = "es" ]] && echo "$@" && return
 	[[ $LINGUAGE = "es" ]] && echo "$@" && return
-	[[ ! -e /usr/bin/trans ]] && wget -O /usr/bin/trans https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/Herramientas-main/trans &> /dev/null
+	[[ ! -e /usr/bin/trans ]] && wget -O /usr/bin/trans https://raw.githubusercontent.com/rudi9999/VPS-MX-8.0/master/ArchivosUtilitarios/trans &> /dev/null
 	[[ ! -e ${ADM_tmp}/texto-adm ]] && touch ${ADM_tmp}/texto-adm
 	[[ ! -e ${ADM_tmp}/texto-adm ]] && touch ${ADM_tmp}/texto-adm
 	source ${ADM_tmp}/texto-adm
 	source ${ADM_tmp}/texto-adm
 	if [[ -z "$(echo ${texto[$@]})" ]]; then
 	if [[ -z "$(echo ${texto[$@]})" ]]; then
@@ -696,7 +695,7 @@ update(){
 
 
 	if [[ "$opcion" = @(s|S|y|Y) ]]; then
 	if [[ "$opcion" = @(s|S|y|Y) ]]; then
 		rm -rf /root/install.sh*
 		rm -rf /root/install.sh*
-		wget -O /root/install.sh https://raw.githubusercontent.com/NetVPS/VPS-MX_Oficial/master/Instalador/Install-Sin-Key.sh &>/dev/null
+		wget -O /root/install.sh https://raw.githubusercontent.com/rudi9999/ADMRufu/main/install.sh &>/dev/null
 		chmod +x /root/install.sh*
 		chmod +x /root/install.sh*
 		/root/install.sh --update
 		/root/install.sh --update
 	fi
 	fi

+ 1 - 1
R9/ADMRufu/new_vercion

@@ -1 +1 @@
-2022-03-21
+2022-04-11

+ 1 - 0
R9/ADMRufu/source/dominio.txt

@@ -0,0 +1 @@
+

+ 1 - 0
R9/ADMRufu/tmp/MEUIPADM

@@ -0,0 +1 @@
+149.28.255.220

+ 2 - 2
R9/ADMRufu/tool_extras.sh

@@ -5,7 +5,7 @@ install_h(){
   msg -bar
   msg -bar
   [[ -z $1 ]] && print_center -ama "INTALANDO ARCHIVO ONLINE" || print_center -ama "ACTUALIZANDO ARCHIVOS ONLINE"
   [[ -z $1 ]] && print_center -ama "INTALANDO ARCHIVO ONLINE" || print_center -ama "ACTUALIZANDO ARCHIVOS ONLINE"
   msg -bar
   msg -bar
-  arq=$(curl -sSL https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/online/list-arq)
+  arq=$(curl -sSL https://raw.githubusercontent.com/rudi9999/ADMRufu/main/online/list-arq)
   mkdir ${ADM_src}/tool
   mkdir ${ADM_src}/tool
 
 
   while IFS= read -r line
   while IFS= read -r line
@@ -13,7 +13,7 @@ install_h(){
     line2=$(echo "$line"|cut -d "=" -f1)
     line2=$(echo "$line"|cut -d "=" -f1)
     line3="$(echo "$line"|cut -d "=" -f2|tr -d '[[:space:]]')"
     line3="$(echo "$line"|cut -d "=" -f2|tr -d '[[:space:]]')"
 
 
-    if echo -ne $(msg -azu "  Descargando $line3....") && wget -O ${ADM_src}/tool/$line3 https://raw.githubusercontent.com/NetVPS/Multi-Script/main/R9/online/$line3 &>/dev/null; then
+    if echo -ne $(msg -azu "  Descargando $line3....") && wget -O ${ADM_src}/tool/$line3 https://raw.githubusercontent.com/rudi9999/ADMRufu/main/online/$line3 &>/dev/null; then
       chmod +x ${ADM_src}/tool/$line3
       chmod +x ${ADM_src}/tool/$line3
       echo "$line" >> ${ADM_src}/tool/tool
       echo "$line" >> ${ADM_src}/tool/tool
       msg -verd "[ok]"
       msg -verd "[ok]"

+ 1 - 1
R9/ADMRufu/vercion

@@ -1 +1 @@
-2022-03-31
+2022-04-11

+ 419 - 0
R9/LATAM

@@ -0,0 +1,419 @@
+#!/bin/bash
+# INSTALADO --- ACTULIZADO EL 02-10-2022 --By @Kalix1/CON SATELITE
+clear && clear
+colores="$(pwd)/colores"
+rm -rf ${colores}
+wget -O ${colores} "https://www.dropbox.com/s/1iutbntwiftuzqc/colores" &>/dev/null
+[[ ! -e ${colores} ]] && exit
+chmod +x ${colores} &>/dev/null
+source ${colores}
+CTRL_C() {
+  rm -rf ${colores}
+  exit
+}
+trap "CTRL_C" INT TERM EXIT
+#rm $(pwd)/$0 &>/dev/null
+#-- VERIFICAR ROOT
+if [ $(whoami) != 'root' ]; then
+  echo ""
+  echo -e "\033[1;31m NECESITAS SER USER ROOT PARA EJECUTAR EL SCRIPT \n\n\033[97m                DIGITE: \033[1;32m sudo su\n"
+  exit
+fi
+os_system() {
+  system=$(cat -n /etc/issue | grep 1 | cut -d ' ' -f6,7,8 | sed 's/1//' | sed 's/      //')
+  distro=$(echo "$system" | awk '{print $1}')
+
+  case $distro in
+  Debian) vercion=$(echo $system | awk '{print $3}' | cut -d '.' -f1) ;;
+  Ubuntu) vercion=$(echo $system | awk '{print $2}' | cut -d '.' -f1,2) ;;
+  esac
+}
+repo() {
+  link="https://raw.githubusercontent.com/NetVPS/Multi-Script/main/Source-List/$1.list"
+  case $1 in
+  8 | 9 | 10 | 11 | 16.04 | 18.04 | 20.04 | 20.10 | 21.04 | 21.10 | 22.04) wget -O /etc/apt/sources.list ${link} &>/dev/null ;;
+  esac
+}
+## PRIMER PASO DE INSTALACION
+install_inicial() {
+  clear && clear
+  #CONFIGURAR SSH PRINCIPAL
+  wget -O /etc/ssh/sshd_config https://www.dropbox.com/s/cithibuvbyj47uu/sshd_config >/dev/null 2>&1
+  chmod +x /etc/ssh/sshd_config
+  service ssh restart
+  #CARPETAS PRINCIPALES
+  [[ -d /etc/SCRIPT-LATAM ]] && rm -rf /etc/SCRIPT-LATAM >/dev/null 2>&1
+  mkdir -p /etc/SCRIPT-LATAM >/dev/null 2>&1
+  mkdir -p /etc/SCRIPT-LATAM/temp >/dev/null 2>&1
+  mkdir -p /etc/SCRIPT-LATAM/filespy >/dev/null 2>&1
+  mkdir -p /etc/SCRIPT-LATAM/botmanager >/dev/null 2>&1
+  mkdir -p /etc/SCRIPT-LATAM/PortM >/dev/null 2>&1
+  mkdir -p /etc/SCRIPT-LATAM/v2ray >/dev/null 2>&1
+  #--VERIFICAR IP MANUAL
+  tu_ip() {
+    echo ""
+    echo -ne "\033[1;96m #Digite tu IP Publica (IPV4): \033[32m" && read IP
+    val_ip() {
+      local ip=$IP
+      local stat=1
+      if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
+        OIFS=$IFS
+        IFS='.'
+        ip=($ip)
+        IFS=$OIFS
+        [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
+        stat=$?
+      fi
+      return $stat
+    }
+    if val_ip $IP; then
+      echo "$IP" >/tmp/IP
+    else
+      echo ""
+      echo -e "\033[31mLa IP Digitada no es valida, Verifiquela"
+      echo ""
+      sleep 5s
+      fun_ip
+    fi
+  }
+  #-- VERIFICAR VERSION
+  v1=$(curl -sSL "https://raw.githubusercontent.com/NetVPS/LATAM/main/Version")
+  echo "$v1" >/etc/SCRIPT-LATAM/temp/version_instalacion
+  v22=$(cat /etc/SCRIPT-LATAM/temp/version_instalacion)
+  vesaoSCT="\033[1;31m [ \033[1;32m($v22)\033[1;97m\033[1;31m ]"
+  #-- CONFIGURACION BASICA
+  os_system
+  repo "${vercion}"
+  msgi -bar2
+  echo -e " \e[5m\033[1;100m   =====>> ►►  🖥  SCRIPT | LATAM  🖥  ◄◄ <<=====   \033[1;37m"
+  msgi -bar2
+  msgi -ama "   PREPARANDO INSTALACION | VERSION: $vesaoSCT"
+  msgi -bar2
+  ## PAQUETES-UBUNTU PRINCIPALES
+  echo ""
+  echo -e "\033[1;97m         🔎 IDENTIFICANDO SISTEMA OPERATIVO"
+  echo -e "\033[1;32m                 | $distro $vercion |"
+  echo ""
+  echo -e "\033[1;97m    ◽️ DESACTIVANDO PASS ALFANUMERICO "
+  sed -i 's/.*pam_cracklib.so.*/password sufficient pam_unix.so sha512 shadow nullok try_first_pass #use_authtok/' /etc/pam.d/common-password >/dev/null 2>&1
+  barra_intallb "service ssh restart > /dev/null 2>&1 "
+  echo ""
+  msgi -bar2
+  fun_ip() {
+    TUIP=$(wget -qO- ifconfig.me)
+    echo "$TUIP" >/tmp/IP
+    echo -e "\033[1;97m ESTA ES TU IP PUBLICA? \033[32m$TUIP"
+    msgi -bar2
+    echo -ne "\033[1;97m Seleccione  \033[1;31m[\033[1;93m S \033[1;31m/\033[1;93m N \033[1;31m]\033[1;97m: \033[1;93m" && read tu_ip
+    #read -p " Seleccione [ S / N ]: " tu_ip
+    [[ "$tu_ip" = "n" || "$tu_ip" = "N" ]] && tu_ip
+  }
+  fun_ip
+  msgi -bar2
+  echo -e "\033[1;93m             AGREGAR Y EDITAR PASS ROOT\033[1;97m"
+  msgi -bar
+  echo -ne "\033[1;97m DIGITE NUEVA CONTRASEÑA:  \033[1;31m" && read pass
+  (
+    echo $pass
+    echo $pass
+  ) | passwd root 2>/dev/null
+  sleep 1s
+  msgi -bar
+  echo -e "\033[1;94m     CONTRASEÑA AGREGADA O EDITADA CORECTAMENTE"
+  echo -e "\033[1;97m TU CONTRASEÑA ROOT AHORA ES: \e[41m $pass \033[0;37m"
+  msgi -bar2
+  echo -e "\033[1;93m\a\a\a      SE PROCEDERA A INSTALAR LAS ACTULIZACIONES\n PERTINENTES DEL SISTEMA, ESTE PROCESO PUEDE TARDAR\n VARIOS MINUTOS Y PUEDE PEDIR ALGUNAS CONFIRMACIONES \033[0;37m"
+  msgi -bar
+  read -t 120 -n 1 -rsp $'\033[1;97m           Preciona Enter Para continuar\n'
+  clear && clear
+  apt update -y
+  apt upgrade -y
+}
+
+post_reboot() {
+  /bin/cp /etc/skel/.bashrc ~/
+  echo 'wget /root/LATAM https://www.dropbox.com/s/fxk7de2c97y4rt1/LATAM -O /usr/bin/LATAM &>/dev/null' >>.bashrc
+  echo 'chmod +x /usr/bin/LATAM' >>.bashrc
+  echo 'LATAM -c' >>.bashrc
+}
+
+time_reboot() {
+  clear && clear
+  msgi -bar
+  echo -e "\e[1;93m     CONTINURA INSTALACION DESPUES DEL REBOOT"
+  msgi -bar
+  REBOOT_TIMEOUT="$1"
+  while [ $REBOOT_TIMEOUT -gt 0 ]; do
+    print_center -ne "-$REBOOT_TIMEOUT-\r"
+    sleep 1
+    : $((REBOOT_TIMEOUT--))
+  done
+  reboot
+}
+
+dependencias() {
+  dpkg --configure -a >/dev/null 2>&1
+  apt -f install -y >/dev/null 2>&1
+  soft="sudo bsdmainutils zip unzip ufw curl python python3 python3-pip openssl screen cron iptables lsof pv boxes nano at mlocate gawk grep bc jq curl npm nodejs socat netcat netcat-traditional net-tools cowsay figlet lolcat iptables-persistent apache2"
+  for i in $soft; do
+    paquete="$i"
+    echo -e "\033[1;97m INSTALANDO PAQUETE \e[93m >>> \e[36m $i"
+    barra_intall "apt-get install $i -y"
+  done
+}
+
+#SELECTOR DE INSTALACION
+while :; do
+  case $1 in
+  -s | --start) install_inicial && post_reboot && time_reboot "15" ;;
+  -c | --continue)
+    #rm -rf /root/install.sh &>/dev/null
+    break
+    ;;
+    #  -u|--update)install_start
+    #              install_continue
+    #              break;;
+  *) exit ;;
+  esac
+done
+
+## PASO DOS
+Install_key() {
+  /bin/cp /etc/skel/.bashrc ~/
+  clear && clear
+  SCPdir="/etc/SCRIPT-LATAM"
+  SCPinstal="$HOME/install"
+  Filbot="${SCPdir}/botmanager"
+  Filpy="${SCPdir}/filespy"
+  Filotros="${SCPdir}/temp"
+  #------- BARRA DE ESPERA
+  msgi -bar2
+  echo -e " \e[5m\033[1;100m   =====>> ►►  🖥  SCRIPT | LATAM  🖥  ◄◄ <<=====   \033[1;37m"
+  msgi -bar
+  echo -e "  \033[1;41m    -- INSTALACION DE PAQUETES PARA LATAM --   \e[49m"
+  msgi -bar
+  dependencias
+  sed -i "s;Listen 80;Listen 81;g" /etc/apache2/ports.conf >/dev/null 2>&1
+  service apache2 restart >/dev/null 2>&1
+  [[ $(sudo lsof -i :81) ]] || ESTATUSP=$(echo -e "\033[1;91m      >>>  FALLO DE INSTALACION EN APACHE <<<") &>/dev/null
+  [[ $(sudo lsof -i :81) ]] && ESTATUSP=$(echo -e "\033[1;92m           PUERTO APACHE ACTIVO CON EXITO") &>/dev/null
+  echo ""
+  echo -e "$ESTATUSP"
+  echo ""
+  echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
+  echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
+  msgi -bar2
+  read -t 20 -n 1 -rsp $'\033[1;97m           Preciona Enter Para continuar\n'
+  clear && clear
+  IP=$(cat /tmp/IP)
+  function_verify() {
+    permited=$(curl -sSL "https://www.dropbox.com/s/8bixksqoxyg38z2/Control-IP")
+    [[ $(echo $permited | grep "${IP}") = "" ]] && {
+      clear && clear
+      echo -e "\n\n\n\033[1;91m————————————————————————————————————————————————————\n      ¡ESTA KEY NO CONCUERDA CON EL INSTALADOR! \n                 CONATACTE A @Kalix1\n————————————————————————————————————————————————————\n\n\n"
+      [[ -d /etc/SCRIPT-LATAM ]] && rm -rf /etc/SCRIPT-LATAM
+      exit 1
+    } || {
+      ### INSTALAR VERSION DE SCRIPT
+      v1=$(curl -sSL "https://raw.githubusercontent.com/NetVPS/LATAM/main/Version")
+      echo "$v1" >/etc/SCRIPT-LATAM/temp/version_instalacion
+      FIns=$(printf '%(%D-%H:%M:%S)T')
+      echo "$FIns" >/etc/SCRIPT-LATAM/F-Instalacion
+    }
+  }
+  fun_idi() {
+    clear && clear
+    msgi -bar2
+    echo -e "\033[1;32m————————————————————————————————————————————————————"
+    figlet -w 85 -f smslant "         SCRIPT
+         LATAM  " | lolcat
+    msgi -ama "          [ ----- \033[1;97m 🐲 By @Kalix1 🐲\033[1;33m ----- ]"
+    echo -e "\033[1;32m————————————————————————————————————————————————————"
+    pv="$(echo es)"
+    [[ ${#id} -gt 2 ]] && id="es" || id="$pv"
+    byinst="true"
+  }
+  install_fim() {
+    echo -e "               \033[1;4;32mFinalizando Instalacion\033[0;39m"
+    wget -O /bin/rebootnb https://www.dropbox.com/s/8thnqvw2ljvjelw/rebootnb.sh &>/dev/null
+    chmod +x /bin/rebootnb
+    wget -O /etc/SCRIPT-LATAM/temp/version_actual https://raw.githubusercontent.com/NetVPS/LATAM/main/Version &>/dev/null
+    msgi -bar2
+    echo '#!/bin/sh -e' >/etc/rc.local
+    sudo chmod +x /etc/rc.local
+    echo "sudo rebootnb reboot" >>/etc/rc.local
+    echo "sleep 2s" >>/etc/rc.local
+    echo "exit 0" >>/etc/rc.local
+    echo 'clear && clear' >>.bashrc
+    echo 'rebootnb login >/dev/null 2>&1' >>.bashrc
+    echo 'echo -e "\033[1;31m————————————————————————————————————————————————————" ' >>.bashrc
+    echo 'echo -e "\033[1;93m════════════════════════════════════════════════════" ' >>.bashrc
+    echo 'figlet -w 85 -f smslant "         SCRIPT
+         LATAM"   | lolcat' >>.bashrc
+    echo 'echo -e "\033[1;93m════════════════════════════════════════════════════" ' >>.bashrc
+    echo 'echo -e "\033[1;31m————————————————————————————————————————————————————" ' >>.bashrc
+    echo 'mess1="$(less -f /etc/SCRIPT-LATAM/message.txt)" ' >>.bashrc
+    echo 'echo "" ' >>.bashrc
+    echo 'echo -e "\033[92m  -->> SLOGAN:\033[93m $mess1 "' >>.bashrc
+    echo 'echo "" ' >>.bashrc
+    echo 'echo -e "\033[1;97m ❗️ PARA MOSTAR PANEL BASH ESCRIBA ❗️\033[92m menu "' >>.bashrc
+    echo 'wget -O /etc/SCRIPT-LATAM/temp/version_actual https://raw.githubusercontent.com/NetVPS/LATAM/main/Version &>/dev/null' >>.bashrc
+    echo 'echo ""' >>.bashrc
+    timeespera="1"
+    times="10"
+    if [ "$timeespera" = "1" ]; then
+      echo -e "\033[1;97m         ❗️ REGISTRANDO IP y KEY EN LA BASE ❗️            "
+      msgi -bar2
+      while [ $times -gt 0 ]; do
+        echo -ne "                         -$times-\033[0K\r"
+        sleep 1
+        : $((times--))
+      done
+      tput cuu1 && tput dl1
+      tput cuu1 && tput dl1
+      tput cuu1 && tput dl1
+      msgi -bar2
+      echo -e " \033[1;92m              LISTO REGISTRO COMPLETO "
+      echo -e " \033[1;97m       COMANDO PRINCIPAL PARA ENTRAR AL PANEL "
+      echo -e " \033[1;41m                    menu o MENU                   \033[0;37m" && msgi -bar2
+    fi
+    exit
+  }
+  ofus() {
+    unset server
+    server=$(echo ${txt_ofuscatw} | cut -d':' -f1)
+    unset txtofus
+    number=$(expr length $1)
+    for ((i = 1; i < $number + 1; i++)); do
+      txt[$i]=$(echo "$1" | cut -b $i)
+      case ${txt[$i]} in
+      ".") txt[$i]="v" ;;
+      "v") txt[$i]="." ;;
+      "1") txt[$i]="@" ;;
+      "@") txt[$i]="1" ;;
+      "2") txt[$i]="?" ;;
+      "?") txt[$i]="2" ;;
+      "4") txt[$i]="p" ;;
+      "p") txt[$i]="4" ;;
+      "-") txt[$i]="L" ;;
+      "L") txt[$i]="-" ;;
+      esac
+      txtofus+="${txt[$i]}"
+    done
+    echo "$txtofus" | rev
+  }
+  verificar_arq() {
+    case $1 in
+    "menu.sh" | "message.txt") ARQ="${SCPdir}/" ;;
+    "LATAMbot.sh") ARQ="${Filbot}/" ;;
+    "PDirect.py" | "PPub.py" | "PPriv.py" | "POpen.py" | "PGet.py") ARQ="${Filpy}/" ;;
+    *) ARQ="${Filotros}/" ;;
+    esac
+    mv -f ${SCPinstal}/$1 ${ARQ}/$1
+    chmod +x ${ARQ}/$1
+  }
+  #fun_ip
+  [[ $1 = "" ]] && fun_idi || {
+    [[ ${#1} -gt 2 ]] && fun_idi || id="$1"
+  }
+  error_fun() {
+    msgi -bar2
+    msgi -bar2
+    sleep 3s
+    clear && clear
+    echo "Codificacion Incorrecta" >/etc/SCRIPT-LATAM/errorkey
+    msgi -bar2
+    [[ $1 = "" ]] && fun_idi || {
+      [[ ${#1} -gt 2 ]] && fun_idi || id="$1"
+    }
+    echo -e "\033[1;31m               ¡# ERROR INESPERADO #¡\n          ESTA KEY YA FUE USADA O EXPIRO "
+    echo -e "\033[0;93m    -SI EL ERROR PERCISTE REVISAR PUERTO 81 TCP -"
+    msgi -bar2
+    echo -ne "\033[1;97m DESEAS REINTENTAR CON OTRA KEY  \033[1;31m[\033[1;93m S \033[1;31m/\033[1;93m N \033[1;31m]\033[1;97m: \033[1;93m" && read incertar_key
+    service apache2 restart >/dev/null 2>&1
+    [[ "$incertar_key" = "s" || "$incertar_key" = "S" ]] && incertar_key
+    clear && clear
+    msgi -bar2
+    msgi -bar2
+    rm -rf lista-arq
+    echo -e "\033[1;97m          ---- INSTALACION CANCELADA  -----"
+    msgi -bar2
+    msgi -bar2
+    exit 1
+  }
+  invalid_key() {
+    msgi -bar2
+    msgi -bar2
+    sleep 3s
+    clear && clear
+    echo "Codificacion Incorrecta" >/etc/SCRIPT-LATAM/errorkey
+    msgi -bar2
+    [[ $1 = "" ]] && fun_idi || {
+      [[ ${#1} -gt 2 ]] && fun_idi || id="$1"
+    }
+    echo -e "\033[1;31m    CIFRADO INVALIDO -- #¡La Key fue Invalida#! "
+    msgi -bar2
+    echo -ne "\033[1;97m DESEAS REINTENTAR CON OTRA KEY  \033[1;31m[\033[1;93m S \033[1;31m/\033[1;93m N \033[1;31m]\033[1;93m: \033[1;93m" && read incertar_key
+    [[ "$incertar_key" = "s" || "$incertar_key" = "S" ]] && incertar_key
+    clear && clear
+    msgi -bar2
+    msgi -bar2
+    echo -e "\033[1;97m          ---- INSTALACION CANCELADA  -----"
+    msgi -bar2
+    msgi -bar2
+    exit 1
+  }
+
+  incertar_key() {
+    rm -rf /etc/SCRIPT-LATAM/errorkey >/dev/null 2>&1
+    echo "By Kalix1" >/etc/SCRIPT-LATAM/errorkey
+    msgi -bar2
+    echo -ne "\033[1;96m          >>> INTRODUZCA LA KEY ABAJO <<<\n\033[1;31m   " && read Key
+    [[ -z "$Key" ]] && Key="NULL"
+    tput cuu1 && tput dl1
+    msgi -ne "    \033[1;93m# Verificando Key # : "
+    cd $HOME
+    IPL=$(cat /tmp/IP)
+    wget -O $HOME/lista-arq $(ofus "$Key")/$IPL >/dev/null 2>&1 && echo -e "\033[1;32m Codificacion Correcta" || {
+      echo -e "\033[1;31m Codificacion Incorrecta"
+      invalid_key
+      exit
+    }
+    IP=$(ofus "$Key" | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}') && echo "$IP" >/usr/bin/vendor_code
+    sleep 1s
+    function_verify
+    updatedb
+    if [[ -e $HOME/lista-arq ]] && [[ ! $(cat /etc/SCRIPT-LATAM/errorkey | grep "Codificacion Incorrecta") ]]; then
+      msgi -bar2
+      msgi -verd " Ficheros Copiados \e[97m[\e[93m Key By @Panel_NetVPS_bot \e[97m]"
+      REQUEST=$(ofus "$Key" | cut -d'/' -f2)
+      [[ ! -d ${SCPinstal} ]] && mkdir ${SCPinstal}
+      pontos="."
+      stopping="Configurando Directorios"
+      for arqx in $(cat $HOME/lista-arq); do
+        msgi -verm "${stopping}${pontos}"
+        wget --no-check-certificate -O ${SCPinstal}/${arqx} ${IP}:81/${REQUEST}/${arqx} >/dev/null 2>&1 && verificar_arq "${arqx}" || {
+          error_fun
+          exit
+        }
+        tput cuu1 && tput dl1
+        pontos+="."
+      done
+      sleep 1s
+      msgi -bar2
+      listaarqs="$(locate "lista-arq" | head -1)" && [[ -e ${listaarqs} ]] && rm $listaarqs
+      cat /etc/bash.bashrc | grep -v '[[ $UID != 0 ]] && TMOUT=15 && export TMOUT' >/etc/bash.bashrc.2
+      echo -e '[[ $UID != 0 ]] && TMOUT=15 && export TMOUT' >>/etc/bash.bashrc.2
+      mv -f /etc/bash.bashrc.2 /etc/bash.bashrc
+      echo "${SCPdir}/menu.sh" >/usr/bin/menu && chmod +x /usr/bin/menu
+      echo "${SCPdir}/menu.sh" >/usr/bin/MENU && chmod +x /usr/bin/MENU
+      echo "$Key" >${SCPdir}/key.txt
+      [[ -d ${SCPinstal} ]] && rm -rf ${SCPinstal}
+      [[ ${byinst} = "true" ]] && install_fim
+    else
+      invalid_key
+    fi
+  }
+  incertar_key
+}
+Install_key

+ 40 - 23
R9/install-Of.sh

@@ -87,33 +87,50 @@
  	done
  	done
  }
  }
  
  
- ofus(){
- 	unset server
- 	server=$(echo ${txt_ofuscatw}|cut -d':' -f1)
- 	unset txtofus
- 	number=$(expr length $1)
- 	for((i=1; i<$number+1; i++)); do
- 		txt[$i]=$(echo "$1" | cut -b $i)
- 		case ${txt[$i]} in
- 			".")txt[$i]="*";;
- 			"*")txt[$i]=".";;
- 			"1")txt[$i]="@";;
- 			"@")txt[$i]="1";;
- 			"2")txt[$i]="?";;
- 			"?")txt[$i]="2";;
- 			"4")txt[$i]="%";;
- 			"%")txt[$i]="4";;
- 			"-")txt[$i]="K";;
- 			"K")txt[$i]="-";;
- 		esac
- 		txtofus+="${txt[$i]}"
- 	done
- 	echo "$txtofus" | rev
+ ofus () {
+   unset server
+   server=$(echo ${txt_ofuscatw}|cut -d':' -f1)
+   unset txtofus
+   number=$(expr length $1)
+   for((i=1; i<$number+1; i++)); do
+     txt[$i]=$(echo "$1" | cut -b $i)
+     case ${txt[$i]} in
+       ".")txt[$i]="*";;
+       "*")txt[$i]=".";;
+       "_")txt[$i]="@";;
+       "@")txt[$i]="_";;
+       #"1")txt[$i]="@";;
+       #"@")txt[$i]="1";;
+       #"2")txt[$i]="?";;
+       #"?")txt[$i]="2";;
+       #"4")txt[$i]="%";;
+       #"%")txt[$i]="4";;
+       "-")txt[$i]="K";;
+       "K")txt[$i]="-";;
+       "1")txt[$i]="f";;
+       "2")txt[$i]="e";;
+       "3")txt[$i]="d";;
+       "4")txt[$i]="c";;
+       "5")txt[$i]="b";;
+       "6")txt[$i]="a";;
+       "7")txt[$i]="9";;
+       "8")txt[$i]="8";;
+       "9")txt[$i]="7";;
+       "a")txt[$i]="6";;
+       "b")txt[$i]="5";;
+       "c")txt[$i]="4";;
+       "d")txt[$i]="3";;
+       "e")txt[$i]="2";;
+       "f")txt[$i]="1";;
+     esac
+     txtofus+="${txt[$i]}"
+   done
+   echo "$txtofus" | rev
  }
  }
  
  
  function_verify () {
  function_verify () {
    permited=$(curl -sSL "https://raw.githubusercontent.com/rudi9999/Control/master/Control-IP")
    permited=$(curl -sSL "https://raw.githubusercontent.com/rudi9999/Control/master/Control-IP")
-   [[ $(echo $perm ited|grep "${IP}") = "" ]] && {
+   [[ $(echo $permited|grep "${IP}") = "" ]] && {
      clear
      clear
      msg -bar
      msg -bar
      print_center -verm2 "¡LA IP $(wget -qO- ipv4.icanhazip.com) NO ESTA AUTORIZADA!"
      print_center -verm2 "¡LA IP $(wget -qO- ipv4.icanhazip.com) NO ESTA AUTORIZADA!"