How to use the pocsuite3.lib.core.data.paths function in pocsuite3

To help you get started, we’ve selected a few pocsuite3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github knownsec / pocsuite3 / pocsuite3 / lib / core / option.py View on Github external
def _set_plugins():
    # TODO
    # load plugin scripts .pyc file support
    if conf.plugins:
        founds = []
        cache_plugins = copy.deepcopy(conf.plugins)

        for found in glob.glob(os.path.join(paths.POCSUITE_PLUGINS_PATH, "*.py*")):
            dirname, filename = os.path.split(found)
            plugin_name = os.path.splitext(filename)[0]
            if found.endswith(('__init__.py', '__init__.pyc')):
                continue
            if plugin_name not in conf.plugins:
                continue
            cache_plugins.remove(plugin_name)
            founds.append(found)
        if len(cache_plugins) > 0:
            for file in cache_plugins:
                if os.path.exists(file):
                    founds.append(file)

        for file in founds:
            debug_msg = "loading plugin script '{0}'".format(file)
            logger.debug(debug_msg)
github knownsec / pocsuite3 / pocsuite3 / lib / core / update.py View on Github external
def update():
    if not conf.update_all:
        return
    success = False
    if not os.path.exists(os.path.join(paths.POCSUITE_ROOT_PATH, "../", ".git")):
        warn_msg = "not a git repository. It is recommended to clone the 'knownsec/pocsuite3' repository "
        warn_msg += "from GitHub (e.g. 'git clone --depth 1 {} pocsuite3')".format(GIT_REPOSITORY)
        logger.warn(warn_msg)
        if VERSION == get_latest_revision():
            logger.info("already at the latest revision '{}'".format(get_revision_number()))
            return
    else:
        info_msg = "updating pocsuite3 to the latest development revision from the "
        info_msg += "GitHub repository"
        logger.info(info_msg)
        debug_msg = "pocsuite3 will try to update itself using 'git' command"
        logger.debug(debug_msg)
        data_to_stdout("\r[{0}] [INFO] update in progress ".format(time.strftime("%X")))
        cwd_path = os.path.join(paths.POCSUITE_ROOT_PATH, "../")
        try:
            process = subprocess.Popen("git checkout . && git pull %s HEAD" % GIT_REPOSITORY,
github knownsec / pocsuite3 / pocsuite3 / lib / core / option.py View on Github external
def _create_directory():
    if not os.path.isdir(paths.POCSUITE_OUTPUT_PATH):
        os.makedirs(paths.POCSUITE_OUTPUT_PATH)

    if not os.path.isdir(paths.POCSUITE_TMP_PATH):
        os.makedirs(paths.POCSUITE_TMP_PATH)

    if not os.path.isfile(paths.POCSUITE_RC_PATH):
        open(paths.POCSUITE_RC_PATH, 'a').close()
github knownsec / pocsuite3 / pocsuite3 / lib / core / option.py View on Github external
def _create_directory():
    if not os.path.isdir(paths.POCSUITE_OUTPUT_PATH):
        os.makedirs(paths.POCSUITE_OUTPUT_PATH)

    if not os.path.isdir(paths.POCSUITE_TMP_PATH):
        os.makedirs(paths.POCSUITE_TMP_PATH)

    if not os.path.isfile(paths.POCSUITE_RC_PATH):
        open(paths.POCSUITE_RC_PATH, 'a').close()
github knownsec / pocsuite3 / pocsuite3 / lib / core / interpreter.py View on Github external
self.modules = index_modules()
        self.modules_count = len(self.modules)
        # init
        conf.console_mode = True
        banner()
        logger.info("Load Pocs :{}".format(self.modules_count))

        self.last_search = []
        self.last_ip = []
        self.main_modules_dirs = []
        for module in self.modules:
            temp_module = module
            if IS_WIN:
                temp_module = temp_module.replace("/", "\\")
                temp_module = temp_module.replace(paths.POCSUITE_ROOT_PATH, "").lstrip("\\")
            temp_module = temp_module.replace(paths.POCSUITE_ROOT_PATH, "").lstrip("/")
            self.main_modules_dirs.append(temp_module)

        self.__parse_prompt()
github knownsec / pocsuite3 / pocsuite3 / pocs / ssh_burst.py View on Github external
def get_word_list():
    common_username = ('ssh', 'test', 'root', 'guest', 'admin', 'daemon', 'user')
    with open(paths.WEAK_PASS) as f:
        return itertools.product(common_username, f)
github knownsec / pocsuite3 / pocsuite3 / lib / core / interpreter.py View on Github external
logger.warning("Index out of range")
                return
            module_path = self.last_search[index]
        if not module_path.endswith(".py"):
            module_path = module_path + ".py"
        if not os.path.exists(module_path):
            module_path = os.path.join(paths.POCSUITE_ROOT_PATH, module_path)
            if not os.path.exists(module_path):
                errMsg = "No such file: '{0}'".format(module_path)
                logger.error(errMsg)
                return
        try:
            load_file_to_module(module_path)
            self.current_module = kb.current_poc
            self.current_module.pocsuite3_module_path = ltrim(rtrim(module_path, ".py"),
                                                              os.path.join(paths.POCSUITE_ROOT_PATH, ""))
        except Exception as err:
            logger.error(str(err))
github shadowsock5 / Poc / Nexus / Nexus_CVE_2018_16621.py View on Github external
def get_password_dict(self):
        f = open(paths.WEAK_PASS)
        pwddict = []
        for item in f.readlines():
            pwddict.append(item.strip())
        return pwddict
github knownsec / pocsuite3 / pocsuite3 / lib / core / option.py View on Github external
def _set_user_pocs_path():
    if conf.pocs_path:
        if check_path(conf.pocs_path):
            paths.USER_POCS_PATH = conf.pocs_path
        else:
            warm_msg = "User defined pocs path {0} is invalid".format(conf.pocs_path)
            logger.warn(warm_msg)
github knownsec / pocsuite3 / pocsuite3 / modules / shodan / __init__.py View on Github external
    def __init__(self, conf_path=paths.POCSUITE_RC_PATH, token=None):
        self.headers = None
        self.credits = 0
        self.conf_path = conf_path

        if self.conf_path:
            self.parser = ConfigParser()
            self.parser.read(self.conf_path)
            try:
                self.token = self.parser.get("Shodan", 'Token')
            except Exception:
                pass

        if token:
            self.token = token
        self.check_token()