11 import json |
11 import json |
12 |
12 |
13 from PyQt6.QtCore import pyqtSignal, QObject, QUrl, QUrlQuery, QByteArray |
13 from PyQt6.QtCore import pyqtSignal, QObject, QUrl, QUrlQuery, QByteArray |
14 from PyQt6.QtNetwork import QNetworkRequest, QNetworkReply |
14 from PyQt6.QtNetwork import QNetworkRequest, QNetworkReply |
15 |
15 |
16 from E5Gui import E5MessageBox |
16 from E5Gui import EricMessageBox |
17 |
17 |
18 import Preferences |
18 import Preferences |
19 |
19 |
20 |
20 |
21 class VirusTotalAPI(QObject): |
21 class VirusTotalAPI(QObject): |
304 @type QNetworkReply |
304 @type QNetworkReply |
305 """ |
305 """ |
306 if reply.error() == QNetworkReply.NetworkError.NoError: |
306 if reply.error() == QNetworkReply.NetworkError.NoError: |
307 result = json.loads(str(reply.readAll(), "utf-8")) |
307 result = json.loads(str(reply.readAll(), "utf-8")) |
308 if result["response_code"] == 0: |
308 if result["response_code"] == 0: |
309 E5MessageBox.information( |
309 EricMessageBox.information( |
310 None, |
310 None, |
311 self.tr("VirusTotal IP Address Report"), |
311 self.tr("VirusTotal IP Address Report"), |
312 self.tr("""VirusTotal does not have any information for""" |
312 self.tr("""VirusTotal does not have any information for""" |
313 """ the given IP address.""")) |
313 """ the given IP address.""")) |
314 elif result["response_code"] == -1: |
314 elif result["response_code"] == -1: |
315 E5MessageBox.information( |
315 EricMessageBox.information( |
316 None, |
316 None, |
317 self.tr("VirusTotal IP Address Report"), |
317 self.tr("VirusTotal IP Address Report"), |
318 self.tr("""The submitted IP address is invalid.""")) |
318 self.tr("""The submitted IP address is invalid.""")) |
319 else: |
319 else: |
320 owner = result["as_owner"] |
320 owner = result["as_owner"] |
366 @type QNetworkReply |
366 @type QNetworkReply |
367 """ |
367 """ |
368 if reply.error() == QNetworkReply.NetworkError.NoError: |
368 if reply.error() == QNetworkReply.NetworkError.NoError: |
369 result = json.loads(str(reply.readAll(), "utf-8")) |
369 result = json.loads(str(reply.readAll(), "utf-8")) |
370 if result["response_code"] == 0: |
370 if result["response_code"] == 0: |
371 E5MessageBox.information( |
371 EricMessageBox.information( |
372 None, |
372 None, |
373 self.tr("VirusTotal Domain Report"), |
373 self.tr("VirusTotal Domain Report"), |
374 self.tr("""VirusTotal does not have any information for""" |
374 self.tr("""VirusTotal does not have any information for""" |
375 """ the given domain.""")) |
375 """ the given domain.""")) |
376 elif result["response_code"] == -1: |
376 elif result["response_code"] == -1: |
377 E5MessageBox.information( |
377 EricMessageBox.information( |
378 None, |
378 None, |
379 self.tr("VirusTotal Domain Report"), |
379 self.tr("VirusTotal Domain Report"), |
380 self.tr("""The submitted domain address is invalid.""")) |
380 self.tr("""The submitted domain address is invalid.""")) |
381 else: |
381 else: |
382 resolutions = result["resolutions"] |
382 resolutions = result["resolutions"] |