From 39916f408a6e43d616cfe702003b457ef6da6e2b Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 13:46:22 +0100 Subject: [PATCH 1/7] Change VirusTotal publish folder --- .github/workflows/cd.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 6f8f824c..c71cb9e2 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -102,10 +102,11 @@ jobs: shell: pwsh run: | $apiKey = "${{ secrets.VIRUSTOTAL_APIKEY }}" + cd Publish $uploadUrlResponse = curl https://www.virustotal.com/api/v3/files/upload_url -H x-apikey:"$apiKey" $uploadUrlJson = $uploadUrlResponse | ConvertFrom-Json $uploadUrl = $uploadUrlJson.data - $uploadResponse = curl --request POST --header x-apikey:"$apiKey" --header 'content-type: multipart/form-data' --form file='@.\Publish\daybreakv${{ env.Version }}' --url $uploadUrl + $uploadResponse = curl --request POST --header x-apikey:"$apiKey" --header 'content-type: multipart/form-data' --form file='@daybreakv${{ env.Version }}' --url $uploadUrl $uploadResponseJson = $uploadResponse | ConvertFrom-Json $resultsUrl = "https://www.virustotal.com/api/v3/analyses/$($uploadResponseJson.data.id)" # Poll the results until the status is "completed" @@ -113,13 +114,14 @@ jobs: while ($status -ne "completed") { Start-Sleep -Seconds 10 # Wait for 10 seconds between checks $results = curl --header x-apikey:"$apiKey" --url $resultsUrl + $results $resultsJson = $results | ConvertFrom-Json $status = $resultsJson.data.attributes.status Write-Host "Current status: $status" } - $resultsJson.data.attributes.results | ConvertTo-Json | Out-File -FilePath ".\Publish\VirusTotal.Results.json" -Encoding UTF8 - $resultsJson.data.attributes.stats | ConvertTo-Json | Out-File -FilePath ".\Publish\VirusTotal.Stats.json" -Encoding UTF8 + $resultsJson.data.attributes.results | ConvertTo-Json | Out-File -FilePath "VirusTotal.Results.json" -Encoding UTF8 + $resultsJson.data.attributes.stats | ConvertTo-Json | Out-File -FilePath "VirusTotal.Stats.json" -Encoding UTF8 $stats = $resultsJson.data.attributes.stats echo "::set-env name=VirusTotalStats::$stats" From f8543a9b9c3774d936a01a72e832d0fd223385c3 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 13:53:52 +0100 Subject: [PATCH 2/7] Debug files --- .github/workflows/cd.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 655e0f3d..dd89876d 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -103,6 +103,7 @@ jobs: run: | $apiKey = "${{ secrets.VIRUSTOTAL_APIKEY }}" cd Publish + ls $uploadUrlResponse = curl https://www.virustotal.com/api/v3/files/upload_url -H x-apikey:"$apiKey" $uploadUrlResponse $uploadUrlJson = $uploadUrlResponse | ConvertFrom-Json From 96e3849e264087e5fa02848bd0bf115c8636e728 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 14:01:50 +0100 Subject: [PATCH 3/7] Extract name in different variable --- .github/workflows/cd.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index dd89876d..14655e2d 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -102,13 +102,15 @@ jobs: shell: pwsh run: | $apiKey = "${{ secrets.VIRUSTOTAL_APIKEY }}" + $archiveName = "daybreakv${{ env.Version }}" + $archiveName cd Publish ls $uploadUrlResponse = curl https://www.virustotal.com/api/v3/files/upload_url -H x-apikey:"$apiKey" $uploadUrlResponse $uploadUrlJson = $uploadUrlResponse | ConvertFrom-Json $uploadUrl = $uploadUrlJson.data - $uploadResponse = curl --request POST --header x-apikey:"$apiKey" --header 'content-type: multipart/form-data' --form file='@daybreakv${{ env.Version }}' --url $uploadUrl + $uploadResponse = curl --request POST --header x-apikey:"$apiKey" --header 'content-type: multipart/form-data' --form file="@$archiveName" --url $uploadUrl $uploadResponse $uploadResponseJson = $uploadResponse | ConvertFrom-Json $resultsUrl = "https://www.virustotal.com/api/v3/analyses/$($uploadResponseJson.data.id)" From 510518fafeca0f63280bc413177d70a7e30ac84a Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 14:10:57 +0100 Subject: [PATCH 4/7] Fix file name --- .github/workflows/cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 14655e2d..cd71b0f6 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -102,7 +102,7 @@ jobs: shell: pwsh run: | $apiKey = "${{ secrets.VIRUSTOTAL_APIKEY }}" - $archiveName = "daybreakv${{ env.Version }}" + $archiveName = "daybreakv${{ env.Version }}.zip" $archiveName cd Publish ls From 739f165be4b7982882bce98334d4df4e91d06e2a Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 14:22:16 +0100 Subject: [PATCH 5/7] Cleanup debug info --- .github/workflows/cd.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index cd71b0f6..872d979f 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -103,9 +103,6 @@ jobs: run: | $apiKey = "${{ secrets.VIRUSTOTAL_APIKEY }}" $archiveName = "daybreakv${{ env.Version }}.zip" - $archiveName - cd Publish - ls $uploadUrlResponse = curl https://www.virustotal.com/api/v3/files/upload_url -H x-apikey:"$apiKey" $uploadUrlResponse $uploadUrlJson = $uploadUrlResponse | ConvertFrom-Json From d3d97ed85d0ece020a232a2e102a61a10ceaeb3f Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 14:31:13 +0100 Subject: [PATCH 6/7] Fix assets upload --- .github/workflows/cd.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 872d979f..96704005 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -140,10 +140,7 @@ jobs: mode: update tag_name: v${{ env.Version }} release_name: Daybreak v${{ env.Version }} - assets: | - .\Publish\daybreakv${{ env.Version }}.zip - .\Publish\VirusTotal.Results.json - .\Publish\VirusTotal.Stats.json + assets: .\Publish\daybreakv${{ env.Version }}.zip;.\Publish\VirusTotal.Results.json;.\Publish\VirusTotal.Stats.json github_token: ${{ env.GITHUB_TOKEN }} replace_assets: true body_mrkdwn: | From ede6a2b80d247f508246ddf774ef14f6690579fd Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Wed, 11 Dec 2024 17:03:38 +0100 Subject: [PATCH 7/7] Fix directory --- .github/workflows/cd.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 96704005..abcb2824 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -101,6 +101,7 @@ jobs: - name: Submit virustotal scan shell: pwsh run: | + cd Publish $apiKey = "${{ secrets.VIRUSTOTAL_APIKEY }}" $archiveName = "daybreakv${{ env.Version }}.zip" $uploadUrlResponse = curl https://www.virustotal.com/api/v3/files/upload_url -H x-apikey:"$apiKey"