This is an script to download CVE notes from Grafeas. Could be really handy if you need to populate your Grafeas instance with some initial information
Last active
August 22, 2019 12:50
-
-
Save judavi/e9fdff2b9d57048e5162e2872c88089c to your computer and use it in GitHub Desktop.
Download CVE notes from Grafeas API in Google Container registry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This will insert all the CVE.json files in your grafeas instance | |
for entry in *.json | |
do | |
echo "$entry" | |
name="${entry/.json/}" | |
echo $name | |
URL="https://grafeas.url/v1beta1/projects/goog-vulnz/notes?note_id=$name" | |
echo $URL | |
curl -X POST $URL -H "accept: application/json" -H "Content-Type: application/json" -d @$entry | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cve=( | |
'CVE-2015-2730' | |
'CVE-2016-6153' | |
) | |
# | |
# Count the number of possible testers. | |
# (Loop until we find an empty string.) | |
# | |
total=${#cve[*]} | |
for f in "${cve[@]}" | |
do | |
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://containeranalysis.googleapis.com/v1beta1/projects/goog-vulnz/notes/$f" >> $f.json | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment