예제 #1
0
    def get_report(self, *, statistics=None, mapping=None, **kwargs):
        """generates report tables"""
        output = ""

        with vulnerabilities_lock:
            vulnerabilities_len = len(vulnerabilities)

        hunters_len = len(hunters.items())

        with services_lock:
            services_len = len(services)

        if services_len:
            output += self.nodes_table()
            if not mapping:
                output += self.services_table()
                if vulnerabilities_len:
                    output += self.vulns_table()
                else:
                    output += "\nNo vulnerabilities were found"
                if statistics:
                    if hunters_len:
                        output += self.hunters_table()
                    else:
                        output += "\nNo hunters were found"
        else:
            if vulnerabilities_len:
                output += self.vulns_table()
            output += "\nKube Hunter couldn't find any clusters"
            # print("\nKube Hunter couldn't find any clusters. {}".format("Maybe try with --active?" if not config.active else ""))
        return output
예제 #2
0
 def get_hunter_statistics(self):
     hunters_data = list()
     for hunter, docs in hunters.items():
         if not Discovery in hunter.__mro__:
             name, doc = hunter.parse_docs(docs)
             hunters_data.append({"name": name, "description": doc, "vulnerabilities": hunter.publishedVulnerabilities})
     return hunters_data