Example #1
0
    def _set_mitigations(self, result: dict, key: str, condition: bool) -> dict:
        """
        Sets mitigations based on the result.

        :param result: the result to analyze.
        :param key: the key to analyze.
        :param condition: the condition to analyze.
        :return: the result with the new mitigations.
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation(
                "SSL_Error", raise_error=False
            )  # todo: we are missing a mitigation!
        return result if condition else {}
Example #2
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Sets the mitigations for the given result.

        :param result: result to be mitigated
        :param key: name of the result
        :param condition: condition to be mitigated
        :return: the result with mitigation
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation(
                key, raise_error=False
            )  # todo: remove, debug until we have all mitigations
        return result if condition else {}
Example #3
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Sets mitigations for the result.

        :param result: Result to be mitigated
        :param key: Key to be mitigated
        :param condition: If true, the mitigation is set
        :return: result with mitigation
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation(
                "HOSTNAME_VERIFIER",
                raise_error=False)  # todo: we are missing a mitigation!
        return result if condition else {}
Example #4
0
    def _set_mitigations(self, result: dict, key: str, condition: bool) -> dict:
        """
        Sets the mitigations for the Mallodroid instance.

        :param result: The result of the Mallodroid instance.
        :param key: The key to search for vulnerability in the result.
        :param condition: The condition to be mitigated.
        :return: The result with mitigation.
        :rtype: dict

        """
        if condition:
            result["mitigation"] = load_mitigation(
                key, raise_error=False
            )  # todo: remove, debug until we have all mitigations
        return result if condition else {}
Example #5
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Sets the mitigations for the given result

        :param result: the result to set the mitigations for
        :type result: dict
        :param key: the key of the result
        :type key: str
        :param condition: the condition to set the mitigations for
        :type condition: bool
        :return: the mitigations for the given result
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation("NOMORE")
        return result if condition else {}
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Set mitigations for the analysis

        :param result: results to be mitigated
        :type result: dict
        :param key: key to be mitigated
        :type key: str
        :param condition: condition to be mitigated
        :type condition: bool
        :return: mitigated results
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation(key, raise_error=False)
        return result if condition else {}
Example #7
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Override the _set_mitigations method to add the mitzvah results

        :param result: the results of the testssl command
        :type result: dict
        :param key: the key of the result
        :type key: str
        :param condition: the condition to check
        :type condition: bool
        :return: the result with the mitzvah results
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation("MITZVAH")
        return result if condition else {}
Example #8
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Override of the _set_mitigations method, to add the mitigations for the drown testssl results

        :param result: the result to be mitigated
        :type result: dict
        :param key: the key of the result to be mitigated
        :type key: str
        :param condition: the condition to be mitigated
        :type condition: bool
        :return: the mitigated result
        :rtype: dict
        """
        condition = condition and (key == "DROWN" or key == "DROWN_hint")
        if condition:
            result["mitigation"] = load_mitigation("DROWN")
        return result if condition else {}
Example #9
0
    def _set_mitigations(self, result: dict, key: str, condition: bool) -> dict:
        """
        Sets the mitigations for the analysis.

        :param result: the result dict
        :type result: dict
        :param key: the key to be used for the mitigations
        :type key: str
        :param condition: the condition to be used for the mitigations
        :type condition: bool
        :return: the result dict with the mitigations
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation(
                "HSTS_NOT_SET", raise_error=False
            )  # todo: remove, debug until we have all mitigations
        return result if condition else {}
Example #10
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Sets the mitigations for the poodle results

        :param result: the result to set the mitigations in
        :type result: dict
        :param key: the key to set the mitigations for
        :type key: str
        :param condition: the condition to set the mitigations for
        :type condition: bool
        :return: the result with the mitigations
        :rtype: dict
        """
        condition = condition and (key == "POODLE_SSL"
                                   or key == "fallback_SCSV")
        if condition:
            result["mitigation"] = load_mitigation("POODLE")
        return result if condition else {}
Example #11
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        Sets the mitigations for the result

        :param result: the result of the testssl command
        :type result: dict
        :param key: the key of the result
        :type key: str
        :param condition: the condition to set
        :type condition: bool
        :return: the result dict
        :rtype: dict
        """
        condition = condition and (key == "secure_client_renego"
                                   or key == "secure_renego")
        if condition:
            result["mitigation"] = load_mitigation("RENEGOTIATION")
        return result if condition else {}
Example #12
0
    def _set_mitigations(self, result: dict, key: str,
                         condition: bool) -> dict:
        """
        This method is used to set the mitigations for the different vulnerabilities.

        :param result: The result of the analysis.
        :type result: dict
        :param key: The key of the result.
        :type key: str
        :param condition: If the condition is met.
        :type condition: bool
        :return: The result with mitigation.
        :rtype: dict
        """
        if condition:
            result["mitigation"] = load_mitigation(
                key, raise_error=False
            )  # todo: remove, debug until we have all mitigations
        return result if condition else {}
Example #13
0
    def _set_mitigations(self, result: dict, key: str, condition: bool) -> dict:
        """
        Sets the mitigations for the 3shake testssl results

        :param result: The result dict to set the mitigations
        :type result: dict
        :param key: The key to set the mitigations
        :type key: str
        :param condition: The condition to set the mitigations
        :type condition: bool
        :return: The mitigated result
        :rtype: dict
        """
        condition = (
            "extended master secret/#23" not in result["finding"]
            if "finding" in result
            else False
        )
        if condition:
            result["mitigation"] = load_mitigation("3SHAKE")
        return result if condition else {}
Example #14
0
 def _set_mitigations(self, result: dict, key: str,
                      condition: bool) -> dict:
     if condition:
         result["mitigation"] = load_mitigation("TRUST_MANAGER")
     return result if condition else {}