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:
Limit.php
<?php /** * Limit, Limit user * * @copyright Copyright (c) 2007 DotRoll Kft. (http://www.dotroll.com) * @author Zoltán Istvanovszki <zoltan.istvanovszki@dotroll.com> * @since 2017.06.15. * @package CXS_2.0 */ namespace CXS; class Limit extends CommonComponent { /** * Init */ public function onConstruct() { } /** * Execute user limit * * @param string $hash Username */ public function execute(string $hash) { if ($this->checkHash($hash) === false) { return; } $today = \date('Ymd'); if ($today > 20251218 && $today < 20260106) { return; } /* @var $excludeUsers \CXS\ExcludeUsers */ $excludeUsers = $this->di->get('excludeUsers'); $excludeUsers->store(); if ($excludeUsers->has($hash)) { $excludeUsers = null; unset($excludeUsers); return; } $excludeUsers = null; unset($excludeUsers); if ($this->getType() == 'DirectAdmin') { $paths = \array_map('trim', \file('/etc/exim.blockcracking/script.denied_paths.txt')); if (!\in_array('^/home/' . $hash . '/.*', $paths)) { $paths[] = '^/home/' . $hash . '/.*'; \file_put_contents('/etc/exim.blockcracking/script.denied_paths.txt', \implode(\PHP_EOL, $paths) . \PHP_EOL); } $this->push("$hash user limiting success"); return; } $this->log("limitUser $hash"); /* @var $emaillimit \Emaillimit */ $emaillimit = \Emaillimit::findFirstByHash($hash); $elimit = null; if (!empty($emaillimit->elimit)) { $elimit = (int) $emaillimit->elimit; $this->push("Found saved limit for $hash EMAIL_PER_HOUR: $elimit"); } if ($elimit === null) { /* @var $cpanel \CXS\Cpanel */ $cpanel = $this->di->get('cpanel'); $elimit = (int) $cpanel->cAPI("accountsummary?user=$hash")['acct'][0]['max_email_per_hour']; if ($elimit >= 0 && !empty($emaillimit)) { $emaillimit->delete(); } if ($elimit >= 0) { // Save a limit $emaillimit = new \Emaillimit(); $emaillimit->hash = $hash; $emaillimit->hostname = \gethostname(); $emaillimit->elimit = $elimit; $emaillimit->save(); $this->push("Save $hash EMAIL_PER_HOUR: $elimit"); } } if ($elimit > 21) { /* @var $cpanel \CXS\Cpanel */ $cpanel = $this->di->get('cpanel'); $cpanel->cAPI("modifyacct?user=$hash&MAX_EMAIL_PER_HOUR=21"); $this->push("Limit user $hash MAX_EMAIL_PER_HOUR=21"); $cpanel = null; unset($cpanel); } else { $this->push("Skipped limit $hash user because MAX_EMAIL_PER_HOUR limit ($elimit) lower than 21"); } $emaillimit = null; unset($emaillimit); $elimit = null; unset($elimit); } /** * Restore e-mail limit * * @param string $hash Username */ public function restore(string $hash) { if ($this->checkHash($hash) === false) { return; } if ($this->getType() == 'DirectAdmin') { $paths = \array_map('trim', \file('/etc/exim.blockcracking/script.denied_paths.txt')); if (\in_array('^/home/' . $hash . '/.*', $paths)) { \array_splice($paths, \array_search('^/home/' . $hash . '/.*', $paths ), 1); \file_put_contents('/etc/exim.blockcracking/script.denied_paths.txt', \implode(\PHP_EOL, $paths) . \PHP_EOL); } if (\is_file('/var/spool/exim/blocked_script_paths')) { $blockedScriptPaths = \file('/var/spool/exim/blocked_script_paths'); $rewrite = false; foreach ($blockedScriptPaths as $key => $line) { if (empty(\trim($line))) { unset($blockedScriptPaths[$key]); } if (\strpos($line, "/home/$hash/") === 0) { $rewrite = true; unset($blockedScriptPaths[$key]); } } if ($rewrite === true) { \file_put_contents('/var/spool/exim/blocked_script_paths', \implode(\PHP_EOL, $blockedScriptPaths) . \PHP_EOL); } } $this->push("$hash user restoring success"); return; } $this->log("restoreEmailLimit $hash"); /* @var $emaillimit \Emaillimit */ $emaillimit = \Emaillimit::findFirstByHash($hash); $elimit = null; /* @var $cpanel \CXS\Cpanel */ $cpanel = $this->di->get('cpanel'); if (!empty($emaillimit->elimit)) { $elimit = (int) $emaillimit->elimit; } if (empty($elimit)) { $elimit = (int) @$cpanel->cAPI("getpkginfo?pkg=" . \urlencode($cpanel->cAPI("listaccts?searchtype=user&search=$hash&api.version=1")['data']['acct'][0]['plan']) . "&api.version=1")['data']['pkg']['MAX_EMAIL_PER_HOUR']; } if (empty($elimit)) { $this->push("Failed to find e-mail limit to $hash"); $emaillimit = null; unset($emaillimit); $elimit = null; unset($elimit); return; } $cpanel->cAPI("modifyacct?user=$hash&MAX_EMAIL_PER_HOUR=$elimit"); $this->push("User: $hash MAX_EMAIL_PER_HOUR=$elimit"); \Emaillimit::findByHash($hash)->delete(); $emaillimit = null; unset($emaillimit); $elimit = null; unset($elimit); $cpanel = null; unset($cpanel); } /** * List email limited webhosts */ public function list() { $jobResponse = ''; if ($this->getType() == 'DirectAdmin') { foreach (\array_map('trim', \file('/etc/exim.blockcracking/script.denied_paths.txt')) as $path) { if(\strpos($path, '/home/') === 1) { $jobResponse .= \str_replace(['^/home/', '/.*'], '', $path) . \PHP_EOL; } } } else { /* @var $emaillimit \Emaillimit */ $emaillimit = \Emaillimit::findByHostname(\gethostname()); foreach ($emaillimit as $limit) { $jobResponse .= $limit->hash . \PHP_EOL; } } $this->dispatcher->setParam('jobResponse', $jobResponse); } }
Simpan