当前位置: 首页>>代码示例>>Python>>正文


Python Plugin.get_checks_len方法代码示例

本文整理汇总了Python中plugin.Plugin.get_checks_len方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin.get_checks_len方法的具体用法?Python Plugin.get_checks_len怎么用?Python Plugin.get_checks_len使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plugin.Plugin的用法示例。


在下文中一共展示了Plugin.get_checks_len方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __run_plugin__

# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import get_checks_len [as 别名]
 def __run_plugin__ (self, filename, verbose, raw):
   try:
     plugin = Plugin (filename, self.__ossim_config, self.__severity_list, verbose, raw)
   except (PluginError, PluginConfigParserError) as e:
     if verbose > 0:
       print ''
       Output.warning (e.msg)
     else:
       self.__summary.append ({'plugin': e.plugin, 'warning': e.msg})
   except Exception as e:
     print ''
     Output.error ('Unknown error parsing plugin "%s": %s' % (filename, str(e)))
   else:
     if (plugin.get_enable()) and (plugin.get_checks_len() > 0) and (plugin.check_category (self.__category_list)):
       self.__summary.append (plugin.run ())
     else:
       del plugin
开发者ID:AntBean,项目名称:alienvault-ossim,代码行数:19,代码来源:doctor.py

示例2: __run_plugin__

# 需要导入模块: from plugin import Plugin [as 别名]
# 或者: from plugin.Plugin import get_checks_len [as 别名]
    def __run_plugin__(self, filename, verbose, raw):
        # Parse the plugin configuration file.
        # Check if file exists
        if not path.isfile(filename):
            msg = 'Plugin file does not exist: %s' % filename
            self.__generate_blocked_output(config_file=None,
                                           plugin=filename,
                                           plugin_data={},
                                           sections=[],
                                           error_msg=msg)
            return

        # Check for file extension.
        if not filename.endswith('.plg'):
            msg = 'File extension is not .plg'
            self.__generate_blocked_output(config_file=None,
                                           plugin=filename,
                                           plugin_data={},
                                           sections=[],
                                           error_msg=msg)
            return

        # Check for db connections and some other basic param config
        cfg_msg = ''
        for key in self.__successful_config.keys():
            if not self.__successful_config[key]['result']:
                cfg_msg = ';'.join([cfg_msg, self.__successful_config[key]['error']])
        if cfg_msg != '':
            self.__generate_blocked_output(config_file=None,
                                           plugin=filename,
                                           plugin_data={},
                                           sections=[],
                                           error_msg=cfg_msg)

        config_file = None
        try:
            config_file = self.__load_plugin_file(filename)
        except PluginError as e:
            self.__generate_blocked_output(config_file=None,
                                           plugin=e.plugin,
                                           plugin_data={},
                                           sections=[],
                                           error_msg=e.msg)

            return

        # Fill the Plugin Object
        if config_file:
            try:
                plugin = Plugin(filename,
                                config_file,
                                self.__alienvault_config,
                                self.__severity_list,
                                self.__appliance_type_list,
                                self.__ignore_dummy_platform,
                                verbose,
                                raw)

                if (plugin.get_checks_len() > 0) and (plugin.check_category(self.__category_list)):
                    result = plugin.run()
                    self.__in_strike_zone &= result.get('strike_zone', True)
                    self.__summary[plugin.get_name()] = result
                else:
                    del plugin

            except (PluginError, PluginConfigParserError, CheckError) as e:

                if verbose > 0:
                    Output.warning(e.msg)

                sections = []
                try:
                    sections = config_file.sections()
                except Exception:
                    pass

                self.__generate_blocked_output(config_file=config_file,
                                               plugin=e.plugin,
                                               plugin_data=e.kwargs,
                                               sections=sections,
                                               error_msg=e.msg)

            except KeyError, msg:
                Output.error('Unknown error running plugin "%s": %s' % (filename, str(msg)))
开发者ID:jpalanco,项目名称:alienvault-ossim,代码行数:86,代码来源:doctor.py


注:本文中的plugin.Plugin.get_checks_len方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。