예제 #1
0
def main():
    app.log('Exporting SSH Accounts', status='INFO')

    accounts = app.generate_accounts(
        app.convert_hostnames(real_path('/database/accounts.json')))
    data = open(real_path('/app/data/banners.txt')).read()

    for account in accounts:
        name = account['name']
        host = account['host']
        hostname = account['hostname']
        username = account['username']
        password = account['password']
        data += '\n'
        data += 'name     : {}\n'.format(name.upper())
        data += 'host     : {}\n'.format(host)
        data += 'hostname : {}\n'.format(hostname)
        data += 'username : {}\n'.format(username)
        data += 'password : {}\n'.format(password)

    open(real_path('/storage/accounts.txt'), 'w').write(data)

    app.log('Exporting SSH Accounts Complete', status='INFO')

    try:
        app.log('\nCtrl-C to Exit', log_datetime=False, status=None)
        time.sleep(60 * 60 * 24)
    except KeyboardInterrupt:
        pass
    finally:
        pass
예제 #2
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()
예제 #3
0
def main():
    app.log('Checking serverid', status=None)
    data_create_ssh_temp = [
        {
            "link": "",
            "head": "",
            "post": "",
            "page": "",
            "pattern-class": "",
            "pattern-serverid": "",
            "pattern-hostname": "",
            "replace-username": "",
            "replace-password": ""
        }
    ]

    ssh_create = app.ssh_create(verbose=True)
    ssh_create.accounts = app.generate_accounts(json.loads(open(real_path('/database/accounts.json')).read())['accounts'])
    # ssh_create.data_create_ssh = data_create_ssh_temp
    
    threads = []

    for data in ssh_create.data_create_ssh:
        threads.append(threading.Thread(target=ssh_create.update_serverid_thread, args=(data, )))

    for thread in threads:
        thread.start()

    for thread in threads:
        thread.join()

    app.log('Checking serverid complete', status=None)
예제 #4
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()
예제 #5
0
def main():
    try:
        ssh_create = app.ssh_create()
        ssh_create.accounts = app.generate_accounts(json.loads(open(real_path('/database/accounts.json')).read())['accounts'])
        ssh_create.start()
        app.log('\nCtrl-C to Exit', time=False, status=None)
        time.sleep(60*60*24)
    except KeyboardInterrupt:
        pass
    finally: print()
예제 #6
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()
예제 #7
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()
예제 #8
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
예제 #9
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()
예제 #10
0
def main():
    try:
        app.log('Exporting SSH Accounts')

        accounts = app.generate_accounts(app.convert_hostnames(real_path('/database/accounts.json')))
        data = open(real_path('/app/data/banners.txt')).read() + '\n'

        for account in accounts:
            name = account['name']
            host = account['host']
            hostname = account['hostname']
            username = account['username']
            password = account['password']
            data += 'name     : {}\n'.format(name.upper())  + \
                    'host     : {}\n'.format(host)          + \
                    'hostname : {}\n'.format(hostname)      + \
                    'username : {}\n'.format(username)      + \
                    'password : {}{}'.format(password, '\n\n')

        open(real_path('/storage/ssh-accounts.txt'), 'w').write(data.strip() + '\n')

        app.log('Exporting SSH Accounts Complete \n')
    except KeyboardInterrupt: pass
예제 #11
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()