Ejemplo n.º 1
0
from sslscan import output
from sslscan.handler import Output

class Test(Output):
    short_discription="Just some tests"
    description="""
    This handler is only used for development.
    """

    def __init__(self, foo=""):
        print(foo)

    def run(self, client, host_results):
        print("run test output")
        import pprint
        pprint.pprint(client)
        pprint.pprint(host_results)

output.register("test", Test)
Ejemplo n.º 2
0
        print("    Compression: {0}".format(compression))

        expansion = host.get("session.expansion", None)
        if not expansion:
            expansion = "None"
        print("    Expansion: {0}".format(expansion))

        print("")

    def run(self, client, host_results):
        if self.config.get_value("show-client-ciphers"):
            self._print_client_ciphers(client)

        for host in host_results:
            if self.config.get_value("show-host-ciphers"):
                self._print_host_ciphers(host)

            if self.config.get_value("show-host-renegotiation"):
                self._print_host_renegotiation(host)

            if self.config.get_value("show-host-preferred-ciphers"):
                self._print_host_preferred_cipers(host)

            if self.config.get_value("show-host-session"):
                self._print_host_session(host)

            if self.config.get_value("show-host-certificate"):
                self._print_host_certificate(host)

output.register("report", Report)
Ejemplo n.º 3
0
from sslscan import output
from sslscan.handler import Output


class Test(Output):
    short_discription = "Just some tests"
    description = """
    This handler is only used for development.
    """

    def __init__(self, foo=""):
        print(foo)

    def run(self, client, host_results):
        print("run test output")
        import pprint
        pprint.pprint(client)
        pprint.pprint(host_results)


output.register("test", Test)
Ejemplo n.º 4
0
        if host.get("renegotiation.supported", None) is None:
            return

        print("  TLS renegotiation:")
        if host.get("renegotiation.secure", None):
            print("    Secure session renegotiation supported")
        elif host.get("renegotiation.supported", None):
            print("    Insecure session renegotiation supported")
        elif host.get("renegotiation.supported", None) is not None:
            print("    Session renegotiation not supported\n\n")
        print("")

    def run(self, client, host_results):
        if self.config.get_value("show-client-ciphers"):
            self._print_client_ciphers(client)

        for host in host_results:
            if self.config.get_value("show-host-ciphers"):
                self._print_host_ciphers(host)

            if self.config.get_value("show-host-renegotiation"):
                self._print_host_renegotiation(host)

            if self.config.get_value("show-host-preferred-ciphers"):
                self._print_host_preferred_cipers(host)

            if self.config.get_value("show-host-certificate"):
                self._print_host_certificate(host)

output.register("legacy", Legacy)
Ejemplo n.º 5
0
    def _print_vulnerability(self, host):
        vul_heartbleed = host.get("vulnerability.heartbleed")
        if vul_heartbleed is not None:
            print("  Heartbleed: {0}".format(
                "vulnerable" if vul_heartbleed else "not vulnerable"))

    def run(self, client, host_results):
        if self.config.get_value("show-client-ciphers"):
            self._print_client_ciphers(client)

        for host in host_results:
            if self.config.get_value("show-host-ciphers"):
                self._print_host_ciphers(host)

            if self.config.get_value("show-host-renegotiation"):
                self._print_host_renegotiation(host)

            if self.config.get_value("show-host-preferred-ciphers"):
                self._print_host_preferred_cipers(host)

            if self.config.get_value("show-host-session"):
                self._print_host_session(host)

            if self.config.get_value("show-host-certificate"):
                self._print_host_certificate(host)

            self._print_vulnerability(host)


output.register("report", Report)
Ejemplo n.º 6
0
                tmp_name = pk.get_type_name()
                if tmp_name:
                    tmp_bits = pk.get_bits()
                    if tmp_bits:
                        fp.write("   <pk error=\"false\" type=\"%s\" bits=\"%d\">\n" % (tmp_name, tmp_bits))
                    else:
                        fp.write("   <pk error=\"false\" type=\"%s\">\n" % tmp_name)
                    print(pk.get_key_print(6))
                else:
                    fp.write("   <pk error=\"true\" type=\"unknown\" />\n")

            extensions = x509.get_extensions()
            if extensions:
                fp.write("   <X509v3-Extensions>\n")
                for ext in extensions:
                    fp.write(
                        "    <extension name=\"%s\"%s>%s</extension>\n" % (
                            ext.get_name(),
                            " level=\"critical\"" if ext.get_critical() else "",
                            ext.get_value(0)
                        ),
                    )
                fp.write("   </X509v3-Extensions>\n")

            fp.write(" </ssltest>\n")
        fp.write("</document>\n")
        fp.close()
        return 0

output.register("legacy-xml", LegacyXML)
Ejemplo n.º 7
0
                if tmp_name:
                    tmp_bits = pk.get_bits()
                    if tmp_bits:
                        fp.write(
                            "   <pk error=\"false\" type=\"%s\" bits=\"%d\">\n"
                            % (tmp_name, tmp_bits))
                    else:
                        fp.write("   <pk error=\"false\" type=\"%s\">\n" %
                                 tmp_name)
                    print(pk.get_key_print(6))
                else:
                    fp.write("   <pk error=\"true\" type=\"unknown\" />\n")

            extensions = x509.get_extensions()
            if extensions:
                fp.write("   <X509v3-Extensions>\n")
                for ext in extensions:
                    fp.write(
                        "    <extension name=\"%s\"%s>%s</extension>\n" %
                        (ext.get_name(), " level=\"critical\""
                         if ext.get_critical() else "", ext.get_value(0)), )
                fp.write("   </X509v3-Extensions>\n")

            fp.write(" </ssltest>\n")
        fp.write("</document>\n")
        fp.close()
        return 0


output.register("legacy-xml", LegacyXML)