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
/
tasks
/
Edit File:
Ipv6Task.php
<?php /** * Ipv6Task, IPv6 related tasks * * @copyright Copyright (c) 2007 DotRoll Kft. (http://www.dotroll.com) * @author Zoltán Istvanovszki <zoltan.istvanovszki@dotroll.com> * @since 2018.06.07. * @package CXS_2.0 */ class Ipv6Task extends \CommonTask { /** * Initialization */ public function onConstruct() { $this->lock(__CLASS__); } /** * LoginSSL tasks * * @param string $action Action * @param string|null $username Username */ public function mainAction(string $action = '', ?string $username = '') { if (empty($action) || !\in_array($action, ['all', 'add', 'remove'])) { $this->help(); return; } $this->$action($username); } /** * Show a help usages */ private function help() { echo "Usage: /opt/cxs2/loginssl.php ipv6 TASK [hash]\n\n"; echo "Tasks:\n"; echo " all\tAdd IPv6 to all not IPv6 ready accounts\n"; echo " add\tAdd IPv6 to [hash] account\n"; echo " remove\tRemove IPv6 to [hash] account\n"; } /** * Add IPv6 to all not IPv6 ready accounts */ private function all() { $loginsql = []; foreach (\Records::find("domain_id = 1 AND type = 'AAAA' AND name LIKE '%.ipv6.loginssl.com'") as $record) { $loginsql[] = \str_replace('.ipv6.loginssl.com', '', $record->name); } $accounts = []; $listaccts = \json_decode(\exec('/usr/sbin/whmapi1 --output=json listaccts'), true); if (!empty($listaccts['data']['acct'])) { foreach ($listaccts['data']['acct'] as $acct) { if (empty($acct['ipv6']) && $acct['suspended'] == 0 && !\in_array($acct['user'], $loginsql)) { $accounts[$acct['user']] = ['email' => $acct['email'], 'ipv4' => $acct['ip']]; } } } $max = \count($accounts); $i = 0; foreach ($accounts as $username => $data) { echo "\r" . \round($i++ * 100 / $max) . " % [$i/$max] -> $username\t\t\t\t\t\t"; $this->addIpv6($username, $data['email'], $data['ipv4']); } $this->updateSoa(); } /** * Add IPv6 to a specified account * * @param string $username Username * @return void */ private function add(string $username = ''): void { if (empty($username)) { $this->help(); return; } $accountsummary = \json_decode(\exec("/usr/sbin/whmapi1 --output=json accountsummary user=$username"), true); if ( !empty($accountsummary['data']['acct'][0]['user']) && $accountsummary['data']['acct'][0]['user'] == $username && empty($accountsummary['data']['acct'][0]['ipv6']) && $accountsummary['data']['acct'][0]['suspended'] == 0 && \Records::findFirst("domain_id = 1 AND type = 'AAAA' AND name = '$username.ipv6.loginssl.com'") === null ) { $this->addIpv6($accountsummary['data']['acct'][0]['user'], $accountsummary['data']['acct'][0]['email'], $accountsummary['data']['acct'][0]['ip']); $this->updateSoa(); } } /** * Remove IPv6 to a specified account * * @param string $username * @return void */ private function remove(string $username = ''): void { if (empty($username)) { $this->help(); return; } $accountsummary = \json_decode(\exec("/usr/sbin/whmapi1 --output=json accountsummary user=$username"), true); if ( !empty($accountsummary['data']['acct'][0]['user']) && $accountsummary['data']['acct'][0]['user'] == $username && !empty($accountsummary['data']['acct'][0]['ipv6']) && $accountsummary['data']['acct'][0]['suspended'] == 0 && $ipv6 = \Records::findFirst("domain_id = 1 AND type = 'AAAA' AND name = '$username.ipv6.loginssl.com'") ) { $ipv6->delete(); // Remove IPv6 range from cPanel \exec("/usr/sbin/whmapi1 ipv6_disable_account user=$username"); \exec("/usr/sbin/whmapi1 ipv6_range_remove name=$username"); \DnsApi::query("/ipv6/remove/{$ipv6->content}"); $this->updateSoa(); } } }
Simpan