Exemplo n.º 1
0
    def verify(cls):
        # load default configuration file
        config = ConfigParser()
        config.read(os.path.join(os.path.dirname(__file__), 'config.ini'))

        os_db = config.get('NSRL', 'nsrl_os_db')
        mfg_db = config.get('NSRL', 'nsrl_mfg_db')
        file_db = config.get('NSRL', 'nsrl_file_db')
        prod_db = config.get('NSRL', 'nsrl_prod_db')
        databases = [os_db, mfg_db, file_db, prod_db]

        # check for configured database path
        results = list(map(os.path.exists, databases))
        dbs_available = reduce(lambda x, y: x or y, results, False)
        if not dbs_available:
            raise PluginLoadError("{0}: verify() failed because "
                                  "databases are not available."
                                  "".format(cls.__name__))

        # check for LOCK file and remove it
        dbs_locks = [os.path.join(x, "LOCK") for x in databases]
        for lock in dbs_locks:
            try:
                if os.path.exists(lock):
                    os.unlink(lock)
            except:
                raise PluginLoadError("unable to remove lock {0}".format(lock))
Exemplo n.º 2
0
    def verify(cls):
        # load default configuration file
        config = ConfigParser()
        config.read(os.path.join(os.path.dirname(__file__), 'config.ini'))
        sign_path = config.get('PEiD', 'sign_path')

        # check for configured signatures path
        if not os.path.exists(sign_path):
            raise PluginLoadError("{0}: verify() failed because "
                                  "signatures file not found."
                                  "".format(cls.__name__))
Exemplo n.º 3
0
    def _chk_scanpath(cls):
        module = cls.module_cls(early_init=False)
        e = PluginLoadError(
            "{}: verify() failed because {} executable was not found.".format(
                cls.__name__, cls._plugin_name_))
        try:
            module.scan_path
        except Exception:
            raise e

        if not module.scan_path or not module.scan_path.exists():
            raise e