示例#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()
示例#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()
示例#3
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.server((inject_host, inject_port), external=False, quiet=True).run()
示例#4
0
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()
示例#5
0
def main():
    try:
        config_file = real_path('/config/config.json')
        config = json.loads(open(config_file).read())
        proxy_command = config['proxy_command']
        if str(proxy_command.strip()) == '': raise KeyError
    except KeyError:
        app.json_error(config_file)
        return False

    data_accounts = json.loads(
        open(real_path('/database/accounts.json')).read())['accounts']
    data_deleted_accounts = {}

    for name, value in data_accounts.items():
        data_deleted_accounts[name] = []
        for i in range(len(value)):
            account = data_accounts[name][i]
            if app.check_hostname(account['hostname']) == False:
                data_accounts[name][i]['hostname'].replace('#', '')
                data_deleted_accounts[name].append(data_accounts[name][i])
                data_accounts[name][i] = ''

    json_authentications = json.loads(
        open(real_path(
            '/database/authentications.json')).read())['authentications']
    data_authentications = []

    for i in range(len(json_authentications)):
        data_authentications.append([{
            'username':
            json_authentications[i]['username'],
            'password':
            json_authentications[i]['username']
        }])

    accounts = app.generate_accounts(
        data_accounts,
        data_authentications=random.choice(data_authentications))
    queue_accounts = queue.Queue()
    threads = 10

    app.server((str('127.0.0.1'), int('3313')),
               force_tunnel_type='1',
               quiet='full').start()

    for account in accounts:
        queue_accounts.put(account)

    for i in range(threads):
        thread(queue_accounts, proxy_command).start()

    queue_accounts.join()

    print()

    deleted_accounts = app.generate_accounts(data_deleted_accounts,
                                             data_authentications=[{
                                                 'username':
                                                 '******',
                                                 'password':
                                                 '******'
                                             }])
    queue_deleted_accounts = queue.Queue()

    for deleted_account in deleted_accounts:
        queue_deleted_accounts.put(deleted_account)

    for i in range(threads):
        thread(queue_deleted_accounts, proxy_command).start()

    queue_deleted_accounts.join()