Skip to content
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

Add VirusTotal scan action workflow #458

Draft
wants to merge 11 commits into
base: plugin_api_v2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/virustotal-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: VirusTotal Scan

on:
workflow_dispatch:
pull_request:
paths:
- plugins/**
push: #<=============

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

# - name: Set up Go
# uses: actions/setup-go@v4

- name: Download All Plugins
run: |
pip install -r ci/envs/requirements-virustotal-setup.txt
python ./ci/src/virustotal_setup.py

- name: VirusTotal Scan
uses: crazy-max/ghaction-virustotal@v4
id: vt
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
files: |
./VirusTotal_Tests/*

- name: 'Echo Analysis Links'
run: echo ${{ steps.vt.outputs.analysis }}
Binary file added VirusTotal_Tests/Flow-Launcher-Setup.exe
Binary file not shown.
1 change: 1 addition & 0 deletions ci/envs/requirements-virustotal-setup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests==2.25.1
21 changes: 21 additions & 0 deletions ci/src/virustotal_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import requests
from pathlib import Path
import os
import sys

def setup_virustotal_scan_items(github_token: str = "") -> None:
token = github_token or os.getenv("GITHUB_TOKEN")
headers = {"authorization": f"token {token}"}
url = "https://github.com/mjtimblin/Flow.Launcher.Plugin.AwsToolkit/releases/download/v1.0.3/Flow.Launcher.Plugin.AwsToolkit.zip"
res = requests.get(url, headers)
res.raise_for_status()

Path("./VirusTotal_Tests").mkdir(parents=True, exist_ok=True)
with open(f"./VirusTotal_Tests/{url.split('/')[-1]}", "wb") as f:
f.write(res.content)

if __name__ == "__main__":
github_token = str(sys.argv[1]) if len(sys.argv) > 1 else ""
if not github_token:
print("Not using token")
setup_virustotal_scan_items(github_token)