本文整理汇总了Python中cairis.data.AssetDAO.AssetDAO.get_vulnerable_assets方法的典型用法代码示例。如果您正苦于以下问题:Python AssetDAO.get_vulnerable_assets方法的具体用法?Python AssetDAO.get_vulnerable_assets怎么用?Python AssetDAO.get_vulnerable_assets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cairis.data.AssetDAO.AssetDAO
的用法示例。
在下文中一共展示了AssetDAO.get_vulnerable_assets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_misuse_case_obj_and_assets
# 需要导入模块: from cairis.data.AssetDAO import AssetDAO [as 别名]
# 或者: from cairis.data.AssetDAO.AssetDAO import get_vulnerable_assets [as 别名]
def get_misuse_case_obj_and_assets(self, threat_name, vulnerability_name, environment_name):
"""
:rtype : str, list[Asset]
"""
dao = AssetDAO(self.session_id)
threatened_assets = []
vulnerable_assets = []
try:
threatened_assets = dao.get_threatened_assets(threat_name, environment_name)
vulnerable_assets = dao.get_vulnerable_assets(vulnerability_name, environment_name)
except ObjectNotFoundHTTPError as ex:
SilentHTTPError(ex.message)
objectiveText = 'Exploit vulnerabilities in '
for idx,vulAsset in enumerate(vulnerable_assets):
objectiveText += vulAsset
if (idx != (len(vulnerable_assets) -1)):
objectiveText += ','
objectiveText += ' to threaten '
for idx,thrAsset in enumerate(threatened_assets):
objectiveText += thrAsset
if (idx != (len(threatened_assets) -1)):
objectiveText += ','
objectiveText += '.'
assets = set(threatened_assets + vulnerable_assets)
return objectiveText, list(assets)