Skip to content
Prev Previous commit
Next Next commit
better track scans totals
  • Loading branch information
seanbudd committed Sep 23, 2025
commit 937340115a30540f6b8af380851f7ac9447a6289
25 changes: 25 additions & 0 deletions source/addonStore/models/scanResults.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ class VirusTotalScanResults:
scanUrl: str
malicious: int
undetected: int
harmless: int
suspicious: int
failure: int
timeout: int
confirmedTimeout: int = 0
typeUnsupported: int = 0
Comment thread
seanbudd marked this conversation as resolved.
Outdated

@classmethod
def fromDict(cls, addon: dict[str, Any]) -> "VirusTotalScanResults | None":
Expand All @@ -21,6 +27,25 @@ def fromDict(cls, addon: dict[str, Any]) -> "VirusTotalScanResults | None":
scanUrl=addon["vtScanUrl"],
malicious=analysisStats["malicious"],
undetected=analysisStats["undetected"],
harmless=analysisStats["harmless"],
suspicious=analysisStats["suspicious"],
failure=analysisStats["failure"],
timeout=analysisStats["timeout"],
confirmedTimeout=analysisStats["confirmed-timeout"],
typeUnsupported=analysisStats["type-unsupported"],
)
except KeyError:
return None

@property
def totalScans(self) -> int:
return (
self.malicious
+ self.undetected
+ self.harmless
+ self.suspicious
Comment thread
seanbudd marked this conversation as resolved.
Outdated
)

@property
def totalFlagged(self) -> int:
return self.malicious + self.suspicious
4 changes: 2 additions & 2 deletions source/gui/addonStoreGui/controls/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ def _refresh(self):
"addonStore",
"{malicious} out of {total} malware scanners detected this add-on as malicious.",
Comment thread
seanbudd marked this conversation as resolved.
Outdated
).format(
malicious=details.scanResults.malicious,
total=details.scanResults.malicious + details.scanResults.undetected,
malicious=details.scanResults.totalFlagged,
total=details.scanResults.totalScans,
),
)
self._appendDetailsLabelValue(
Expand Down
Loading