Skip to content

Instantly share code, notes, and snippets.

@wolf128058
Created April 25, 2022 18:38
Show Gist options
  • Save wolf128058/092a52112eb9ba9a717d14676f1357bc to your computer and use it in GitHub Desktop.
Save wolf128058/092a52112eb9ba9a717d14676f1357bc to your computer and use it in GitHub Desktop.
#!/bin/bash
USER='MYCONTROLLERUSERNAME'
PASS='MYCONTROLLERPASSWORD'
URL='https://127.0.0.1:8443'
SITE='default'
# LOGIN
curl -s $URL'/api/login' -k -X POST \
-H "Referer: $URL/manage/account/login" \
-H 'Content-Type: application/json; charset=utf-8' \
--cookie-jar cookie.txt \
--data-raw '{"username":"'$USER'","password":"'$PASS'"}' >> /dev/null
# Clients
LIST=$(curl -s $URL'/api/s/'$SITE'/stat/sta/' -k -H "Referer: $URL/manage/account/login" -H 'Content-Type: application/json; charset=utf-8' --cookie cookie.txt)
echo $LIST | jq '.data | length'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment