Skip to content

Commit f697a0b

Browse files
committed
Once finished, have AppVeyor upload the installer to VirusTotal
1 parent 09a6b8f commit f697a0b

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ build:
1515

1616
after_build:
1717
- Installer\MakeSetup.bat
18+
- bash.exe %APPVEYOR_BUILD_FOLDER%\virustotal_upload %APPVEYOR_BUILD_FOLDER%\Installer\OpennessWebView2.exe %APPVEYOR_BUILD_FOLDER%\Installer\virustotal_report.json
1819

1920
artifacts:
2021
- path: BrowserProxy\$(configuration)\OpennessWebView2.dll
2122
- path: Installer\OpennessWebView2.exe
23+
- path: Installer\virustotal_report.json

virustotal_upload

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Upload a sample to VirusTotal and print the report.
4+
# Modified from https://gist.github.com/luca-m/c6837cb0f8656714b7ff.
5+
#
6+
# Dependencies:
7+
#
8+
# * curl
9+
# * VirusTotal API key
10+
#
11+
12+
echo "Uploading $1 to VirusTotal"
13+
14+
vt_hash=$(curl -\# -X POST 'https://www.virustotal.com/vtapi/v2/file/scan' \
15+
--form apikey="$VIRUSTOTAL_API_KEY" \
16+
--form file=@"$1" | grep -o '"[0-9|a-f]\{64\}"' | head -1 | sed 's/"//g')
17+
18+
echo "SHA256:${vt_hash} - waiting for report.."
19+
20+
while [[ "$vt_hash" != "" ]] do
21+
sleep 10
22+
response=$(curl -sX POST 'https://www.virustotal.com/vtapi/v2/file/report' \
23+
--form apikey="$VIRUSTOTAL_API_KEY" \
24+
--form resource="$vt_hash")
25+
26+
if (echo -n "$response" | grep -q 'Scan finished'); then
27+
echo "$response" | tee "$2"
28+
break;
29+
fi
30+
date
31+
done

0 commit comments

Comments
 (0)