Created
April 25, 2022 18:38
-
-
Save wolf128058/092a52112eb9ba9a717d14676f1357bc to your computer and use it in GitHub Desktop.
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 | |
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