-
-
Save taidos/74f4186483518a86e1f60186bdcf2306 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
<?php | |
$user = "root"; | |
$token = "YOURTOKENHERE"; | |
$query = "https://YOURIP:YOURPORT/json-api/listaccts?api.version=1"; | |
//json-api/listaccts -- generic info, disk usage, start date, domain, | |
//get_disk_usage -- disk usage obviously | |
//showbw -- bandwidth | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); | |
$header[0] = "Authorization: whm $user:$token"; | |
curl_setopt($curl,CURLOPT_HTTPHEADER,$header); | |
curl_setopt($curl, CURLOPT_URL, $query); | |
$result = curl_exec($curl); | |
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE); | |
if ($http_status != 200) { | |
echo "[!] Error: " . $http_status . " returned\n"; | |
} else { | |
$json = json_decode($result); | |
echo $result; | |
// echo "[+] Current cPanel users on the system:\n"; | |
// foreach ($json->{'data'}->{'acct'} as $userdetails) { | |
// echo "\t" . $userdetails->{'user'} . "</br>"; | |
// } | |
} | |
curl_close($curl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment