Skip to content

Instantly share code, notes, and snippets.

@deekayen
Created December 7, 2020 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deekayen/79f9e45b8f1aeb66a41cbb5162fc0760 to your computer and use it in GitHub Desktop.
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.
#!/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