Skip to content

Commit 1c271f5

Browse files
authored
fix(scoop-virustotal): Adjust json_path parameters to retrieve correct analysis stats (#6044)
1 parent a76884a commit 1c271f5

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
- **sqlite:** Fix compatibility with Windows PowerShell ([#6045](https://github.com/ScoopInstaller/Scoop/issues/6045))
66
- **install:** Expand `env_set` items before setting Environment Variables ([#6050](https://github.com/ScoopInstaller/Scoop/issues/6050))
77
- **bucket:** Implement error handling for failed bucket addition ([#6051](https://github.com/ScoopInstaller/Scoop/issues/6051))
8-
- **install:** Fix parsing error when installing multiple apps w/ specific version ([#6039](https://github.com/ScoopInstaller/Scoop/pull/6039))
8+
- **scoop-virustotal:** Adjust `json_path` parameters to retrieve correct analysis stats ([#6044](https://github.com/ScoopInstaller/Scoop/issues/6044))
9+
- **install:** Fix parsing error when installing multiple apps w/ specific version ([#6039](https://github.com/ScoopInstaller/Scoop/issues/6039))
910

1011
## [v0.5.0](https://github.com/ScoopInstaller/Scoop/compare/v0.4.2...v0.5.0) - 2024-07-01
1112

libexec/scoop-virustotal.ps1

+6-6
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ Function Get-VirusTotalResultByHash ($hash, $url, $app) {
102102
$response = Invoke-WebRequest -Uri $api_url -Method GET -Headers $headers -UseBasicParsing
103103
$result = $response.Content
104104
$stats = json_path $result '$.data.attributes.last_analysis_stats'
105-
[int]$malicious = json_path $stats '$.malicious'
106-
[int]$suspicious = json_path $stats '$.suspicious'
107-
[int]$timeout = json_path $stats '$.timeout'
108-
[int]$undetected = json_path $stats '$.undetected'
105+
[int]$malicious = json_path $stats '$[0].malicious' $null $false $true
106+
[int]$suspicious = json_path $stats '$[0].suspicious' $null $false $true
107+
[int]$timeout = json_path $stats '$[0].timeout' $null $false $true
108+
[int]$undetected = json_path $stats '$[0].undetected' $null $false $true
109109
[int]$unsafe = $malicious + $suspicious
110110
[int]$total = $unsafe + $undetected
111-
[int]$fileSize = json_path $result '$.data.attributes.size'
112-
$report_hash = json_path $result '$.data.attributes.sha256'
111+
[int]$fileSize = json_path $result '$.data.attributes.size' $null $false $true
112+
$report_hash = json_path $result '$.data.attributes.sha256' $null $false $true
113113
$report_url = "https://www.virustotal.com/gui/file/$report_hash"
114114
if ($total -eq 0) {
115115
info "$app`: Analysis in progress."

0 commit comments

Comments
 (0)