-
-
Save qrwteyrutiyoup/0020630dcdcd0ef42eb7 to your computer and use it in GitHub Desktop.
dragon.sh
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
#!/usr/bin/env bash | |
# Sensitive information. | |
username='' # Add your SecureDragon WHMCS user here. | |
password='' # Add your SecureDragon WHMCS pass here. | |
# General stuff. | |
url_login='https://securedragon.net/clients/dologin.php' | |
url_clientarea='https://securedragon.net/clients/clientarea.php' | |
url_wyvern=${url_clientarea}'?action=productdetails&id=' # Add the ID here. | |
cookie='cookie.txt' | |
args="${1}" | |
function whmcs_login() { | |
local token=$(curl -s -c ${cookie} ${url_clientarea} | grep token | cut -d '"' -f 6) | |
curl -s -b ${cookie} -e ${url_clientarea} -d "token=${token}&username=${username}&password=${password}" ${url_login} | |
} | |
function wyvern_bw() { | |
if [[ ! -f ${cookie} ]] || [[ ${args} = 'login' ]]; then | |
whmcs_login | |
fi | |
curl -s -b ${cookie} ${url_wyvern} | grep 'Bandwidth Usage' | cut -d '>' -f 8 | cut -d '<' -f 1 | |
} | |
wyvern_bw | |
# vim:set ts=2 sw=2 et: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment