if (isset($lastTestingInfo["results"])) { $lastResults = $lastTestingInfo["results"]; } else { $lastResults = array(); } if (!empty($lastResults)) { $criticalResultsCount = CSecuritySiteChecker::calculateCriticalResults($lastResults); } else { $criticalResultsCount = 0; } if (isset($lastTestingInfo["test_date"])) { $lastDate = $lastTestingInfo["test_date"]; } else { $lastDate = GetMessage("SEC_PANEL_SCANNER_NEVER_START"); } $data['scanner']['ITEMS'][] = array("KPI_NAME" => GetMessage("SEC_PANEL_SCANNER_LAST_SCAN"), "KPI_VALUE" => $lastDate, "KPI_RECOMMENDATION" => !CSecuritySiteChecker::isNewTestNeeded() ? ' ' : ($USER->isAdmin() ? '<a href="security_scanner.php?lang=' . LANGUAGE_ID . '&return_url=' . urlencode('security_panel.php?lang=' . LANGUAGE_ID) . '">' . GetMessage("SEC_PANEL_SCANNER_RUN") . '</a>' : GetMessage("SEC_PANEL_SCANNER_RUN"))); $data['scanner']['ITEMS'][] = array("KPI_NAME" => GetMessage("SEC_PANEL_SCANNER_PROBLEM_COUNT"), "KPI_VALUE" => count($lastResults), "KPI_RECOMMENDATION" => count($lastResults) <= 0 ? ' ' : ($USER->isAdmin() ? '<a href="security_scanner.php?lang=' . LANGUAGE_ID . '&return_url=' . urlencode('security_panel.php?lang=' . LANGUAGE_ID) . '">' . GetMessage("SEC_PANEL_SCANNER_FIX_IT") . '</a>' : GetMessage("SEC_PANEL_SCANNER_FIX_IT"))); $data['scanner']['ITEMS'][] = array("KPI_NAME" => GetMessage("SEC_PANEL_SCANNER_CRITICAL_PROBLEM_COUNT"), "KPI_VALUE" => $criticalResultsCount, "KPI_RECOMMENDATION" => $criticalResultsCount <= 0 ? ' ' : ($USER->isAdmin() ? '<a href="security_scanner.php?lang=' . LANGUAGE_ID . '&return_url=' . urlencode('security_panel.php?lang=' . LANGUAGE_ID) . '">' . GetMessage("SEC_PANEL_SCANNER_FIX_IT") . '</a>' : GetMessage("SEC_PANEL_SCANNER_FIX_IT"))); unset($lastTestingInfo); unset($lastResults); unset($criticalResultsCount); $bSecurityFilter = CSecurityFilter::IsActive(); $data['std']['ITEMS'][] = array("IS_OK" => $bSecurityFilter, "KPI_NAME" => GetMessage("SEC_PANEL_FILTER_NAME"), "KPI_VALUE" => $bSecurityFilter ? GetMessage("SEC_PANEL_FILTER_VALUE_ON") : GetMessage("SEC_PANEL_FILTER_VALUE_OFF"), "KPI_RECOMMENDATION" => $bSecurityFilter ? ' ' : ($USER->CanDoOperation('security_filter_settings_write') ? '<a href="security_filter.php?lang=' . LANGUAGE_ID . '&return_url=' . urlencode('security_panel.php?lang=' . LANGUAGE_ID) . '">' . GetMessage("SEC_PANEL_FILTER_RECOMMENDATION") . '</a>' : GetMessage("SEC_PANEL_FILTER_RECOMMENDATION"))); $rsSecurityFilterExclMask = CSecurityFilterMask::GetList(); if ($rsSecurityFilterExclMask->Fetch()) { $bSecurityFilterExcl = true; } else { $bSecurityFilterExcl = false; } $data['std']['ITEMS'][] = array("IS_OK" => !$bSecurityFilterExcl, "KPI_NAME" => GetMessage("SEC_PANEL_FILTER_EXCL_NAME"), "KPI_VALUE" => $bSecurityFilterExcl ? GetMessage("SEC_PANEL_FILTER_EXCL_VALUE_ON") : GetMessage("SEC_PANEL_FILTER_EXCL_VALUE_OFF"), "KPI_RECOMMENDATION" => !$bSecurityFilterExcl ? ' ' : ($USER->CanDoOperation('security_filter_settings_write') ? '<a href="security_filter.php?lang=' . LANGUAGE_ID . '&return_url=' . urlencode('security_panel.php?lang=' . LANGUAGE_ID) . '&tabControl_active_tab=exceptions">' . GetMessage("SEC_PANEL_FILTER_EXCL_RECOMMENDATION") . '</a>' : GetMessage("SEC_PANEL_FILTER_EXCL_RECOMMENDATION"))); $days = COption::GetOptionInt("main", "event_log_cleanup_days", 7);
/** * @param array $pResults * @return int */ public static function calculateCriticalResults($pResults = array()) { if (empty($pResults)) { $testingInfo = CSecuritySiteChecker::getLastTestingInfo(); if (isset($testingInfo["results"])) { $results = $testingInfo["results"]; } else { $results = array(); } } else { $results = $pResults; } $criticalResultsCount = 0; foreach ($results as $result) { if (isset($result["critical"]) && $result["critical"] === CSecurityCriticalLevel::HIGHT) { $criticalResultsCount++; } } return $criticalResultsCount; }
</div> <form method="POST" action="security_scanner.php?lang=<?php echo LANG; echo $_GET["return_url"] ? "&return_url=" . urlencode($_GET["return_url"]) : ""; ?> " name="settings_form"> <?php $tabControl->Begin(); ?> <?php $tabControl->BeginNextTab(); ?> <div class="adm-security-wrap"> <div id="start_container" class="adm-security-first-step"> <div id="first_start" class="adm-security-text-block" <?php echo !CSecuritySiteChecker::isNewTestNeeded() ? "style=\"display:none;\"" : ""; ?> > <?php echo GetMessage("SEC_SCANNER_CRITICAL_FIRST_START"); ?> </div> <span id="start_button" class="adm-btn adm-btn-green"><?php echo GetMessage("SEC_SCANNER_START_BUTTON"); ?> </span> </div> <div id="status_bar" class="adm-security-status-bar" style="display:none;"> <div id="progress_bar" style="width: 500px;" class="adm-progress-bar-outer"> <div id="progress_bar_inner" style="width: 0px;" class="adm-progress-bar-inner"></div> <div id="progress_text" style="width: 500px;" class="adm-progress-bar-inner-text">0%</div>
$text2 = GetMessage("GD_SECURITY_EVENT_COUNT_EMPTY"); } if ($securityEventsCount > 999) { $securityEventsCount = round($securityEventsCount / 1000, 1) . 'K'; } } else { $lamp_class = " bx-gadgets-note"; $text2_class = "red"; $text2 = GetMessage("GD_SECURITY_FILTER_OFF_DESC"); $securityEventsCount = 0; } $minSecurityVersionForScan = "12.5.0"; include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/version.php"; if (CheckVersion($arModuleVersion['VERSION'], $minSecurityVersionForScan)) { $lastResult = CSecuritySiteChecker::getLastTestingInfo(); $isScanNeeded = CSecuritySiteChecker::isNewTestNeeded(); $scannerMessage = ""; $isShowScanButton = true; } else { $isScanNeeded = false; $isShowScanButton = false; $scannerMessage = GetMessage("GD_SECURITY_UPDATE_NEEDED", array("#MIN_VERSION#" => $minSecurityVersionForScan)); } } else { $lamp_class = ""; $text2_class = "red"; $text2 = GetMessage("GD_SECURITY_MODULE"); $isScanNeeded = false; $scannerMessage = ""; $bSecurityFilter = false; $securityEventsCount = 0;
$criticalResultsCount = CSecuritySiteChecker::calculateCriticalResults($lastResults); } else { $criticalResultsCount = 0; } if(isset($lastTestingInfo["test_date"])) { $lastDate = $lastTestingInfo["test_date"]; } else { $lastDate = GetMessage("SEC_PANEL_SCANNER_NEVER_START"); } $data['scanner']['ITEMS'][] = array( "KPI_NAME" => GetMessage("SEC_PANEL_SCANNER_LAST_SCAN"), "KPI_VALUE" => $lastDate, "KPI_RECOMMENDATION" => ( !CSecuritySiteChecker::isNewTestNeeded()? ' ': ( $USER->isAdmin()? '<a href="security_scanner.php?lang='.LANGUAGE_ID.'&return_url='.urlencode('security_panel.php?lang='.LANGUAGE_ID).'">'.GetMessage("SEC_PANEL_SCANNER_RUN").'</a>' :GetMessage("SEC_PANEL_SCANNER_RUN") ) ), ); $data['scanner']['ITEMS'][] = array( "KPI_NAME" => GetMessage("SEC_PANEL_SCANNER_PROBLEM_COUNT"), "KPI_VALUE" => count($lastResults), "KPI_RECOMMENDATION" => ( count($lastResults) <= 0 ? ' ':