# Path: recon/core/framework.py
# class FrameworkException(Exception):
# class Colors(object):
# class Options(dict):
# class Framework(cmd.Cmd):
#     N = '\033[m' # native
#     R = '\033[31m' # red
#     G = '\033[32m' # green
#     O = '\033[33m' # orange
#     B = '\033[34m' # blue
#     def __init__(self, *args, **kwargs):
#     def __setitem__(self, name, value):
#     def __delitem__(self, name):
#     def _boolify(self, value):
#     def _autoconvert(self, value):
#     def init_option(self, name, value=None, required=False, description=''):
#     def serialize(self):
#     def __init__(self, params):
#     def default(self, line):
#     def emptyline(self):
#     def precmd(self, line):
#     def onecmd(self, line):
#     def print_topics(self, header, cmds, cmdlen, maxcol):
#     def to_unicode_str(self, obj, encoding='utf-8'):
#     def to_unicode(self, obj, encoding='utf-8'):
#     def is_hash(self, hashstr):
#     def get_random_str(self, length):
#     def _is_writeable(self, filename):
#     def _parse_rowids(self, rowids):
#     def print_exception(self, line=''):
#     def error(self, line):
#     def output(self, line):
#     def alert(self, line):
#     def verbose(self, line):
#     def debug(self, line):
#     def heading(self, line, level=1):
#     def table(self, data, header=[], title=''):
#     def query(self, query, values=(), path=''):
#     def get_columns(self, table):
#     def get_tables(self):
#     def add_netblocks(self, netblock=None):
#     def add_ports(self, ip_address=None, host=None, port=None, protocol=None):
#     def insert(self, table, data, unique_columns=[]):
#     def register_option(self, name, value, required, description):
#     def _validate_options(self):
#     def _load_config(self):
#     def _save_config(self, name):
#     def get_key(self, name):
#     def add_key(self, name, value):
#     def delete_key(self, name):
#     def _query_keys(self, query, values=()):
#     def _list_keys(self):
#     def show_modules(self, param):
#     def show_dashboard(self):
#     def show_schema(self):
#     def show_options(self, options=None):
#     def _get_show_names(self):
#     def do_exit(self, params):
#     def do_back(self, params):
#     def do_set(self, params):
#     def do_unset(self, params):
#     def do_keys(self, params):
#     def do_query(self, params):
#     def do_show(self, params):
#     def do_add(self, params):
#     def do_delete(self, params):
#     def do_search(self, params):
#     def do_record(self, params):
#     def do_spool(self, params):
#     def do_shell(self, params):
#     def do_resource(self, params):
#     def do_load(self, params):
#     def do_pdb(self, params):
#     def help_keys(self):
#     def help_load(self):
#     def help_record(self):
#     def help_spool(self):
#     def help_resource(self):
#     def help_query(self):
#     def help_search(self):
#     def help_set(self):
#     def help_unset(self):
#     def help_shell(self):
#     def help_show(self):
#     def help_add(self):
#     def help_delete(self):
#     def complete_keys(self, text, line, *ignored):
#     def complete_load(self, text, *ignored):
#     def complete_record(self, text, *ignored):
#     def complete_set(self, text, *ignored):
#     def complete_show(self, text, line, *ignored):
#     def complete_add(self, text, *ignored):


import errno
import imp
import json
import os
import random
import re
import shutil
import sys
import __builtin__
from recon.core import framework
from threading import Lock
            from datetime import datetime
        for f in os.listdir(self.workspace):
            if re.search('^snapshot_\d{14}.db$', f):
                snapshots.append(f)
        return snapshots

    def _create_db(self):
        self.query('CREATE TABLE IF NOT EXISTS ports (ip_address TEXT, host TEXT, port TEXT, protocol TEXT, module TEXT)')
        self.query('CREATE TABLE IF NOT EXISTS dashboard (module TEXT PRIMARY KEY, runs INT)')
        self.query("CREATE TABLE IF NOT EXISTS pentestly_creds (host TEXT, access TEXT, username TEXT, password TEXT, domain TEXT, process TEXT, logged_in TEXT, success TEXT, execute TEXT, module TEXT)")
        self.query("CREATE TABLE IF NOT EXISTS pentestly_shares (host TEXT, username TEXT, readwrite TEXT, readonly TEXT, noaccess TEXT, module TEXT)")
        self.query('PRAGMA user_version = 0')

    def _migrate_db(self):
        db_version = lambda self: self.query('PRAGMA user_version')[0][0]

    #==================================================
    # SHOW METHODS
    #==================================================

    def show_banner(self):
        banner = open(os.path.join(self.data_path, 'banner.txt')).read()
        banner_len = len(max(banner.split('\n'), key=len)) / 2
        print(framework.Colors.N + banner + framework.Colors.N)
        # print('{0:^{1}}'.format('%s[%s v%s, %s]%s' % (framework.Colors.G, self._name, __version__, __author__, framework.Colors.N), banner_len+8)) # +8 compensates for the color bytes
        # print('%s[%s v%s, %s]%s' % (framework.Colors.B, self._name, __version__, __author__, framework.Colors.N), banner_len+8) # +8 compensates for the color bytes
        print('')
        counts = [(self.loaded_category[x], x) for x in self.loaded_category]
        count_len = len(max([str(x[0]) for x in counts], key=len))
        for count in sorted(counts, reverse=True):
            cnt = '[%d]' % (count[0])

