예제 #1
0
    def combine_files(self, event):
        scans_hook = self.view.tree.GetRootItem()
        merged_scans = MergedNessusReport(self.files)

        if merged_scans.get_all_reports():
            merge_hook = self.view.tree.AppendItem(scans_hook, "Merged Files",
                                                   0)

            items_hook = self.view.tree.AppendItem(merge_hook, "Findings", 0)
            self.view.tree.SetPyData(
                items_hook,
                self.sorted_tree_items(
                    merged_scans, merged_scans.criticals + merged_scans.highs +
                    merged_scans.meds + merged_scans.lows +
                    merged_scans.others))

            critical_hook = self.view.tree.AppendItem(items_hook, "Critical",
                                                      0)
            self.view.tree.SetPyData(
                critical_hook,
                self.sorted_tree_items(merged_scans, merged_scans.criticals))

            high_hook = self.view.tree.AppendItem(items_hook, "Highs", 0)
            self.view.tree.SetPyData(
                high_hook,
                self.sorted_tree_items(merged_scans, merged_scans.highs))

            med_hook = self.view.tree.AppendItem(items_hook, "Meds", 0)
            self.view.tree.SetPyData(
                med_hook,
                self.sorted_tree_items(merged_scans, merged_scans.meds))

            low_hook = self.view.tree.AppendItem(items_hook, "Lows", 0)
            self.view.tree.SetPyData(
                low_hook,
                self.sorted_tree_items(merged_scans, merged_scans.lows))

            other_hook = self.view.tree.AppendItem(items_hook, "Others", 0)
            self.view.tree.SetPyData(
                other_hook,
                self.sorted_tree_items(merged_scans, merged_scans.others))

            for crit in self.sorted_tree_items(merged_scans,
                                               merged_scans.criticals):
                item = self.view.tree.AppendItem(critical_hook, str(crit), 0)
                self.view.tree.SetPyData(item, crit)
            for high in self.sorted_tree_items(merged_scans,
                                               merged_scans.highs):
                item = self.view.tree.AppendItem(high_hook, str(high), 0)
                self.view.tree.SetPyData(item, high)
            for med in self.sorted_tree_items(merged_scans, merged_scans.meds):
                item = self.view.tree.AppendItem(med_hook, str(med), 0)
                self.view.tree.SetPyData(item, med)
            for low in self.sorted_tree_items(merged_scans, merged_scans.lows):
                item = self.view.tree.AppendItem(low_hook, str(low), 0)
                self.view.tree.SetPyData(item, low)
            for other in merged_scans.others:
                item = self.view.tree.AppendItem(other_hook, str(other), 0)
                self.view.tree.SetPyData(item, other)
            self.view.tree.Expand(scans_hook)
예제 #2
0
 def generate_csv(self, event):
     saveas = SaveDialog(self.view,
                         defaultDir=self._save_path,
                         message="Save csv as...").get_choice()
     if saveas:
         merged_scans = MergedNessusReport(self.files)
         if not saveas.endswith(".csv"):
             saveas = saveas + ".csv"
         sorted_tree_items = self.sorted_tree_items(
             merged_scans, merged_scans.criticals + merged_scans.highs +
             merged_scans.meds + merged_scans.lows + merged_scans.others)
         with open(saveas, "wb") as f:
             csv_writer = csv.writer(f)
             csv_writer.writerow(
                 ["PID", "Severity", "Hosts", "Output", "Diffs"])
             for item in sorted_tree_items:
                 csv_writer.writerow([
                     item.pid,
                     SEVERITY[item.item.severity],
                     "\n".join(
                         x.address
                         for x in merged_scans.hosts_with_pid(item.pid)),
                     self.get_item_output(item)[0],
                     self.get_item_output(item)[1],
                 ])
예제 #3
0
 def generate_csv(self, event):
     saveas = SaveDialog(self.view, defaultDir=self._save_path, message="Save csv as...").get_choice()
     if saveas:
         merged_scans = MergedNessusReport(self.files)
         if not saveas.endswith(".csv"):
             saveas = saveas+".csv"
         sorted_tree_items = self.sorted_tree_items(merged_scans, merged_scans.criticals+merged_scans.highs+merged_scans.meds+merged_scans.lows+merged_scans.others)
         with open(saveas, "wb") as f:
             csv_writer = csv.writer(f)
             csv_writer.writerow(["PID","Severity","Hosts","Output","Diffs"])
             for item in sorted_tree_items:
                 csv_writer.writerow([
                     item.pid,
                     SEVERITY[item.item.severity],
                     "\n".join(x.address for x in merged_scans.hosts_with_pid(item.pid)),
                     self.get_item_output(item)[0],
                     self.get_item_output(item)[1],
                     ]
                     )
예제 #4
0
    def combine_files(self, event):
        scans_hook = self.view.tree.GetRootItem()
        merged_scans = MergedNessusReport(self.files)

        if merged_scans.get_all_reports():
            merge_hook = self.view.tree.AppendItem(scans_hook, "Merged Files", 0)

            items_hook = self.view.tree.AppendItem(merge_hook, "Findings", 0)
            self.view.tree.SetPyData(items_hook, self.sorted_tree_items(merged_scans, merged_scans.criticals+merged_scans.highs+merged_scans.meds+merged_scans.lows+merged_scans.others))

            critical_hook = self.view.tree.AppendItem(items_hook, "Critical", 0)
            self.view.tree.SetPyData(critical_hook, self.sorted_tree_items(merged_scans, merged_scans.criticals))

            high_hook = self.view.tree.AppendItem(items_hook, "Highs", 0)
            self.view.tree.SetPyData(high_hook, self.sorted_tree_items(merged_scans, merged_scans.highs))

            med_hook = self.view.tree.AppendItem(items_hook, "Meds", 0)
            self.view.tree.SetPyData(med_hook, self.sorted_tree_items(merged_scans, merged_scans.meds))

            low_hook = self.view.tree.AppendItem(items_hook, "Lows", 0)
            self.view.tree.SetPyData(low_hook, self.sorted_tree_items(merged_scans, merged_scans.lows))

            other_hook = self.view.tree.AppendItem(items_hook, "Others", 0)
            self.view.tree.SetPyData(other_hook, self.sorted_tree_items(merged_scans, merged_scans.others))

            for crit in self.sorted_tree_items(merged_scans, merged_scans.criticals):
                item = self.view.tree.AppendItem(critical_hook, str(crit), 0)
                self.view.tree.SetPyData(item, crit)
            for high in self.sorted_tree_items(merged_scans, merged_scans.highs):
                item = self.view.tree.AppendItem(high_hook, str(high), 0)
                self.view.tree.SetPyData(item, high)
            for med in self.sorted_tree_items(merged_scans, merged_scans.meds):
                item = self.view.tree.AppendItem(med_hook, str(med), 0)
                self.view.tree.SetPyData(item, med)
            for low in self.sorted_tree_items(merged_scans, merged_scans.lows):
                item = self.view.tree.AppendItem(low_hook, str(low), 0)
                self.view.tree.SetPyData(item, low)
            for other in merged_scans.others:
                item = self.view.tree.AppendItem(other_hook, str(other), 0)
                self.view.tree.SetPyData(item, other)
            self.view.tree.Expand(scans_hook)
예제 #5
0
 def generate_vulnxml(self, event):
     saveas = SaveDialog(self.view,
                         defaultDir=self._save_path,
                         message="Save VulnXML as...").get_choice()
     if saveas:
         merged_scans = MergedNessusReport(self.files)
         if not saveas.endswith(".xml"):
             saveas = saveas + ".xml"
         sorted_tree_items = self.sorted_tree_items(
             merged_scans, merged_scans.criticals + merged_scans.highs +
             merged_scans.meds + merged_scans.lows + merged_scans.others)
         with open(saveas, "wb") as f:
             for item in sorted_tree_items:
                 issue, diffs, meta = self.get_item_output(item)
                 item.issue = meta
                 item.diffs = diffs
                 item.severity = SEVERITY[item.item.severity]
             f.write(
                 VULNXML_TEMPLATE.render(
                     timestamp=datetime.now(),
                     hosts=merged_scans.hosts,
                     vulns=sorted_tree_items,
                     merged_scans=merged_scans,
                 ))