Skip to content

Instantly share code, notes, and snippets.

@HokieGeek
Last active July 9, 2019 12:44
Show Gist options
  • Save HokieGeek/be1021b8e02d936560cebbe82fb9ae9d to your computer and use it in GitHub Desktop.
Save HokieGeek/be1021b8e02d936560cebbe82fb9ae9d to your computer and use it in GitHub Desktop.
Generate support zip for Nexus IQ
#!/bin/bash
iq_host=${1:-"http://localhost:8070"}
user_pwd=${2:-"admin:admin123"}
cookies=$(mktemp)
trap 'rm -f ${cookies}' EXIT
## Create session
curl --verbose \
--user ${user_pwd} \
--cookie-jar ${cookies} --cookie ${cookies} \
"http://${iq_host}/rest/user/session"
## Import the policies with the given session
curl --verbose \
--user ${user_pwd} \
--cookie-jar ${cookies} --cookie ${cookies} \
--header "X-CSRF-TOKEN: $(awk '/CLM-CSRF-TOKEN/ { print $NF }' ${cookies})" \
-o ./nexus-iq-support_$(date +%Y%m%d-%H%M).zip \
"${iq_host}/rest/support?noLimit=true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment