File manager - Edit - /usr/local/cpanel/base/frontend/jupiter/cpguard/scanner/mscan_result.php
Back
<?php include_once dirname(__DIR__) . '/includes/init.php'; include_once $base_dir . '/classes/license.class.php'; include_once $base_dir . "/classes/language.class.php"; include_once dirname(__DIR__) . "/classes/api.class.php"; $lang = new Language('manual_scan'); $api = new Api($current_user); $license = new License(); if (!$license->validateLicense()) { include_once $base_dir . '/license.php'; die(); } $cms_threats_count = 0; /* * **************************************************************************** * SCAN PROGRESS INFO FOR MANUAL SCAN REPORT * **************************************************************************** */ if (!empty($_POST['update'])) { $mscan_id = filter_var($_POST['update']); $data = array('id' => $mscan_id); $result = $api->request('userScanProgress', $data); $mscan_progress = json_decode($mscan_row['scan_progress'] ?? '{}', true); if ($mscan_row['scan_pid'] > 1 || $mscan_row['cms_progress'] < 100) { $progress = $mscan_progress['progress'] ?? 0; if ($mscan_row['scan_pid'] < 1 && $mscan_row['cms_progress'] < 100) { $progress = 99; } } else { $progress = 100; } $counts = array('target' => $mscan_row['scan_target']); $threats = $api->request('getThreatsCount', $counts); $cms_threats_count = $threats['cms_threats_count'] ?? 0; $return = array( 'files_scanned' => $mscan_progress['scanned'] ?? 0, 'infected_count' => $mscan_row['infected_count'] ?? 0, 'cms_threat_count' => $cms_threats_count, 'scan_duration' => isset($mscan_row['scan_start_time']) ? time_interval_string(abs(time() - strtotime($mscan_row['scan_start_time']))) : '', 'progress' => $progress ); echo json_encode($return, JSON_INVALID_UTF8_SUBSTITUTE); exit; } /* SCAN RESULT PAGE */ $scan_id = $_GET['scan_id'] ?? $_GET['mscan_id'] ?? null; if (isset($scan_id) && !empty($scan_id)) { $mscan_id = filter_var($scan_id); $data = array('id' => $mscan_id); $result = $api->request('scanResult', $data); $cms_threats_count = $result['cms_threats_count'] ?? 0; $virus_count = $result['log_count'] ?? 0; $outdated_cms_count = $result['cms_count'] ?? 0; if (!empty($result['scan'])) { $mscan_row = $result['scan']; } else { echo '<h2><i class="la la-exclamation"></i> ' . $lang->_('mscan.notfound', true) . '</h2>'; exit; } } else { echo "Error! No scan id provided!"; exit; } ?> <div class="row section-head"> <div class="col-md-8"> <h2><a href="#" class="back-to-scans"><?php $lang->_('mscan.pagetitle'); ?></a> > <?php $lang->_('mscan.report.title', false, $mscan_id); ?></h2> </div> <div class="col-md-4"> </div> </div> <style> .show-scanner-logs:hover, .show-cms-threats:hover { background-color: #ffdab9; border-bottom: solid 3px #264296; cursor: pointer; } .show-scanner-logs.active, .show-cms-threats.active { border-bottom: solid 3px #264296; } .mscan-title { font-size: 1.3em; } .mscan-detail { font-size: 1.3em; } .mscan-widget-details strong { font-size: 1.5em; } </style> <div class="row mscan-details-widget gx-2 gy-2 <?php echo $mscan_row['pid'] > 0 || $mscan_row['pid'] < -4 ? 'ongoing' : ''; ?>" data-mscanid="<?php echo $mscan_id; ?>"> <div class="col-12 col-md-6 col-lg-6 col-xl-3" style="position:relative;"> <div class="widget-item show-scanner-logs active "> <div class="mscan-widget-icon"> <span class="svg-icon svg-mscan svg-icon-5x"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <polygon points="0 0 24 0 24 24 0 24" /> <path d="M4.85714286,1 L11.7364114,1 C12.0910962,1 12.4343066,1.12568431 12.7051108,1.35473959 L17.4686994,5.3839416 C17.8056532,5.66894833 18,6.08787823 18,6.52920201 L18,19.0833333 C18,20.8738751 17.9795521,21 16.1428571,21 L4.85714286,21 C3.02044787,21 3,20.8738751 3,19.0833333 L3,2.91666667 C3,1.12612489 3.02044787,1 4.85714286,1 Z M8,12 C7.44771525,12 7,12.4477153 7,13 C7,13.5522847 7.44771525,14 8,14 L15,14 C15.5522847,14 16,13.5522847 16,13 C16,12.4477153 15.5522847,12 15,12 L8,12 Z M8,16 C7.44771525,16 7,16.4477153 7,17 C7,17.5522847 7.44771525,18 8,18 L11,18 C11.5522847,18 12,17.5522847 12,17 C12,16.4477153 11.5522847,16 11,16 L8,16 Z" fill="#000000" fill-rule="nonzero" opacity="0.3" /> <path d="M6.85714286,3 L14.7364114,3 C15.0910962,3 15.4343066,3.12568431 15.7051108,3.35473959 L20.4686994,7.3839416 C20.8056532,7.66894833 21,8.08787823 21,8.52920201 L21,21.0833333 C21,22.8738751 20.9795521,23 19.1428571,23 L6.85714286,23 C5.02044787,23 5,22.8738751 5,21.0833333 L5,4.91666667 C5,3.12612489 5.02044787,3 6.85714286,3 Z M8,12 C7.44771525,12 7,12.4477153 7,13 C7,13.5522847 7.44771525,14 8,14 L15,14 C15.5522847,14 16,13.5522847 16,13 C16,12.4477153 15.5522847,12 15,12 L8,12 Z M8,16 C7.44771525,16 7,16.4477153 7,17 C7,17.5522847 7.44771525,18 8,18 L11,18 C11.5522847,18 12,17.5522847 12,17 C12,16.4477153 11.5522847,16 11,16 L8,16 Z" fill="#000000" fill-rule="nonzero" /> </g> </svg></span> </div> <div class="mscan-widget-details vertical-center"> <span class="mscan-title <?php echo $result['log_count'] ? "text-danger" : ""; ?>"><strong id="infected_count"><?php echo $result['log_count']; ?></strong> <?php $lang->_('mscan.result.infected'); ?> </span> <p class="mscan-detail mb-0"><strong id="files_scanned"><?php echo $result['scan']['total_files']; ?></strong> <?php $lang->_('mscan.result.allfiles'); ?> </p> </div> </div> </div> <div class="col-12 col-md-6 col-lg-6 col-xl-3" style="position:relative;"> <div class="widget-item show-cms-threats"> <div class="mscan-widget-icon"> <span class="svg-icon svg-mscan svg-icon-5x"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect x="0" y="0" width="24" height="24" /> <path d="M16.3740377,19.9389434 L22.2226499,11.1660251 C22.4524142,10.8213786 22.3592838,10.3557266 22.0146373,10.1259623 C21.8914367,10.0438285 21.7466809,10 21.5986122,10 L17,10 L17,4.47708173 C17,4.06286817 16.6642136,3.72708173 16.25,3.72708173 C15.9992351,3.72708173 15.7650616,3.85240758 15.6259623,4.06105658 L9.7773501,12.8339749 C9.54758575,13.1786214 9.64071616,13.6442734 9.98536267,13.8740377 C10.1085633,13.9561715 10.2533191,14 10.4013878,14 L15,14 L15,19.5229183 C15,19.9371318 15.3357864,20.2729183 15.75,20.2729183 C16.0007649,20.2729183 16.2349384,20.1475924 16.3740377,19.9389434 Z" fill="#000000" /> <path d="M4.5,5 L9.5,5 C10.3284271,5 11,5.67157288 11,6.5 C11,7.32842712 10.3284271,8 9.5,8 L4.5,8 C3.67157288,8 3,7.32842712 3,6.5 C3,5.67157288 3.67157288,5 4.5,5 Z M4.5,17 L9.5,17 C10.3284271,17 11,17.6715729 11,18.5 C11,19.3284271 10.3284271,20 9.5,20 L4.5,20 C3.67157288,20 3,19.3284271 3,18.5 C3,17.6715729 3.67157288,17 4.5,17 Z M2.5,11 L6.5,11 C7.32842712,11 8,11.6715729 8,12.5 C8,13.3284271 7.32842712,14 6.5,14 L2.5,14 C1.67157288,14 1,13.3284271 1,12.5 C1,11.6715729 1.67157288,11 2.5,11 Z" fill="#000000" opacity="0.3" /> </g> </svg></span> </div> <div class="mscan-widget-details"> <span class="mscan-title"><strong id="cms_threats_count"><?php echo $cms_threats_count; ?></strong> <?php $lang->_('mscan.result.cms_threat'); ?></span> <p class="mscan-detail mb-0"><strong><?php echo $outdated_cms_count; ?></strong> <?php $lang->_('mscan.result.cms_outdated'); ?></p> </div> </div> </div> <div class="col-12 col-md-6 col-lg-6 col-xl-3" style="position:relative;"> <div class="widget-item"> <div class="mscan-widget-icon"> <?php if ($mscan_row['target'] == 'ALL' || $mscan_row['target'] == 'DAILY' || $mscan_row['target'] == 'WEEKLY') { ?> <span class="svg-icon svg-mscan svg-icon-5x"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect x="0" y="0" width="24" height="24" /> <path d="M3.5,21 L20.5,21 C21.3284271,21 22,20.3284271 22,19.5 L22,8.5 C22,7.67157288 21.3284271,7 20.5,7 L10,7 L7.43933983,4.43933983 C7.15803526,4.15803526 6.77650439,4 6.37867966,4 L3.5,4 C2.67157288,4 2,4.67157288 2,5.5 L2,19.5 C2,20.3284271 2.67157288,21 3.5,21 Z" fill="#000000" /> </g> </svg></span> <?php } else { ?> <span class="svg-icon svg-mscan svg-icon-5x"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect x="0" y="0" width="24" height="24" /> <path d="M4.5,21 L21.5,21 C22.3284271,21 23,20.3284271 23,19.5 L23,8.5 C23,7.67157288 22.3284271,7 21.5,7 L11,7 L8.43933983,4.43933983 C8.15803526,4.15803526 7.77650439,4 7.37867966,4 L4.5,4 C3.67157288,4 3,4.67157288 3,5.5 L3,19.5 C3,20.3284271 3.67157288,21 4.5,21 Z" fill="#000000" opacity="0.3" /> <path d="M2.5,19 L19.5,19 C20.3284271,19 21,18.3284271 21,17.5 L21,6.5 C21,5.67157288 20.3284271,5 19.5,5 L9,5 L6.43933983,2.43933983 C6.15803526,2.15803526 5.77650439,2 5.37867966,2 L2.5,2 C1.67157288,2 1,2.67157288 1,3.5 L1,17.5 C1,18.3284271 1.67157288,19 2.5,19 Z" fill="#000000" /> </g> </svg></span> <?php } ?> </div> <div class="mscan-widget-details"> <span class="mscan-title"><?php $lang->_('mscan.result.target'); ?></span> <p class="mscan-detail mb-0" id="target" style="font-size:1.2em"><?php echo $mscan_row['target']; ?></p> </div> </div> </div> <div class="col-12 col-md-6 col-lg-6 col-xl-3" style="position:relative;"> <div class="widget-item mscan_status"> <div class="mscan-widget-icon"> <i class="svg-progress la la-circle-notch fa-spin" style="display:none;margin-top:-7px;font-size: 5.7em;"></i> <!-- scan_duration--> <span class="svg-duration svg-icon svg-mscan svg-icon-5x"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect x="0" y="0" width="24" height="24" /> <path d="M12,21 C7.581722,21 4,17.418278 4,13 C4,8.581722 7.581722,5 12,5 C16.418278,5 20,8.581722 20,13 C20,17.418278 16.418278,21 12,21 Z" fill="#000000" opacity="0.3" /> <path d="M13,5.06189375 C12.6724058,5.02104333 12.3386603,5 12,5 C11.6613397,5 11.3275942,5.02104333 11,5.06189375 L11,4 L10,4 C9.44771525,4 9,3.55228475 9,3 C9,2.44771525 9.44771525,2 10,2 L14,2 C14.5522847,2 15,2.44771525 15,3 C15,3.55228475 14.5522847,4 14,4 L13,4 L13,5.06189375 Z" fill="#000000" /> <path d="M16.7099142,6.53272645 L17.5355339,5.70710678 C17.9260582,5.31658249 18.5592232,5.31658249 18.9497475,5.70710678 C19.3402718,6.09763107 19.3402718,6.73079605 18.9497475,7.12132034 L18.1671361,7.90393167 C17.7407802,7.38854954 17.251061,6.92750259 16.7099142,6.53272645 Z" fill="#000000" /> <path d="M11.9630156,7.5 L12.0369844,7.5 C12.2982526,7.5 12.5154733,7.70115317 12.5355117,7.96165175 L12.9585886,13.4616518 C12.9797677,13.7369807 12.7737386,13.9773481 12.4984096,13.9985272 C12.4856504,13.9995087 12.4728582,14 12.4600614,14 L11.5399386,14 C11.2637963,14 11.0399386,13.7761424 11.0399386,13.5 C11.0399386,13.4872031 11.0404299,13.4744109 11.0414114,13.4616518 L11.4644883,7.96165175 C11.4845267,7.70115317 11.7017474,7.5 11.9630156,7.5 Z" fill="#000000" /> </g> </svg></span> </div> <div class="mscan-widget-details"> <span class="mscan-title"><?php $lang->_('mscan.result.duration'); ?></span> <p class="mscan-detail mb-0"> <?php echo $mscan_row['end_time'] != NULL ? time_interval_string(abs(strtotime($mscan_row['end_time']) - strtotime($mscan_row['start_time']))) : "<i class='fa fa-circle-notch fa-spin'style='margin-right:3px;'></i>In progress"; ?> </p> </div> </div> </div> </div> <div id="logs"> </div> <script> cjQ(document).ready(function ($) { $('.show-cms-threats').click(function () { $('.show-cms-threats').addClass('active'); $('.show-scanner-logs').removeClass('active'); $.post(ajax_url + 'scanner/cms.php', { target: $('#target').text() }, "json") .done(function (data) { $('#logs').html(data); }) .fail(function () { }) .always(function () { }); }); $('.show-scanner-logs').click(function () { $('.show-cms-threats').removeClass('active'); $('.show-scanner-logs').addClass('active'); $.get(ajax_url + 'scanner/scanner_logs.php', { mscan_id: <?php echo $mscan_id; ?> }, "json") .done(function (data) { $('#logs').html(data); }) .fail(function () { }) .always(function () { }); }); $('.show-scanner-logs').trigger('click'); updateStats(); widgetSizing(); window.onresize = widgetSizing; function widgetSizing() { var maxWidth = 0; $('.widget-item').each(function () { if ($('.mscan-widget-details', this).width() > maxWidth) { maxWidth = $('.mscan-widget-details', this).width(); } }); $('.mscan-widget-details').width(maxWidth); } function updateStats() { if (!$('.mscan-details-widget').hasClass('ongoing')) { return false; } var mscanid = $('.mscan-details-widget').data('mscanid'); $.ajax({ type: 'POST', data: { update: mscanid }, url: ajax_url + 'scanner/mscan_result.php', success: function (data) { data = JSON.parse(data); $('.mscan-details-widget .mscan_status .mscan-detail').html(data.scan_duration); $('.mscan-details-widget #files_scanned').html(data.files_scanned); if ($('.mscan-details-widget #infected_count').html() != data.infected_count) { $('.mscan-details-widget #infected_count').html(data.infected_count); if (!$('#scanner_logs').is(":hidden")) { dataTable.draw(); } } if ($('.mscan-details-widget #cms_threats_count').html() != data.cms_threat_count) { $('.mscan-details-widget #cms_threats_count').html(data.cms_threat_count); if (!$('#cms_logs').is(":hidden")) { cmsTable.draw(); } } if (data.progress < 50) { $('.mscan-details-widget .mscan_status').css('background-image', 'linear-gradient(-90deg, #ccf3fb ' + (100 - data.progress) + '%, #93e6f1 ' + data.progress + '%)'); } else { $('.mscan-details-widget .mscan_status').css('background-image', 'linear-gradient(90deg, #93e6f1 ' + data.progress + '%, #ccf3fb ' + (100 - data.progress) + '%)'); } if (data.progress == 100) { $('.mscan-details-widget').removeClass('ongoing'); $('.mscan-details-widget .mscan_status .svg-progress').hide(); $('.mscan-details-widget .mscan_status .svg-duration').show(); } else { $('.mscan-details-widget .mscan_status .svg-progress').show(); $('.mscan-details-widget .mscan_status .svg-duration').hide(); window.setTimeout(updateStats, 10000); } } }); } }); </script>
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings