17 |
17 |
18 class VirusTotalDomainReportDialog(QDialog, Ui_VirusTotalDomainReportDialog): |
18 class VirusTotalDomainReportDialog(QDialog, Ui_VirusTotalDomainReportDialog): |
19 """ |
19 """ |
20 Class implementing a dialog to show the VirusTotal domain report. |
20 Class implementing a dialog to show the VirusTotal domain report. |
21 """ |
21 """ |
22 def __init__(self, domain, resolutions, urls, subdomains, |
22 |
23 categories, webutation, whois, parent=None): |
23 def __init__( |
|
24 self, |
|
25 domain, |
|
26 resolutions, |
|
27 urls, |
|
28 subdomains, |
|
29 categories, |
|
30 webutation, |
|
31 whois, |
|
32 parent=None, |
|
33 ): |
24 """ |
34 """ |
25 Constructor |
35 Constructor |
26 |
36 |
27 @param domain domain name |
37 @param domain domain name |
28 @type str |
38 @type str |
29 @param resolutions list of resolved host names |
39 @param resolutions list of resolved host names |
30 @type list of dict |
40 @type list of dict |
31 @param urls list of detected URLs |
41 @param urls list of detected URLs |
43 @type QWidget |
53 @type QWidget |
44 """ |
54 """ |
45 super().__init__(parent) |
55 super().__init__(parent) |
46 self.setupUi(self) |
56 self.setupUi(self) |
47 self.setWindowFlags(Qt.WindowType.Window) |
57 self.setWindowFlags(Qt.WindowType.Window) |
48 |
58 |
49 self.headerLabel.setText( |
59 self.headerLabel.setText(self.tr("<b>Report for domain {0}</b>").format(domain)) |
50 self.tr("<b>Report for domain {0}</b>").format(domain)) |
60 self.headerPixmap.setPixmap(UI.PixmapCache.getPixmap("virustotal")) |
51 self.headerPixmap.setPixmap( |
61 |
52 UI.PixmapCache.getPixmap("virustotal")) |
|
53 |
|
54 for resolution in resolutions: |
62 for resolution in resolutions: |
55 QTreeWidgetItem( |
63 QTreeWidgetItem( |
56 self.resolutionsList, |
64 self.resolutionsList, |
57 [resolution["ip_address"], |
65 [resolution["ip_address"], resolution["last_resolved"].split()[0]], |
58 resolution["last_resolved"].split()[0]] |
|
59 ) |
66 ) |
60 self.resolutionsList.resizeColumnToContents(0) |
67 self.resolutionsList.resizeColumnToContents(0) |
61 self.resolutionsList.resizeColumnToContents(1) |
68 self.resolutionsList.resizeColumnToContents(1) |
62 self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
69 self.resolutionsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
63 |
70 |
64 for url in urls: |
71 for url in urls: |
65 QTreeWidgetItem( |
72 QTreeWidgetItem( |
66 self.urlsList, |
73 self.urlsList, |
67 [url["url"], |
74 [ |
68 self.tr("{0}/{1}", "positives / total").format( |
75 url["url"], |
69 url["positives"], url["total"]), |
76 self.tr("{0}/{1}", "positives / total").format( |
70 url["scan_date"].split()[0]] |
77 url["positives"], url["total"] |
|
78 ), |
|
79 url["scan_date"].split()[0], |
|
80 ], |
71 ) |
81 ) |
72 self.urlsList.resizeColumnToContents(0) |
82 self.urlsList.resizeColumnToContents(0) |
73 self.urlsList.resizeColumnToContents(1) |
83 self.urlsList.resizeColumnToContents(1) |
74 self.urlsList.resizeColumnToContents(2) |
84 self.urlsList.resizeColumnToContents(2) |
75 self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
85 self.urlsList.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
76 |
86 |
77 if subdomains: |
87 if subdomains: |
78 self.subdomainsList.addItems(subdomains) |
88 self.subdomainsList.addItems(subdomains) |
79 self.subdomainsList.sortItems() |
89 self.subdomainsList.sortItems() |
80 |
90 |
81 self.bdLabel.setText(categories["bitdefender"]) |
91 self.bdLabel.setText(categories["bitdefender"]) |
82 self.soLabel.setText(categories["sophos"]) |
92 self.soLabel.setText(categories["sophos"]) |
83 self.vvLabel.setText(categories["valkyrie"]) |
93 self.vvLabel.setText(categories["valkyrie"]) |
84 self.amLabel.setText(categories["alpha"]) |
94 self.amLabel.setText(categories["alpha"]) |
85 self.ftsLabel.setText(categories["forcepoint"]) |
95 self.ftsLabel.setText(categories["forcepoint"]) |
86 |
96 |
87 self.webutationAdultLabel.setText(webutation["adult"]) |
97 self.webutationAdultLabel.setText(webutation["adult"]) |
88 self.webutationSafetyLabel.setText(str(webutation["safety"])) |
98 self.webutationSafetyLabel.setText(str(webutation["safety"])) |
89 self.webutationVerdictLabel.setText(webutation["verdict"]) |
99 self.webutationVerdictLabel.setText(webutation["verdict"]) |
90 |
100 |
91 self.__whois = whois |
101 self.__whois = whois |
92 self.__whoisDomain = domain |
102 self.__whoisDomain = domain |
93 self.whoisButton.setEnabled(bool(whois)) |
103 self.whoisButton.setEnabled(bool(whois)) |
94 |
104 |
95 @pyqtSlot() |
105 @pyqtSlot() |
96 def on_whoisButton_clicked(self): |
106 def on_whoisButton_clicked(self): |
97 """ |
107 """ |
98 Private slot to show the whois information. |
108 Private slot to show the whois information. |
99 """ |
109 """ |
100 from .VirusTotalWhoisDialog import VirusTotalWhoisDialog |
110 from .VirusTotalWhoisDialog import VirusTotalWhoisDialog |
|
111 |
101 dlg = VirusTotalWhoisDialog(self.__whoisDomain, self.__whois) |
112 dlg = VirusTotalWhoisDialog(self.__whoisDomain, self.__whois) |
102 dlg.exec() |
113 dlg.exec() |