Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pull CSV output from the Twistlock API to list vulnerabilities in runtime images and their hosts. Prints to screen.
#!/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