本文整理汇总了Python中crits.services.service.CRITsService.service_type方法的典型用法代码示例。如果您正苦于以下问题:Python CRITsService.service_type方法的具体用法?Python CRITsService.service_type怎么用?Python CRITsService.service_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crits.services.service.CRITsService
的用法示例。
在下文中一共展示了CRITsService.service_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_to_collection
# 需要导入模块: from crits.services.service import CRITsService [as 别名]
# 或者: from crits.services.service.CRITsService import service_type [as 别名]
def _add_to_collection(self, service_class):
"""
Add a service to the database.
"""
logger.info("Adding service %s to MongoDB" % service_class.name)
description = inspect.getdoc(service_class)
config = service_class.build_default_config()
config = AnalysisConfig(**config)
new_service = CRITsService()
new_service.name = service_class.name
new_service.version = service_class.version
new_service.service_type = service_class.type_
new_service.purpose = service_class.purpose
new_service.rerunnable = service_class.rerunnable
new_service.supported_types = service_class.supported_types
new_service.required_fields = service_class.required_fields
new_service.enabled = False
new_service.run_on_triage = False
new_service.description = description
new_service.config = config
try:
new_service.save()
logger.debug('Added service %s successfully.' % service_class.name)
except ValidationError, e:
logger.warning('Failed to add service %s: %s' % (service_class.name,
e))