Exemple #1
0
def main():
    try:
        config_file = real_path('/config/config.json')
        config = json.loads(open(config_file).read())
        tunnel_type = str(config['tunnel_type'])
        inject_host = str(config['inject_host'])
        inject_port = int(config['inject_port'])
        socks5_port_list = app.filter_array(config['socks5_port_list'])
    except KeyError:
        app.json_error(config_file)
        return

    if len(socks5_port_list) == 0: socks5_port_list.append('1080')

    log_connecting = True if len(socks5_port_list) > 1 else False
    quiet = True if len(socks5_port_list) > 1 else False

    app.server((inject_host, inject_port), quiet=quiet).start()

    ssh_clients = app.ssh_clients((inject_host, inject_port),
                                  socks5_port_list,
                                  log_connecting=log_connecting)
    ssh_clients.accounts = app.generate_accounts(
        app.convert_hostnames(real_path('/database/accounts.json')))
    ssh_clients.start()
Exemple #2
0
def main():
    try:
        config_file = real_path('/config/config.json')
        config = json.loads(open(config_file).read())
        inject_host = str(config['inject_host_external'])
        inject_port = int(config['inject_port_external'])
    except KeyError:
        app.json_error(config_file)
        return

    app.log('Inject set to {} port {}'.format(inject_host, inject_port))

    ssh_clients = app.ssh_clients((inject_host, inject_port), external=True)
    ssh_clients.accounts = app.generate_accounts(
        app.convert_hostnames(real_path('/database/accounts.json')))

    app.log('Type debug for debugging log')
    app.log('Type exit to exit')

    while True:
        try:
            ssh_clients.debug = False
            exit = False

            command = app.str_input('\n:: ', newline=True)
            if command == 'exit':
                exit = True
                break
            if command == 'debug':
                ssh_clients.debug = True

            try:
                config_file = real_path('/config/config.json')
                config = json.loads(open(config_file).read())
                ssh_clients.socks5_port_list = app.filter_array(
                    config['socks5_port_list_external'])
            except KeyError:
                app.json_error(config_file)
                continue

            if len(ssh_clients.socks5_port_list) == 0:
                ssh_clients.socks5_port_list.append('1080')

            app.ssh_statistic('clear')
            for socks5_port in ssh_clients.socks5_port_list:
                thread = threading.Thread(target=ssh_clients.ssh_client,
                                          args=(
                                              ssh_clients.unique,
                                              socks5_port,
                                          ))
                thread.daemon = True
                thread.start()
            time.sleep(60 * 60 * 24 * 30 * 12)
        except KeyboardInterrupt:
            pass
        finally:
            if not exit:
                ssh_clients.unique += 1
                ssh_clients.all_disconnected_listener()
Exemple #3
0
def main():
    config = json.loads(open(real_path('/config/config.json')).read())
    tunnel_type = str(config['tunnel_type'])
    inject_host = str(config['inject_host'])
    inject_port = int(config['inject_port'])
    socks5_port = config['socks5_port']

    app.server((inject_host, inject_port), tunnel_type, silent=True).start()

    ssh_clients = app.ssh_clients(tunnel_type, inject_host, inject_port,
                                  socks5_port)
    ssh_clients.accounts = app.generate_accounts(
        app.convert_hostnames(real_path('/database/accounts.json')))
    ssh_clients.start()
Exemple #4
0
def main():
    config = json.loads(open(real_path('/config/config.json')).read())
    tunnel_type = str(config['tunnel_type_external'])
    inject_host = str(config['inject_host_external'])
    inject_port = int(config['inject_port_external'])
    socks5_port = config['socks5_port_external']

    app.log('Inject set to {inject_host} port {inject_port}'.format(
        inject_host=inject_host, inject_port=inject_port),
            status='INFO')

    ssh_clients = app.ssh_clients(tunnel_type, inject_host, inject_port,
                                  socks5_port)
    ssh_clients.accounts = app.generate_accounts(
        app.convert_hostnames(real_path('/database/accounts.json')))
    ssh_clients.start()
Exemple #5
0
def main():
    config = json.loads(open(real_path('/config/config.json')).read())
    tunnel_type = str(config['tunnel_type'])
    inject_host = str('127.0.0.1')
    inject_port = int('9080')
    socks5_port = str('2080')

    app.server((inject_host, inject_port), tunnel_type).start()

    ssh_clients = app.ssh_clients(tunnel_type,
                                  inject_host,
                                  inject_port,
                                  socks5_ports=[socks5_port],
                                  http_requests_enable=False,
                                  log_connecting=False)
    ssh_clients.accounts = app.generate_accounts(
        app.convert_hostnames(real_path('/database/accounts.json')))

    while True:
        try:
            app.ssh_statistic('clear')
            threading.Thread(target=ssh_clients.ssh_client,
                             args=(
                                 ssh_clients.unique,
                                 socks5_port,
                             )).start()
            ssh_clients._connected.add(socks5_port)
            ssh_clients.unique += 1
            ssh_clients.all_disconnected_listener()
        except KeyboardInterrupt:
            pass
        finally:
            if ssh_clients.all_disconnected() == False:
                ssh_clients.all_disconnected_listener()

        try:
            with threading.RLock():
                command = str(input('\n:: '))
                print()
                if app.xstrip(command) == 'exit': break
        except KeyboardInterrupt:
            break
def main():
    try:
        config_file = real_path('/config/config.json')
        config = json.loads(open(config_file).read())
        inject_host = str('127.0.0.1')
        inject_port = int('9080')
        socks5_port = str('2080')
        socks5_port_list = [socks5_port]
    except KeyError: app.json_error(config_file); return

    app.server((inject_host, inject_port)).start()

    ssh_clients = app.ssh_clients((inject_host, inject_port), http_requests_enable=False, log_connecting=False, dynamic_port_forwarding=False)
    ssh_clients.accounts = app.generate_accounts(app.convert_hostnames(real_path('/database/accounts.json')))

    app.log('Type debug for debugging log')
    app.log('Type exit to exit')

    while True:
        try:
            ssh_clients.debug = False
            exit = False

            command = app.str_input('\n:: ', newline=True)
            if command == 'exit':
                exit = True
                break
            if command == 'debug':
                ssh_clients.debug = True

            app.ssh_statistic('clear')
            threading.Thread(target=ssh_clients.ssh_client, args=(ssh_clients.unique, socks5_port, )).start()
            ssh_clients._connected.add(socks5_port)
            ssh_clients.unique += 1
            ssh_clients.all_disconnected_listener()
        except KeyboardInterrupt:
            pass
        finally:
            if not exit and ssh_clients.all_disconnected() == False:
                ssh_clients.all_disconnected_listener()