Created
December 7, 2020 19:38
-
-
Save deekayen/79f9e45b8f1aeb66a41cbb5162fc0760 to your computer and use it in GitHub Desktop.
Pull CSV output from the Twistlock API to list vulnerabilities in runtime images and their hosts. Prints to screen.
This file contains 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
#!/bin/bash | |
API="us-east1.cloud.twistlock.com/us-2-158255947" | |
echo "Logging in..." | |
JWT="$(curl -s \ | |
-H "Content-Type: application/json" \ | |
-X POST \ | |
-d \ | |
'{ | |
"username":"69b41111-asdf-asdf-asdf-asdfadsf3ee9", | |
"password":"SsrsasdfkQ2K8sUzWbk8jsbyteQ=" | |
}' \ | |
https://${API}/api/v1/authenticate \ | |
| jq '.["token"]' \ | |
| tr -d '"')" | |
echo "Download all image scan reports in CSV format..." | |
curl \ | |
-H "Authorization: Bearer ${JWT}" \ | |
-H 'Content-Type: application/json' \ | |
-X GET \ | |
https://${API}/api/v1/images/download | |
echo "Download all host scan reports in CSV format..." | |
curl \ | |
-H "Authorization: Bearer ${JWT}" \ | |
-H 'Content-Type: application/json' \ | |
-X GET \ | |
https://${API}/api/v1/hosts/download |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment