367 Private slot to process the IP address report data. |
367 Private slot to process the IP address report data. |
368 |
368 |
369 @param reply reference to the network reply |
369 @param reply reference to the network reply |
370 @type QNetworkReply |
370 @type QNetworkReply |
371 """ |
371 """ |
372 categoriesMapping = { |
|
373 "bitdefender": ("BitDefender category",), |
|
374 "sophos": ("sophos category", "Sophos category"), |
|
375 "valkyrie": ("Comodo Valkyrie Verdict category",), |
|
376 "alpha": ("alphaMountain.ai category",), |
|
377 "forcepoint": ("Forcepoint ThreatSeeker category",), |
|
378 } |
|
379 if reply.error() == QNetworkReply.NetworkError.NoError: |
372 if reply.error() == QNetworkReply.NetworkError.NoError: |
380 result = json.loads(str(reply.readAll(), "utf-8")) |
373 result = json.loads(str(reply.readAll(), "utf-8")) |
381 if result["response_code"] == 0: |
374 if result["response_code"] == 0: |
382 EricMessageBox.information( |
375 EricMessageBox.information( |
383 None, |
376 None, |
397 urls = [] |
390 urls = [] |
398 try: |
391 try: |
399 subdomains = result["subdomains"] |
392 subdomains = result["subdomains"] |
400 except KeyError: |
393 except KeyError: |
401 subdomains = [] |
394 subdomains = [] |
|
395 |
|
396 categoriesMapping = { |
|
397 "bitdefender": ("BitDefender category",), |
|
398 "sophos": ("sophos category", "Sophos category"), |
|
399 "valkyrie": ("Comodo Valkyrie Verdict category",), |
|
400 "alpha": ("alphaMountain.ai category",), |
|
401 "forcepoint": ("Forcepoint ThreatSeeker category",), |
|
402 } |
402 categories = {} |
403 categories = {} |
403 for key, vtCategories in categoriesMapping.items(): |
404 for key, vtCategories in categoriesMapping.items(): |
404 for vtCategory in vtCategories: |
405 for vtCategory in vtCategories: |
405 with contextlib.suppress(KeyError): |
406 with contextlib.suppress(KeyError): |
406 categories[key] = result[vtCategory] |
407 categories[key] = result[vtCategory] |
409 categories[key] = "--" |
410 categories[key] = "--" |
410 try: |
411 try: |
411 whois = result["whois"] |
412 whois = result["whois"] |
412 except KeyError: |
413 except KeyError: |
413 whois = "" |
414 whois = "" |
414 # TODO: add "Webutation domain info" with subdict |
415 |
415 # "Adult content" (yes/no) |
416 webutationData = { |
416 # "Safety score" (0-100, integer) |
417 "adult": "--", |
417 # "Verdict" (string) |
418 "safety": "--", |
|
419 "verdict": "--" |
|
420 } |
|
421 with contextlib.suppress(KeyError): |
|
422 webutation = result["Webutation domain info"] |
|
423 with contextlib.suppress(KeyError): |
|
424 webutationData["adult"] = webutation["Adult content"] |
|
425 with contextlib.suppress(KeyError): |
|
426 webutationData["safety"] = webutation["Safety score"] |
|
427 with contextlib.suppress(KeyError): |
|
428 webutationData["verdict"] = webutation["Verdict"] |
418 |
429 |
419 from .VirusTotalDomainReportDialog import ( |
430 from .VirusTotalDomainReportDialog import ( |
420 VirusTotalDomainReportDialog |
431 VirusTotalDomainReportDialog |
421 ) |
432 ) |
422 self.__domainReportDlg = VirusTotalDomainReportDialog( |
433 self.__domainReportDlg = VirusTotalDomainReportDialog( |
423 self.__lastDomain, resolutions, urls, subdomains, |
434 self.__lastDomain, resolutions, urls, subdomains, |
424 categories, whois) |
435 categories, webutationData, whois) |
425 self.__domainReportDlg.show() |
436 self.__domainReportDlg.show() |
426 self.__replies.remove(reply) |
437 self.__replies.remove(reply) |
427 reply.deleteLater() |
438 reply.deleteLater() |
428 |
439 |
429 def close(self): |
440 def close(self): |