# Path: recon/core/framework.py
# class FrameworkException(Exception):
# class Colors(object):
# class Options(dict):
# class Framework(cmd.Cmd):
#     N = '\033[m' # native
#     R = '\033[31m' # red
#     G = '\033[32m' # green
#     O = '\033[33m' # orange
#     B = '\033[34m' # blue
#     def __init__(self, *args, **kwargs):
#     def __setitem__(self, name, value):
#     def __delitem__(self, name):
#     def _boolify(self, value):
#     def _autoconvert(self, value):
#     def init_option(self, name, value=None, required=False, description=''):
#     def serialize(self):
#     def __init__(self, params):
#     def default(self, line):
#     def emptyline(self):
#     def precmd(self, line):
#     def onecmd(self, line):
#     def print_topics(self, header, cmds, cmdlen, maxcol):
#     def to_unicode_str(self, obj, encoding='utf-8'):
#     def to_unicode(self, obj, encoding='utf-8'):
#     def is_hash(self, hashstr):
#     def get_random_str(self, length):
#     def _is_writeable(self, filename):
#     def _parse_rowids(self, rowids):
#     def print_exception(self, line=''):
#     def error(self, line):
#     def output(self, line):
#     def alert(self, line):
#     def verbose(self, line):
#     def debug(self, line):
#     def heading(self, line, level=1):
#     def table(self, data, header=[], title=''):
#     def query(self, query, values=(), path=''):
#     def get_columns(self, table):
#     def get_tables(self):
#     def add_netblocks(self, netblock=None):
#     def add_ports(self, ip_address=None, host=None, port=None, protocol=None):
#     def insert(self, table, data, unique_columns=[]):
#     def register_option(self, name, value, required, description):
#     def _validate_options(self):
#     def _load_config(self):
#     def _save_config(self, name):
#     def get_key(self, name):
#     def add_key(self, name, value):
#     def delete_key(self, name):
#     def _query_keys(self, query, values=()):
#     def _list_keys(self):
#     def show_modules(self, param):
#     def show_dashboard(self):
#     def show_schema(self):
#     def show_options(self, options=None):
#     def _get_show_names(self):
#     def do_exit(self, params):
#     def do_back(self, params):
#     def do_set(self, params):
#     def do_unset(self, params):
#     def do_keys(self, params):
#     def do_query(self, params):
#     def do_show(self, params):
#     def do_add(self, params):
#     def do_delete(self, params):
#     def do_search(self, params):
#     def do_record(self, params):
#     def do_spool(self, params):
#     def do_shell(self, params):
#     def do_resource(self, params):
#     def do_load(self, params):
#     def do_pdb(self, params):
#     def help_keys(self):
#     def help_load(self):
#     def help_record(self):
#     def help_spool(self):
#     def help_resource(self):
#     def help_query(self):
#     def help_search(self):
#     def help_set(self):
#     def help_unset(self):
#     def help_shell(self):
#     def help_show(self):
#     def help_add(self):
#     def help_delete(self):
#     def complete_keys(self, text, line, *ignored):
#     def complete_load(self, text, *ignored):
#     def complete_record(self, text, *ignored):
#     def complete_set(self, text, *ignored):
#     def complete_show(self, text, line, *ignored):
#     def complete_add(self, text, *ignored):


# Path: recon/core/base.py
import errno
import imp
import json
import os
import random
import re
import shutil
import sys
import __builtin__
from recon.core import framework
from threading import Lock
            from datetime import datetime

        for f in os.listdir(self.workspace):
            if re.search('^snapshot_\d{14}.db$', f):
                snapshots.append(f)
        return snapshots

    def _create_db(self):
        self.query('CREATE TABLE IF NOT EXISTS ports (ip_address TEXT, host TEXT, port TEXT, protocol TEXT, module TEXT)')
        self.query('CREATE TABLE IF NOT EXISTS dashboard (module TEXT PRIMARY KEY, runs INT)')
        self.query("CREATE TABLE IF NOT EXISTS pentestly_creds (host TEXT, access TEXT, username TEXT, password TEXT, domain TEXT, process TEXT, logged_in TEXT, success TEXT, execute TEXT, module TEXT)")
        self.query("CREATE TABLE IF NOT EXISTS pentestly_shares (host TEXT, username TEXT, readwrite TEXT, readonly TEXT, noaccess TEXT, module TEXT)")
        self.query('PRAGMA user_version = 0')

    def _migrate_db(self):
        db_version = lambda self: self.query('PRAGMA user_version')[0][0]

    #==================================================
    # SHOW METHODS
    #==================================================

    def show_banner(self):
        banner = open(os.path.join(self.data_path, 'banner.txt')).read()
        banner_len = len(max(banner.split('\n'), key=len)) / 2
        print(framework.Colors.N + banner + framework.Colors.N)
        # print('{0:^{1}}'.format('%s[%s v%s, %s]%s' % (framework.Colors.G, self._name, __version__, __author__, framework.Colors.N), banner_len+8)) # +8 compensates for the color bytes
        # print('%s[%s v%s, %s]%s' % (framework.Colors.B, self._name, __version__, __author__, framework.Colors.N), banner_len+8) # +8 compensates for the color bytes
        print('')
        counts = [(self.loaded_category[x], x) for x in self.loaded_category]
        count_len = len(max([str(x[0]) for x in counts], key=len))
        for count in sorted(counts, reverse=True):
            cnt = '[%d]' % (count[0])

            print('%s%s %s modules%s' % (framework.Colors.B, cnt.ljust(count_len+2), count[1].title(), framework.Colors.N))