Skip to content

Commit

Permalink
Remove Invoke-Expression from Get-FileFromUri
Browse files Browse the repository at this point in the history
  • Loading branch information
reuteras committed Jan 17, 2024
1 parent ec876a6 commit f8efe0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 7 additions & 3 deletions resources/download/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function Get-FileFromUri {
} else {
$GH_FLAG = ""
}

if ($Uri -like "*sourceforge.net*") {
$UA_FLAG = '--user-agent "Wget x64"'
} else {
Expand All @@ -109,8 +109,12 @@ function Get-FileFromUri {
# Download from Visual Studio Marketplace
Invoke-WebRequest -uri $Uri -outfile $TmpFilePath -RetryIntervalSec 20 -MaximumRetryCount 3
} else {
Invoke-Expression -Command "curl.exe $ETAG_FLAG $Z_FLAG $GH_FLAG $UA_FLAG --silent -L --output $TmpFilePath $Uri"
}
$CMD = "curl.exe"
$FLAGS = @()
(Write-Output "$ETAG_FLAG $Z_FLAG $GH_FLAG $UA_FLAG --silent -L --output $TmpFilePath $Uri").split(" ") | ForEach-Object {if ("" -ne $_ ) {$FLAGS += $_}}
& $CMD $FLAGS
Get-Job | Remove-Job | Out-Null
}
if (Test-Path $TmpFilePath) {
Write-SynchronizedLog "Downloaded $Uri to $FilePath."
$downloaded = $true
Expand Down
4 changes: 0 additions & 4 deletions resources/download/http.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,6 @@ if (Test-Path -Path $TOOLS\hashcat) {
}
Move-Item $TOOLS\hashcat-* $TOOLS\hashcat

# https://www.winitor.com/download2 - PEStudio
Get-FileFromUri -uri "https://www.winitor.com/tools/pestudio/current/pestudio-9.57.zip" -FilePath ".\downloads\pestudio.zip" -CheckURL "Yes"
& "$env:ProgramFiles\7-Zip\7z.exe" x -aoa "$SETUP_PATH\pestudio.zip" -o"$TOOLS" | Out-Null

# ELK
$ELK_VERSION = "8.11.4"
Set-Content -Path ".\downloads\elk_version.txt" -Value "${ELK_VERSION}"
Expand Down

0 comments on commit f8efe0f

Please sign in to comment.