Skip to content

Instantly share code, notes, and snippets.

@jspeed-meyers
Created September 25, 2022 22:51
Show Gist options
  • Save jspeed-meyers/dc851bded23ed0c29b5f9f18b8cfd954 to your computer and use it in GitHub Desktop.
Save jspeed-meyers/dc851bded23ed0c29b5f9f18b8cfd954 to your computer and use it in GitHub Desktop.
for rumble data, calculate cve reduction percentage
"""Calculate percentage reduction in cve's by image
Contact John Speed Meyers or Josh Dolitsky for further information.
"""
import pandas as pd
df = pd.read_csv("rumble-2022-08-16-2022-09-14.csv")
IMAGE_LIST = [
["cgr.dev/chainguard/php:latest", "php:latest"],
["cgr.dev/chainguard/go:latest", "golang:latest"],
["cgr.dev/chainguard/nginx:latest", "nginx:latest"],
]
print("\nARE YOU READY TO RUMBLE?\n")
for image in IMAGE_LIST:
competitor_vulns = df[df.image == image[1]]["tot_cve_cnt"].sum()
chainguard_vulns = df[df.image == image[0]]["tot_cve_cnt"].sum()
percentage_reduction = (
(competitor_vulns - chainguard_vulns) / competitor_vulns * 100
)
# round to one digit to avoid excessive precision
percentage_reduction = round(percentage_reduction, 1)
print(image[1])
print(f"# vulns: {competitor_vulns}")
print(image[0])
print(f"# vulns: {chainguard_vulns}")
print(f"% vuln reduction: {percentage_reduction}")
print("")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment