Beispiel #1
0
    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)
Beispiel #2
0
  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)