File manager - Edit - /usr/local/cpanel/base/frontend/jupiter/cpguard/scanner/actions.php
Back
<?php include_once dirname(__DIR__) . "/includes/init.php"; include_once $base_dir . "/classes/language.class.php"; $lang = new Language('manual_scan'); $option = 'scan'; $error = false; /* -------------------------------------------------------------------------------------------------------------- * MANUAL SCAN VIA TERMINAL * ------------------------------------------------------------------------------------------------------------- */ if (isset($argv[1]) && strtolower($argv[1]) == 'scan') { $mscan_custom = true; if ((isset($argv[2]) && strtolower($argv[2]) == 'all') || !isset($argv[2])) { $custom_scan_type = 'all'; $custom_scan_target = 'ALL'; echo "Starting Manual scan on All directories" . PHP_EOL; } else if (isset($argv[2])) { $custom_scan_type = 'path'; $custom_scan_target = $argv[2]; echo "Starting Manual scan on $custom_scan_target" . PHP_EOL; } else { echo "invalid syntax" . PHP_EOL; } } else { $mscan_custom = false; } /* ----------------------------------------------------------------------------- * START MANUAL SCAN * -------------------------------------------------------------------------- */ if (isset($_POST['target']) || $mscan_custom) { $scan_type = $_POST['type']; $scan_target = trim(filter_var($_POST['target'])); include_once dirname(__DIR__) . "/classes/api.class.php"; $api = new Api($current_user); $result = $api->request('manualScanStart', ['target' => $scan_target, 'type' => $scan_type]); $response = []; if ($result['status']) { if ($result['status'] == 'preparing') { $response['success'] = $lang->_('mcan.action.success.started', true); // Scan started successfully; $response['time'] = $lang->_('mscan.lastscan', true, $result['row']['start_time']);; } else if ($result['status'] == 'queued') { $response['info'] = $lang->_('mcan.action.success.queued', true); // Scan added to queue; } else if ($result['status'] == 'duplicate') { $response['error'] = $lang->_('mcan.action.error.duplicate', true); // Scan already started or in queue; } else if ($result['status'] == 'forbidden') { $response['error'] = $lang->_('mcan.action.error.restricted', true); // Scan already started or in queue; } else if ($result['status'] == 'invalid-path') { $response['error'] = $lang->_('mcan.action.error.invalidpath', true); // Scan already started or in queue; } $response['type'] = $scan_type; //$response=$result; if ($mscan_custom) { "Manual scan started on $scan_target" . PHP_EOL; echo isset($response['success']) ? 'Scan started. Please check back in sometime to view result.' : (isset($response['info']) ? 'Manual scan is added to queue and will start momentarily' : 'Error ' . $response['error']); echo PHP_EOL; } } echo json_encode($response); }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.04 |
proxy
|
phpinfo
|
Settings