diff --git a/.github/workflows/virustotal-scan.yml b/.github/workflows/virustotal-scan.yml new file mode 100644 index 000000000..46c0506c7 --- /dev/null +++ b/.github/workflows/virustotal-scan.yml @@ -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 }} \ No newline at end of file diff --git a/VirusTotal_Tests/Flow-Launcher-Setup.exe b/VirusTotal_Tests/Flow-Launcher-Setup.exe new file mode 100644 index 000000000..4be9a47be Binary files /dev/null and b/VirusTotal_Tests/Flow-Launcher-Setup.exe differ diff --git a/ci/envs/requirements-virustotal-setup.txt b/ci/envs/requirements-virustotal-setup.txt new file mode 100644 index 000000000..fd7d3e06f --- /dev/null +++ b/ci/envs/requirements-virustotal-setup.txt @@ -0,0 +1 @@ +requests==2.25.1 \ No newline at end of file diff --git a/ci/src/virustotal_setup.py b/ci/src/virustotal_setup.py new file mode 100644 index 000000000..f2a39f0d4 --- /dev/null +++ b/ci/src/virustotal_setup.py @@ -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) \ No newline at end of file