Skip to content

Commit

Permalink
Once finished, have AppVeyor upload the installer to VirusTotal
Browse files Browse the repository at this point in the history
  • Loading branch information
datadiode committed Oct 4, 2023
1 parent 09a6b8f commit f697a0b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ build:

after_build:
- Installer\MakeSetup.bat
- bash.exe %APPVEYOR_BUILD_FOLDER%\virustotal_upload %APPVEYOR_BUILD_FOLDER%\Installer\OpennessWebView2.exe %APPVEYOR_BUILD_FOLDER%\Installer\virustotal_report.json

artifacts:
- path: BrowserProxy\$(configuration)\OpennessWebView2.dll
- path: Installer\OpennessWebView2.exe
- path: Installer\virustotal_report.json
31 changes: 31 additions & 0 deletions virustotal_upload
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Upload a sample to VirusTotal and print the report.
# Modified from https://gist.github.com/luca-m/c6837cb0f8656714b7ff.
#
# Dependencies:
#
# * curl
# * VirusTotal API key
#

echo "Uploading $1 to VirusTotal"

vt_hash=$(curl -\# -X POST 'https://www.virustotal.com/vtapi/v2/file/scan' \
--form apikey="$VIRUSTOTAL_API_KEY" \
--form file=@"$1" | grep -o '"[0-9|a-f]\{64\}"' | head -1 | sed 's/"//g')

echo "SHA256:${vt_hash} - waiting for report.."

while [[ "$vt_hash" != "" ]] do
sleep 10
response=$(curl -sX POST 'https://www.virustotal.com/vtapi/v2/file/report' \
--form apikey="$VIRUSTOTAL_API_KEY" \
--form resource="$vt_hash")

if (echo -n "$response" | grep -q 'Scan finished'); then
echo "$response" | tee "$2"
break;
fi
date
done

0 comments on commit f697a0b

Please sign in to comment.