Skip to content

Commit d73be69

Browse files
committed
fix(scoop-virustotal): Adjust json paths to retrieve correct analysis stats in VirusTotal script
1 parent 7cc4fae commit d73be69

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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)