-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(virustotal): automatic Virustotal check as option #6525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
felicijus
wants to merge
13
commits into
ScoopInstaller:develop
Choose a base branch
from
felicijus:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+463
−368
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9b102f9
refactor(virustotal): move VirusTotal functionality into a lib
felicijus daefa4a
refactor(virustotal): extract virustotal check for one url
felicijus 08d22f2
feat(virustotal): integrate VirusTotal checks into download and insta…
felicijus 934f9bd
refactor(download): move hash-related functions to seperate lib file,…
felicijus 81531de
feat(CHANGELOG): update to include VirusTotal refactor and pre-downlo…
felicijus e8003ac
refactor(download): move API key retrieval inside VirusTotal check
felicijus f143dad
feat(virustotal): integrate VirusTotal URL checks into Aria2 download
felicijus 15d99e7
fix(config): update VirusTotal usage description to reflect pre-downl…
felicijus 4b9e3f1
fix(virustotal): update report structure to include malicious and sus…
felicijus 9784acd
fix(virustotal): 'FileReort.Total' should be 'FileReport.Total' (miss…
felicijus e87839e
refactor(helper): create helper folder for scripts with helper functions
felicijus ee8d875
fix(scoop-download): get urls first
felicijus ba8bb50
fix(virustotal): common exit_code handling
felicijus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ### Remote file information | ||
|
|
||
| function Get-RemoteFileSize ($Uri) { | ||
| $response = Invoke-WebRequest -Uri $Uri -Method HEAD -UseBasicParsing | ||
| if (!$response.Headers.StatusCode) { | ||
| $response.Headers.'Content-Length' | ForEach-Object { [int]$_ } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ### Hash-related functions | ||
|
|
||
| function hash_for_url($manifest, $url, $arch) { | ||
| $hashes = @(hash $manifest $arch) | Where-Object { $_ -ne $null } | ||
|
|
||
| if ($hashes.length -eq 0) { return $null } | ||
|
|
||
| $urls = @(script:url $manifest $arch) | ||
|
|
||
| $index = [array]::IndexOf($urls, $url) | ||
| if ($index -eq -1) { abort "Couldn't find hash in manifest for '$url'." } | ||
|
|
||
| @($hashes)[$index] | ||
| } | ||
|
|
||
| function get_hash([String] $multihash) { | ||
| $type, $hash = $multihash -split ':' | ||
| if (!$hash) { | ||
| # no type specified, assume sha256 | ||
| $type, $hash = 'sha256', $multihash | ||
| } | ||
|
|
||
| if (@('md5', 'sha1', 'sha256', 'sha512') -notcontains $type) { | ||
| return $null, "Hash type '$type' isn't supported." | ||
| } | ||
|
|
||
| return $type, $hash.ToLower() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the StatusCode check logic.
The condition on line 5 checks
!$response.Headers.StatusCode, butStatusCodeis not a header—it's a property of the response object itself ($response.StatusCode). This check will likely always evaluate to true (sinceHeaders.StatusCodedoesn't exist), causing the function to returnContent-Lengthunconditionally.Apply this diff to fix the logic:
function Get-RemoteFileSize ($Uri) { $response = Invoke-WebRequest -Uri $Uri -Method HEAD -UseBasicParsing - if (!$response.Headers.StatusCode) { + if ($response.StatusCode -eq 200) { $response.Headers.'Content-Length' | ForEach-Object { [int]$_ } } }📝 Committable suggestion
🤖 Prompt for AI Agents