Repository navigation
VirusTotal Badge for GitHub Release Assets #27
Replies: 6 comments 20 replies
|
@ReenigneArcher I added all of these features. For the file/id endpoint I used a short version of the hash as the default label because I was not sure what else to use, open to ideas. This can always be set with the
The These endpoints have been added to the badge "generator": https://smashedr.github.io/node-badges-docs/guides/get-started I also added a color gradient source. PS: I will most likely find and use a library to generate color spreads. The message and color are generated like this: const message = `${stats.malicious}/${stats.suspicious}/${stats.undetected}`
query.color = query.color || getBadGradient(stats.malicious + stats.suspicious)Let me know if this is what you wanted and If you have any more suggestions. Everything, including default message, colors, etc are all up for discussion. |
|
@ReenigneArcher I updated the color's on detected files to use chroma.js, be fully dynamic and user configurable. I tried to explain most of in the middle of this section of the README.md. I set the default 0 to badge brightgreen, with a default of 8, before turning badge red. Any number in-between would be dynamic color based on the range. You can also customize the the Lastly, I made a color tester to test the https://badges.cssnr.com/colors/0 Let me know if you run into any issues, or have any feedback on defaults. |
|
@ReenigneArcher I have an important update. I finally found out the difference in using the VirusTotal ID vs the File Hash to get the report. Getting reports with the VirusTotal ID consumes an API call against quota (like uploading a file for analysis). This quota is limited to 500 calls per day for free accounts. However, getting a report from the File Hash does NOT. This means the only way to scale this is to require the use of File Hashes, at least for the public instance I host. TLDR: We need to use file hashes at
- name: 'VirusTotal'
uses: cssnr/virustotal-action@v1
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
sha256: true
[
{
"id": "MGM1YTkxMzc5OGU3Y2UyNjViNTkxYzY5OTZmNTg3NjI6MTc2MDEyMzYzOA==",
"name": "README.md",
"link": "https://www.virustotal.com/gui/file-analysis/MGM1YTkxMzc5OGU3Y2UyNjViNTkxYzY5OTZmNTg3NjI6MTc2MDEyMzYzOA==",
"sha256": "75f762919859572abf753008cc5a1f5b75e05e9d0876080c0d28b2338ca46c26"
}
]
For this example the resulting badge and URL would be: PS: I refactored the endpoint But moving forward, we NEED to use File Hashes. Its the only way to make this scalable. Again, no rush, its all backwards compatible. As always, let me know if you have any questions, suggestions or run into any issues. |
|
Just an FYI: I am working on a Grafana Dashboard for the app. https://cssnr.grafana.net/public-dashboards/8a24a95171fe4127ada92afb071b9331 I launched a new version yesterday with stats (just badges created) and send that stat every hour, which lets me calculate the "Badges per Hour" graph. The interval can be increased, and most likely will be increased. I just wanted to get some stats flowing and the total count started. The live count is displays on the app index: https://badges.cssnr.com/ I also added the app response time graph by using Telegraf Less relevant, I will also add Docker Stats (CPU/Memory/IO) once I get a chance to update the Telegraf config on the swarm host with |
|
@smashedr I noticed the badges are not working. Is it a known issue? |






Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I had an idea for a VirusTotal Badge. The idea is you specify a release asset, and it always shows the scan results for the latest release of that asset. This way the badge URL would never change, and it would always display the results from the latest release.
Under the hood this works by getting the latest release, getting the asset, extracting the digest, SHA256 hash, then querying the VirusTotal API for the results. There is no dynamic link directly to VirusTotal; however, you can always link to your latest release, which should have the VirusTotal file links (if release notes are enabled).
Badge Generator: https://smashedr.github.io/node-badges-docs/guides/get-started
Source Code: https://github.com/smashedr/node-badges
PS: Node Badges is designed to show badges not available by shields.io but uses their badge-generator so the look and feel are the same. I also added Lucide Icons on top of Simple Icons.
Let me know if anyone has any suggestions or ideas for this, like specifying a release tag instead of using latest.
VirusTotal API Response Data
{ "data": { "id": "5ba94e02eb78c159c34721e43a2f4c5e668f3f5e77bfe89b65090a67ec33faaf", "type": "file", "links": { "self": "https://www.virustotal.com/api/v3/files/5ba94e02eb78c159c34721e43a2f4c5e668f3f5e77bfe89b65090a67ec33faaf" }, "attributes": { "last_analysis_date": 1759964327, "last_analysis_stats": { "malicious": 0, "suspicious": 0, "undetected": 61, "harmless": 0, "timeout": 0, "confirmed-timeout": 0, "failure": 0, "type-unsupported": 15 }, "tags": [ "png" ], "last_analysis_results": { }, "magika": "PNG", "meaningful_name": "tux.png", "filecondis": { "raw_md5": "d211ee9a46870510e011f0d54272d25e", "dhash": "00080c0c0e0e0702" }, "last_modification_date": 1759964363, "names": [ "tux.png" ], "reputation": 0, "sha256": "5ba94e02eb78c159c34721e43a2f4c5e668f3f5e77bfe89b65090a67ec33faaf", "times_submitted": 1, "last_submission_date": 1759964327, "type_tags": [ "multimedia", "image", "png" ], "tlsh": "T1EF931227A078832BB2F5630746D848A90276FDF4597BE9C6004A52D1D7F09EF15EE2CD", "ssdeep": "1536:T2Nbf+SfMXA7pYwYFzv3L3DnbldoisfPU85q5Qfbc1QoqljSpapmYgTWzDMVA:T2NlosPYNlsXz4efGql30nWUA", "type_description": "PNG", "unique_sources": 1, "md5": "69253a2e5cd2e2c88999abc966d132a9", "size": 93464, "type_extension": "png", "magic": "PNG image data, 256 x 256, 8-bit/color RGBA, non-interlaced", "type_tag": "png", "first_submission_date": 1759964327, "total_votes": { "harmless": 0, "malicious": 0 }, "sha1": "fcd9b373e7bc51ae0c9285cf7766a0bde0a3c5c8", "trid": [ { "file_type": "Portable Network Graphics", "probability": 100 } ] } } }All reactions