diff -r 9250a6d5fde2 -r 3c6547443fb2 eric7/WebBrowser/VirusTotal/VirusTotalApi.py --- a/eric7/WebBrowser/VirusTotal/VirusTotalApi.py Tue Aug 31 17:31:23 2021 +0200 +++ b/eric7/WebBrowser/VirusTotal/VirusTotalApi.py Tue Aug 31 17:48:20 2021 +0200 @@ -369,13 +369,6 @@ @param reply reference to the network reply @type QNetworkReply """ - categoriesMapping = { - "bitdefender": ("BitDefender category",), - "sophos": ("sophos category", "Sophos category"), - "valkyrie": ("Comodo Valkyrie Verdict category",), - "alpha": ("alphaMountain.ai category",), - "forcepoint": ("Forcepoint ThreatSeeker category",), - } if reply.error() == QNetworkReply.NetworkError.NoError: result = json.loads(str(reply.readAll(), "utf-8")) if result["response_code"] == 0: @@ -399,6 +392,14 @@ subdomains = result["subdomains"] except KeyError: subdomains = [] + + categoriesMapping = { + "bitdefender": ("BitDefender category",), + "sophos": ("sophos category", "Sophos category"), + "valkyrie": ("Comodo Valkyrie Verdict category",), + "alpha": ("alphaMountain.ai category",), + "forcepoint": ("Forcepoint ThreatSeeker category",), + } categories = {} for key, vtCategories in categoriesMapping.items(): for vtCategory in vtCategories: @@ -411,17 +412,27 @@ whois = result["whois"] except KeyError: whois = "" - # TODO: add "Webutation domain info" with subdict - # "Adult content" (yes/no) - # "Safety score" (0-100, integer) - # "Verdict" (string) + + webutationData = { + "adult": "--", + "safety": "--", + "verdict": "--" + } + with contextlib.suppress(KeyError): + webutation = result["Webutation domain info"] + with contextlib.suppress(KeyError): + webutationData["adult"] = webutation["Adult content"] + with contextlib.suppress(KeyError): + webutationData["safety"] = webutation["Safety score"] + with contextlib.suppress(KeyError): + webutationData["verdict"] = webutation["Verdict"] from .VirusTotalDomainReportDialog import ( VirusTotalDomainReportDialog ) self.__domainReportDlg = VirusTotalDomainReportDialog( self.__lastDomain, resolutions, urls, subdomains, - categories, whois) + categories, webutationData, whois) self.__domainReportDlg.show() self.__replies.remove(reply) reply.deleteLater()