diff --git a/appveyor.yml b/appveyor.yml index 099af44..76448e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 diff --git a/virustotal_upload b/virustotal_upload new file mode 100644 index 0000000..86cddbe --- /dev/null +++ b/virustotal_upload @@ -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