Changeset 3045336
- Timestamp:
- 03/05/2024 02:20:53 AM (13 months ago)
- Location:
- wt-security
- Files:
-
- 452 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
wt-security/tags/2.4.22/lib/API.php
r3023313 r3045336 69 69 'P' => '.wtotem.com', 70 70 'C' => '.webtotem.kz', 71 'Q' => '.dev.wtotem.paas.tsarka.net',72 71 ]; 73 72 -
wt-security/tags/2.4.23/lib/API.php
r3041272 r3045336 69 69 'P' => '.wtotem.com', 70 70 'C' => '.webtotem.kz', 71 'Q' => '.dev.wtotem.paas.tsarka.net',72 71 ]; 73 72 -
wt-security/trunk/includes/css/main.css
r3041272 r3045336 2502 2502 .wtotem_table__info { 2503 2503 padding: 15px 15px; 2504 } 2505 .wtotem_table__th{ 2506 display: flex; 2507 justify-content: space-between; 2508 align-items: center; 2504 2509 } 2505 2510 .wtotem_table__th, -
wt-security/trunk/includes/js/amplitude.js
r3041272 r3045336 186 186 }, 187 187 188 errorNotification: ( 189 error, // string, 190 ) => { 191 amplitudeEvent('ERROR_NOTIFICATION', { 192 error, 193 }) 194 }, 195 188 196 /** Dashboard triggers */ 189 197 showTooltip: ( -
wt-security/trunk/includes/templates/activation.html.twig
r2797028 r3045336 66 66 </div> 67 67 68 {% include 'footer.html.twig' with {'current_year': current_year, 'images_path': images_path } %}68 {% include 'footer.html.twig' with {'current_year': current_year, 'images_path': images_path, 'page': page } %} 69 69 70 70 </div> -
wt-security/trunk/includes/templates/footer.html.twig
r3041272 r3045336 38 38 </div> 39 39 40 {% if user_feedback == false %}40 {% if user_feedback == false and page != 'activation' %} 41 41 <script type="text/javascript"> 42 42 jQuery(document).ready(function ($) { -
wt-security/trunk/includes/templates/monitoring.html.twig
r3041272 r3045336 1 <script type="text/javascript"> 2 3 jQuery(document).ready(function ($) { 4 5 jQuery('.wtotem_body').on('click', '.force_check', function (event) { 6 7 event.preventDefault(); 8 let service = jQuery(this).data('service'), 9 btn = jQuery(this); 10 11 btn.find('img').addClass('wtotem_unit__img_spinner'); 12 13 jQuery.post(ajaxurl, { 14 action: 'wtotem_ajax', 15 ajax_action: 'force_check', 16 wtotem_page_nonce: '{{ page_nonce }}', 17 service: service, 18 19 }, function (data) { 20 21 btn.find('img').removeClass('wtotem_unit__img_spinner'); 22 if(service === 'ssl'){ 23 jQuery('#ssl_data_wrap').html(data.content); 24 } else if(service === 'dec'){ 25 jQuery('#domain_data_wrap').html(data.content); 26 } else if(service === 'rc'){ 27 jQuery('#reputation_data_wrap').html(data.content); 28 } 29 30 }); 31 }); 32 33 }); 34 35 </script> 1 36 <div class="wtotem_monitoring" id="monitoring"> 2 37 <div class="wtotem_table wt_card"> … … 13 48 </span> 14 49 </h3> 50 <button class="open-path__force-check-btn force_check" data-service="ssl" title="{{ 'ForceCheck'|trans }}"> 51 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon"> 52 </button> 15 53 </div> 16 {% if ssl.status.name == 'pending' or ssl == null %}17 {% include 'dots_loader.html.twig' %}18 {% else %}19 <div class="wtotem_table__td">20 <div class="wtotem_table__expired">21 <span class="{{ ssl.status.class }}">{{ ssl.status.text }}</span>22 </div>23 </div>24 54 25 {% if ssl.cert_name %} 26 <div class="wtotem_table__info"> 27 <h3 class="h3 wtotem_table__subject"> 28 {{ 'Cert name'|trans }} 29 </h3> 30 <div class="wtotem_table__text"> 31 {{ ssl.cert_name }} 32 </div> 33 </div> 34 {% endif %} 35 36 {% if ssl.days_left %} 37 <div class="wtotem_table__info"> 38 <h3 class="h3 wtotem_table__subject"> 39 {{ 'Days left'|trans }} 40 </h3> 41 <div class="wtotem_table__text"> 42 {{ ssl.days_left }} 43 </div> 44 </div> 45 {% endif %} 46 47 {% if ssl.issue_date %} 48 <div class="wtotem_table__info"> 49 <h3 class="h3 wtotem_table__subject"> 50 {{ 'Issue date'|trans }} 51 </h3> 52 <div class="wtotem_table__text"> 53 {{ ssl.issue_date }} 54 </div> 55 </div> 56 {% endif %} 57 58 {% if ssl.expiry_date %} 59 <div class="wtotem_table__info"> 60 <h3 class="h3 wtotem_table__subject"> 61 {{ 'Expiry date'|trans }} 62 </h3> 63 <div class="wtotem_table__text"> 64 {{ ssl.expiry_date }} 65 </div> 66 </div> 67 {% endif %} 68 69 {% endif %} 55 <div id="ssl_data_wrap"> 56 {% include 'monitoring_ssl.html.twig' with {'ssl': ssl } %} 57 </div> 70 58 71 59 </div> … … 78 66 79 67 </h3> 68 69 <button class="open-path__force-check-btn force_check" data-service="dec" title="{{ 'ForceCheck'|trans }}"> 70 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon"> 71 </button> 80 72 </div> 81 73 74 <div id="domain_data_wrap"> 75 {% include 'monitoring_domain.html.twig' with {'domain': domain } %} 76 </div> 82 77 83 {% if domain.status.name == 'pending' %}84 {% include 'dots_loader.html.twig' %}85 {% else %}86 87 <div class="wtotem_table__item">88 <div class="wtotem_table__wrap_big">89 <img src="{{ domain.status.image }}" class="wtotem_table__img"/>90 </div>91 </div>92 93 <div class="wtotem_table__info">94 <h3 class="h3 wtotem_table__subject">{{ 'Presence of the site'|trans }}</h3>95 <div class="wtotem_table__text">96 <img width="18px" height="18px" src="{{ images_path }}{% if domain.is_taken %}check.svg{% else %}minus.svg {% endif %}" class="svg-icon">97 </div>98 </div>99 100 {% if domain.redirect_link %}101 <div class="wtotem_table__info">102 <h3 class="h3 wtotem_table__subject">{{ 'Redirect'|trans }}</h3>103 <div class="wtotem_table__text">{{ domain.redirect_link }}</div>104 </div>105 {% endif %}106 107 {% if domain.ips %}108 <div class="wtotem_table__info">109 <h3 class="h3 wtotem_table__subject">{{ 'IP address'|trans }}</h3>110 <div class="wtotem_table__text">111 <select name="ip" aria-label="ip" class="wtotem_select__inner" data-testid="select-ip">112 {% for item in domain.ips %}113 <option value="{{ item.ip }}">{{ item.ip }}, {{ item.location }}</option>114 {% endfor %}115 </select>116 </div>117 </div>118 {% endif %}119 120 {% if domain.protection %}121 <div class="wtotem_table__info">122 <h3 class="h3 wtotem_table__subject">{{ 'Site protection'|trans }}</h3>123 <div class="wtotem_table__text">{{ domain.protection }}</div>124 </div>125 {% endif %}126 127 128 {% if domain.is_created_at %}129 <div class="wtotem_table__info">130 <h3 class="h3 wtotem_table__subject">{{ 'Check time'|trans }}</h3>131 <div class="wtotem_table__text">{{ domain.created_at }}</div>132 </div>133 {% endif %}134 135 136 {% endif %}137 78 </div> 138 79 {% endif %} … … 148 89 </div> 149 90 </h3> 91 92 <button class="open-path__force-check-btn force_check" data-service="rc" title="{{ 'ForceCheck'|trans }}"> 93 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon"> 94 </button> 150 95 </div> 151 96 152 {% if reputation.status.name == 'pending' %}153 {% include ' dots_loader.html.twig'%}154 {% else %}97 <div id="reputation_data_wrap"> 98 {% include 'monitoring_reputation.html.twig' with {'reputation': reputation } %} 99 </div> 155 100 156 <div class="wtotem_table__td">157 <div class="wtotem_table__wrap">158 {% if reputation.status.image %}159 <img src="{{ reputation.status.image }}" class="wtotem_table__img"/>160 {% endif %}161 </div>162 163 <div class="wtotem_table__perfomance wtotem_table__perfomance_long wtotem-ml-20">{{ reputation.info }}</div>164 </div>165 <div class="wtotem_table__info">166 <h3 class="h3 wtotem_table__subject">167 {{ 'Status'|trans }}168 <div class="wtotem_title-info__info wtotem-tooltip wtotem-tooltip-top" data-service="Reputation status">169 <div class="wtotem-tooltip__content">170 {{ reputation.status.tooltips }}171 </div>172 </div>173 </h3>174 <div class="wtotem_table__status">{{ reputation.status.text }}</div>175 </div>176 <div class="wtotem_table__info">177 <h3 class="h3 wtotem_table__subject">178 {{ 'Deny lists entries'|trans }}179 </h3>180 <div class="wtotem_table__text">181 {{ reputation.blacklists_entries }}182 </div>183 </div>184 <div class="wtotem_table__info">185 <h3 class="h3 wtotem_table__subject">186 {{ 'Last test'|trans }}187 </h3>188 <div class="wtotem_table__text">189 {{ reputation.last_test }}190 </div>191 </div>192 <div class="wtotem_table__info"></div>193 194 {% endif %}195 101 </div> 196 102 </div> 197 103 <div class="wtotem_table__footer"> 198 <a target="_blank" href="https://wtotem.com/faq/#hs-chat-open open_support_dialog" class="wtotem_table__link">104 <a target="_blank" href="https://wtotem.com/faq/#hs-chat-open" class="wtotem_table__link open_support_dialog" data-service="Monitoring"> 199 105 <div class="wtotem_table__perfomance"> 200 106 <span>{{ 'Need more support?'|trans }} {{ 'Let\'s talk!'|trans }}</span> -
wt-security/trunk/includes/templates/notifications.html.twig
r3023313 r3045336 19 19 toastr["{{ notice.type_raw }}"]('{{ notice.text | raw }}'); 20 20 }); 21 22 {% if notice.type_raw == 'error' %} 23 AmplitudeAnalytics.errorNotification('{{ notice.text}}'); 24 {% endif %} 21 25 </script> 22 26 </div> -
wt-security/trunk/includes/templates/scanning.html.twig
r3041272 r3045336 53 53 </h3> 54 54 55 <button class="open-path__force-check-btn force_check" data-service="ps"> 56 {{ 'ForceCheck'|trans }} 55 <button class="open-path__force-check-btn force_check" data-service="ps" title="{{ 'ForceCheck'|trans }}"> 57 56 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon"> 58 57 </button> … … 113 112 </h3> 114 113 115 <button class="open-path__force-check-btn force_check" data-service="ops"> 116 {{ 'ForceCheck'|trans }} 114 <button class="open-path__force-check-btn force_check" data-service="ops" title="{{ 'ForceCheck'|trans }}"> 117 115 <img width="18px" height="18px" src="{{ images_path }}recheck.svg" class="svg-icon"> 118 116 </button> -
wt-security/trunk/lib/API.php
r3041272 r3045336 69 69 'P' => '.wtotem.com', 70 70 'C' => '.webtotem.kz', 71 'Q' => '.dev.wtotem.paas.tsarka.net',72 71 ]; 73 72 … … 339 338 $period = WebTotem::getPeriod($days); 340 339 341 //$payload = '{"query":"query($id: ID!, $dateRange: DateRangeInput!, $language: Language!, $dateRangeWeek: DateRangeInput!, $wafLogFilter: WafLogFilter!, $scanHistoryFilter: ScanHistoryFilter) { auth { viewer { sites { one(id: $id) { openPathSearch { time paths { httpCode severity path } } ports { status lastTest { time } ignorePorts TCPResults{ port technology version cveList{id summary } } UDPResults { port technology version cveList{id summary } } } domain { lastScanResult { isTaken hasSite redirectLink isLocal protection ips { ip location } status time } } sslResults{ results{ certStatus certIssuerName certExpiryDate certIssueDate } } ssl { status daysLeft expiryDate issueDate } reputation { status lastTest { time } virusList { virus{ type path } antiVirus } } firewall { lastTest { time } logs(wafLogFilter: $wafLogFilter){ edges{ node{ type blocked payload ip proxyIp userAgent description source region signatureId location{ country{ nameEn } } time request status country category } } } map(dateRange: $dateRange) { attacks, country } status chart(dateRange: $dateRange) { time attacks blocked } report(dateRange: $dateRange) { time attacks ip } } serverStatus { info { phpVersion phpServerUser phpServerSoftware phpGatewayInterface phpServerProtocol osInfo cpuCount cpuModel CpuFreq cpuFamily lsCpu maxExecTime mathLibraries } ramChart(dateRange: $dateRangeWeek){ total value time } cpuChart(dateRange: $dateRangeWeek){ value time } discUsage{ total free } status } maliciousScript { lastTest { time } status } scoring( language: $language ){ score lastTest{ time } result{ ip country isHigherThan }} agentManager{ createdAt } antivirus { status } antivirus2 { currentSessionId currentSession { sessionStatus syncStatus downloadStatus suspicious downloaded total checked infected startTime } scans { list(input: $scanHistoryFilter) { edges { node { id status startTime finishTime checkedNum infectedNum downloadedNum suspiciousNum } } pageInfo { hasNextPage endCursor } } } } } } } } }","variables":{"scanHistoryFilter": { "dateRange": { "to": ' . $period['to'] . ', "from": ' . $period['from'] . ' },"pagination": {"first": 10, "cursor": null } }, "id":"' . $host_id . '","dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "dateRangeWeek":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "wafLogFilter": {"dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first": 10,"cursor":null}}, "language":"' . $language . '"}}';342 343 340 $payload = '{"query":"query($id: ID!, $dateRange: DateRangeInput!, $language: Language!, $dateRangeWeek: DateRangeInput!, $wafLogFilter: WafLogFilter!) { auth { viewer { sites { one(id: $id) { openPathSearch { time paths { httpCode severity path } } ports { status lastTest { time } ignorePorts TCPResults{ port technology version cveList{id summary } } UDPResults { port technology version cveList{id summary } } } domain { lastScanResult { isTaken hasSite redirectLink isLocal protection ips { ip location } status time } } sslResults{ results{ certStatus certIssuerName certExpiryDate certIssueDate } } ssl { status daysLeft expiryDate issueDate } reputation { status lastTest { time } virusList { virus{ type path } antiVirus } } firewall { lastTest { time } logs(wafLogFilter: $wafLogFilter){ edges{ node{ type blocked payload ip proxyIp userAgent description source region signatureId location{ country{ nameEn } } time request status country category } } } map(dateRange: $dateRange) { attacks, country } status chart(dateRange: $dateRange) { time attacks blocked } report(dateRange: $dateRange) { time attacks ip } } serverStatus { info { phpVersion phpServerUser phpServerSoftware phpGatewayInterface phpServerProtocol osInfo cpuCount cpuModel CpuFreq cpuFamily lsCpu maxExecTime mathLibraries } ramChart(dateRange: $dateRangeWeek){ total value time } cpuChart(dateRange: $dateRangeWeek){ value time } discUsage{ total free } status } maliciousScript { lastTest { time } status } scoring( language: $language ){ score lastTest{ time } result{ ip country isHigherThan }} agentManager{ createdAt } antivirus { status stats { changed deleted scanned infected error } lastTest { time } isFirstCheck } } } } } }","variables":{"id":"' . $host_id . '","dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "dateRangeWeek":{"to":' . $period['to'] . ',"from":' . $period['from'] . '}, "wafLogFilter": {"dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first": 10,"cursor":null}}, "language":"' . $language . '"}}'; 341 $response = self::sendRequest($payload, TRUE); 342 343 if (isset($response['data']['auth']['viewer']['sites']['one'])) { 344 return $response['data']['auth']['viewer']['sites']['one']; 345 } 346 347 return []; 348 } 349 350 351 /** 352 * Method for get all the site security data. 353 * 354 * @param string $host_id 355 * Host id on WebTotem. 356 * 357 * @return array 358 * Returns all data. 359 */ 360 public static function getMonitoring($host_id) { 361 362 $payload = '{"query":"query($id: ID!) { auth { viewer { sites { one(id: $id) { domain { lastScanResult { isTaken hasSite redirectLink isLocal protection ips { ip location } status time } } sslResults{ results{ certStatus certIssuerName certExpiryDate certIssueDate } } ssl { status daysLeft expiryDate issueDate } reputation { status lastTest { time } virusList { virus{ type path } antiVirus } } } } } } }","variables":{"id":"' . $host_id . '"}}'; 344 363 $response = self::sendRequest($payload, TRUE); 345 364 … … 430 449 */ 431 450 public static function getAntivirus(array $params) { 451 432 452 $cursor = ($params['cursor']) ? '"' . $params['cursor'] . '"' : 'null'; 453 $event = ($params['event']) ? '"' . $params['event'] . '"' : '"new"'; 454 $permissions = ($params['permissions']) ? ' "permissionsChanged":true, ' : ''; 433 455 $period = WebTotem::getPeriod($params['days']); 434 456 435 $payload = '{" variables":{"id":"' . $params['host_id'] . '" , "scanHistoryFilter": { "dateRange": { "to": ' . $period['to'] . ', "from": ' . $period['from'] . ' },"pagination": {"first": ' . $params['limit'] . ', "cursor": ' . $cursor . ' } }}, "query": "query($id: ID!, $scanHistoryFilter: ScanHistoryFilter) { auth { viewer { sites { one(id: $id) { antivirus2 { currentSessionId currentSession { sessionStatus syncStatus downloadStatus suspicious downloaded total checked infected startTime } scans { list(input: $scanHistoryFilter) { edges { node { id status startTime finishTime checkedNum infectedNum downloadedNum suspiciousNum } } pageInfo { hasNextPage endCursor } } }} } } } } }"}';436 $response = self::sendRequest($payload, TRUE); 437 438 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus 2'])) {439 return $response['data']['auth']['viewer']['sites']['one']['antivirus 2'];457 $payload = '{"operationName":null,"variables":{"id":"' . $params['host_id'] . '","avLogFilter":{' . $permissions . '"event":' . $event . ', "dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '},"order":{"direction":"DESC","field":"time"},"pagination":{"first":' . $params['limit'] . ',"cursor":' . $cursor . '}}},"query":"query ($id: ID!, $avLogFilter: AvLogFilter!) { auth { viewer { sites { one(id: $id) { id ... on Site { configs { ... on AvConfig { isActive id } } } antivirus { quarantine{ id path date } status log(avLogFilter: $avLogFilter) { edges { node { filePath event signatures time permissions permissionsChanged } } pageInfo { endCursor hasNextPage } } lastTest { time } stats { changed deleted scanned infected } } } } } } }"}'; 458 $response = self::sendRequest($payload, TRUE); 459 460 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus'])) { 461 return $response['data']['auth']['viewer']['sites']['one']['antivirus']; 440 462 } 441 463 return []; … … 443 465 444 466 /** 445 * Method to get antivirus data. 446 * 447 * @param array $params 448 * Parameters for filtering data. 449 * 450 * @return array 451 * Returns antivirus data. 452 */ 453 public static function getAntivirusLogs(array $params) { 454 455 $cursor = ($params['cursor']) ? '"' . $params['cursor'] . '"' : 'null'; 456 $period = WebTotem::getPeriod($params['days']); 457 458 $payload = '{"variables": { "id": "' . $params['host_id'] . '", "scanHistoryFilter": { "dateRange": { "to": ' . $period['to'] . ', "from": ' . $period['from'] . ' },"pagination": {"first": ' . $params['limit'] . ', "cursor": ' . $cursor . ' } } }, "query": "query AntivirusQuery($id: ID!, $scanHistoryFilter: ScanHistoryFilter) { auth { viewer { sites { one(id: $id) { antivirus2 { status currentSessionId scans { list(input: $scanHistoryFilter) { edges { node { id status startTime finishTime checkedNum infectedNum downloadedNum suspiciousNum } cursor } pageInfo { hasNextPage endCursor } } } } } } } } } "}'; 459 460 $response = self::sendRequest($payload, TRUE); 461 462 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus2']['scans']['list'])) { 463 return $response['data']['auth']['viewer']['sites']['one']['antivirus2']['scans']['list']; 464 } 465 return []; 466 } 467 468 /** 469 * Method to get antivirus current session. 470 * 471 * @param string $host_id 472 * Host id on WebTotem. 473 * 474 * @return array 475 * Returns antivirus current session data. 476 */ 477 public static function getAntivirusSession($host_id) { 478 479 $payload = '{"variables":{"id":"' . $host_id . '"}, "query": "query($id: ID!) { auth { viewer { sites { one(id: $id) { antivirus2 { currentSession { sessionStatus syncStatus downloadStatus suspicious downloaded total checked infected startTime } } } } } } } "}'; 480 $response = self::sendRequest($payload, TRUE); 481 482 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus2'])) { 483 return $response['data']['auth']['viewer']['sites']['one']['antivirus2']; 467 * Method to get antivirus last test. 468 * 469 * @param string $host_id 470 * Host id on WebTotem. 471 * 472 * @return array 473 * Returns antivirus last test data. 474 */ 475 public static function getAntivirusLastTest($host_id) { 476 477 $payload = '{"variables":{"id":"' . $host_id . '"},"query":"query ($id: ID!) { auth { viewer { sites { one(id: $id) { antivirus { status lastTest { time } } } } } } }"}'; 478 $response = self::sendRequest($payload, TRUE); 479 480 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus'])) { 481 return $response['data']['auth']['viewer']['sites']['one']['antivirus']; 484 482 } 485 483 return []; … … 503 501 504 502 /** 505 * Method to get antivirus data. 506 * 507 * @param array $params 508 * Parameters for filtering data. 509 * 510 * @return array 511 * Returns antivirus data. 512 */ 513 public static function getInfectedFiles(array $params) { 514 515 $cursor = ($params['cursor']) ? '"' . $params['cursor'] . '"' : 'null'; 516 $payload = '{ "variables": { "id": "' . $params['host_id'] . '", "infectedFilesFilter": { "sessionId": "' . $params['session_id'] . '", "pagination": { "first": ' . $params['limit'] . ' , "cursor": ' . $cursor . ' } } }, "query": "query infectedFilesQuery($id: ID!, $infectedFilesFilter: InfectedFilesFilter!) { auth { viewer { sites { one(id: $id) { antivirus2 { infectedFiles(input: $infectedFilesFilter) { edges { cursor node { path result { signatureId rowNum offset filePart } } } pageInfo { hasNextPage endCursor } } } } } } }}" }'; 517 $response = self::sendRequest($payload, TRUE); 518 519 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus2']['infectedFiles']['edges'])) { 520 return $response['data']['auth']['viewer']['sites']['one']['antivirus2']['infectedFiles']['edges']; 521 } 522 return []; 503 * Method to export antivirus report. 504 * 505 * @param string $host_id 506 * Host id on WebTotem. 507 * @param int|array $days 508 * For what period data is needed. 509 * 510 * @return array 511 * Returns information whether the request was successful. 512 */ 513 public static function avExport($host_id, $days = 30) { 514 $period = WebTotem::getPeriod($days); 515 $payload = '{"variables":{ "input":{"siteId":"' . $host_id . '", "dateRange":{"to":' . $period['to'] . ',"from":' . $period['from'] . '} }},"query":"mutation ($input: AvLogExportInput!) { auth { sites { av { export(input: $input) } } } }"} '; 516 return self::sendRequest($payload, TRUE); 523 517 } 524 518 … … 533 527 */ 534 528 public static function getQuarantineList($host_id) { 535 536 $payload = '{"variables": { "id": "' . $host_id . '" }, "query": "query AntivirusQuarantineQuery($id: ID!) { auth { viewer { sites { one(id: $id) { antivirus2 { quarantineFiles { path } } } } } } }"}'; 537 $response = self::sendRequest($payload, TRUE); 538 539 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus2']['quarantineFiles']['path'])) { 540 return $response['data']['auth']['viewer']['sites']['one']['antivirus2']['quarantineFiles']['path']; 529 $payload = '{"query":"query{ auth{ viewer{ sites{ one(id:\"' . $host_id . '\"){ antivirus{ quarantine{ id path date } } } } } } } "}'; 530 $response = self::sendRequest($payload, TRUE); 531 532 if (isset($response['data']['auth']['viewer']['sites']['one']['antivirus']['quarantine'])) { 533 return $response['data']['auth']['viewer']['sites']['one']['antivirus']['quarantine']; 541 534 } 542 535 return []; … … 555 548 */ 556 549 public static function moveToQuarantine($host_id, $path) { 557 $payload = '{ "variables": { "siteId": "' . $host_id . '", "path": "' . $path . '" }, "query": "mutation MoveToQuarantine($siteId: ID!, $path: String!) { auth { sites { antivirusMutations { toQuarantine(input: {siteId: $siteId, path: $path}) } } }}"}';550 $payload = '{"query":"mutation{ auth{ sites{ av{ moveToQuarantine(input:{ siteId:\"' . $host_id . '\", path:\"' . $path . '\" }) } } } } "}'; 558 551 return self::sendRequest($payload, TRUE); 559 552 } … … 562 555 * Method to move file from quarantine. 563 556 * 564 * @param string $host_id 565 * Host id on WebTotem. 566 * @param string $path 567 * Path to the file. 568 * 569 * @return array 570 * Returns information whether the request was successful. 571 */ 572 public static function moveFromQuarantine($host_id, $path) { 573 $payload = '{"variables": { "siteId": "' . $host_id . '", "path": "' . $path . '" }, "query": "mutation MoveFromQuarantine($siteId: ID!, $path: String!) { auth { sites { antivirusMutations { fromQuarantine(input: {siteId: $siteId, path: $path}) } } } }"}'; 557 * @param string $id 558 * Id assigned to the file. 559 * 560 * @return array 561 * Returns information whether the request was successful. 562 */ 563 public static function moveFromQuarantine($id) { 564 $payload = '{"query":"mutation{ auth{ sites{ av{ moveFromQuarantine(id: \"' . $id . '\") } } } } "}'; 574 565 return self::sendRequest($payload, TRUE); 575 566 } … … 662 653 */ 663 654 public static function getOpenPaths($host_id) { 664 $payload = '{"query":"query($id: ID!) { auth { viewer { sites { one(id: $id) { openPathSearch { createdAtpaths { httpCode severity path } } } } } } } ","variables":{"id":"' . $host_id . '"}}';655 $payload = '{"query":"query($id: ID!) { auth { viewer { sites { one(id: $id) { openPathSearch { time paths { httpCode severity path } } } } } } } ","variables":{"id":"' . $host_id . '"}}'; 665 656 666 657 $response = self::sendRequest($payload, TRUE); -
wt-security/trunk/lib/AgentManager.php
r3023313 r3045336 36 36 37 37 if ( $files['amFilename'] ) { 38 39 if (!is_writable(ABSPATH)) { 40 WebTotemOption::setNotification('error', __('There are no permissions to write the file to the root directory', 'wtotem')); 41 return FALSE; 42 } 38 43 39 44 // Download file. -
wt-security/trunk/lib/Ajax.php
r3041272 r3045336 1190 1190 $dos = WebTotemRequest::post('dos'); 1191 1191 $dos_limit = WebTotemRequest::post('dos_limit'); 1192 // 1193 // 1192 // $login_attempt = WebTotemRequest::post('login_attempt'); 1193 // $login_attempt_limit = WebTotemRequest::post('login_attempt_limit'); 1194 1194 1195 1195 if ($dos) { … … 1202 1202 } 1203 1203 1204 // 1205 // 1206 // 1207 // 1208 // 1209 // 1210 // 1211 // 1204 // if ($login_attempt) { 1205 // if (empty($login_attempt_limit)) { 1206 // $response['errors']['login_attempt_limit'] = __('The field is required.', 'wtotem'); 1207 // } else if ($login_attempt_limit < 5 or $login_attempt_limit > 30) { 1208 // $response['success'] = false; 1209 // $response['errors']['login_attempt_limit'] = sprintf(__('Please specify a value from %s to %s.', 'wtotem'), '5', '30'); 1210 // } 1211 // } 1212 1212 1213 1213 if (!$response['success']) { … … 1775 1775 } 1776 1776 1777 /** 1778 * Forced checking of services. 1779 * 1780 * @return void 1781 */ 1782 public static function force_check() 1783 { 1784 if (WebTotemRequest::post('ajax_action') !== 'force_check') { 1785 return; 1786 } 1787 1788 $service = WebTotemRequest::post('service'); 1789 $host = WebTotemAPI::siteInfo(); 1790 $template = new WebTotemTemplate(); 1791 1792 $response['success'] = false; 1793 1794 if($service){ 1795 // force check service 1796 $_response = WebTotemAPI::forceCheck($host['id'], $service); 1797 1798 if (!isset($_response['errors'])) { 1799 1800 1801 switch ($service) { 1802 case 'ps': 1803 $ports = WebTotemAPI::getAllPortsList($host['id']); 1804 1805 if($ports['TCPResults']){ 1806 $open_ports[] = [ 1807 'variables' => [ 1808 "ports" => WebTotem::getOpenPortsData($ports['TCPResults']), 1809 ], 1810 'template' => 'open_ports', 1811 ]; 1812 1813 $open_ports_few[] = [ 1814 'variables' => [ 1815 "more" => true, 1816 "ports" => $ports['TCPResults'] ? WebTotem::getOpenPortsData(array_slice($ports['TCPResults'], 0, 3)) : [], 1817 ], 1818 'template' => 'open_ports', 1819 ]; 1820 } 1821 1822 $ignore_ports[] = [ 1823 'variables' => [ 1824 "ports" => $ports, 1825 ], 1826 'template' => 'ignore_ports', 1827 ]; 1828 $response = [ 1829 'status' => WebTotem::getStatusData($ports['status']), 1830 'last_test' => WebTotem::dateFormatter($ports['lastTest']['time']), 1831 'open_ports' => (isset($open_ports)) ? $template->arrayRender($open_ports) : '', 1832 'open_ports_few' => (isset($open_ports_few)) ? $template->arrayRender($open_ports_few) : '', 1833 'ignore_ports' => $template->arrayRender($ignore_ports), 1834 ]; 1835 1836 $response['success'] = true; 1837 1838 break; 1839 1840 case 'ops': 1841 1842 $open_path_data = WebTotemAPI::getOpenPaths($host['id']); 1843 $open_path[] = [ 1844 'variables' => [ 1845 "paths" => $open_path_data['paths'], 1846 ], 1847 'template' => 'open_paths', 1848 ]; 1849 1850 $response = [ 1851 'status' => WebTotem::getStatusData(($open_path_data['paths']) ? 'warning' : 'clean'), 1852 "last_test" => WebTotem::dateFormatter($open_path_data['time']), 1853 'open_paths' => $template->arrayRender($open_path), 1854 ]; 1855 1856 $response['success'] = true; 1857 break; 1858 } 1859 1860 1861 1862 } 1863 } 1864 1865 $response['notifications'] = self::notifications(); 1866 1867 1868 wp_send_json($response); 1869 } 1777 /** 1778 * Forced checking of services. 1779 * 1780 * @return void 1781 */ 1782 public static function force_check() 1783 { 1784 if (WebTotemRequest::post('ajax_action') !== 'force_check') { 1785 return; 1786 } 1787 1788 $service = WebTotemRequest::post('service'); 1789 $host = WebTotemAPI::siteInfo(); 1790 $template = new WebTotemTemplate(); 1791 1792 $response['success'] = false; 1793 1794 if($service){ 1795 // force check service 1796 $_response = WebTotemAPI::forceCheck($host['id'], $service); 1797 1798 if (!isset($_response['errors'])) { 1799 1800 1801 switch ($service) { 1802 1803 case 'ssl': 1804 $data = WebTotemAPI::getMonitoring($host['id']); 1805 1806 $ssl = [ 1807 'status' => WebTotem::getStatusData($data['sslResults']['results'][0]['certStatus']), 1808 'cert_name' => $data['sslResults']['results'][0]['certIssuerName'], 1809 'days_left' => WebTotem::daysLeft($data['sslResults']['results'][0]['certExpiryDate']), 1810 'issue_date' => WebTotem::dateFormatter($data['sslResults']['results'][0]['certIssueDate']), 1811 'expiry_date' => WebTotem::dateFormatter($data['sslResults']['results'][0]['certExpiryDate']), 1812 ]; 1813 1814 $build[] = [ 1815 'variables' => [ 1816 'ssl' => $ssl, 1817 ], 1818 'template' => 'monitoring_ssl', 1819 ]; 1820 1821 $response['content'] = $template->arrayRender($build); 1822 $response['success'] = true; 1823 break; 1824 1825 case 'dec': 1826 $data = WebTotemAPI::getMonitoring($host['id']); 1827 1828 $domain = [ 1829 'status' => WebTotem::getStatusData($data['domain']['lastScanResult']['status']), 1830 "redirect_link" => $data['domain']['lastScanResult']['redirectLink'], 1831 "is_created_at" => (bool)$data['domain']['lastScanResult']['time'], 1832 "created_at" => WebTotem::dateFormatter($data['domain']['lastScanResult']['time']), 1833 "is_taken" => $data['domain']['lastScanResult']['isTaken'], 1834 "ips" => $data['domain']['lastScanResult']['ips'], 1835 "protection" => $data['domain']['lastScanResult']['protection'], 1836 ]; 1837 1838 $build[] = [ 1839 'variables' => [ 1840 'domain' => $domain, 1841 ], 1842 'template' => 'monitoring_domain', 1843 ]; 1844 1845 $response['content'] = $template->arrayRender($build); 1846 $response['success'] = true; 1847 break; 1848 1849 case 'rc': 1850 $data = WebTotemAPI::getMonitoring($host['id']); 1851 1852 $reputation = [ 1853 "status" => WebTotem::getStatusData($data['reputation']['status']), 1854 "blacklists_entries" => WebTotem::blacklistsEntries($data['reputation']['status'], $data['reputation']['virusList']), 1855 "info" => WebTotem::getReputationInfo($data['reputation']['status']), 1856 "last_test" => WebTotem::dateFormatter($data['reputation']['lastTest']['time']), 1857 ]; 1858 1859 $build[] = [ 1860 'variables' => [ 1861 'reputation' => $reputation, 1862 ], 1863 'template' => 'monitoring_reputation', 1864 ]; 1865 1866 $response['content'] = $template->arrayRender($build); 1867 $response['success'] = true; 1868 break; 1869 1870 case 'ps': 1871 $ports = WebTotemAPI::getAllPortsList($host['id']); 1872 1873 if($ports['TCPResults']){ 1874 $open_ports[] = [ 1875 'variables' => [ 1876 "ports" => WebTotem::getOpenPortsData($ports['TCPResults']), 1877 ], 1878 'template' => 'open_ports', 1879 ]; 1880 1881 $open_ports_few[] = [ 1882 'variables' => [ 1883 "more" => true, 1884 "ports" => $ports['TCPResults'] ? WebTotem::getOpenPortsData(array_slice($ports['TCPResults'], 0, 3)) : [], 1885 ], 1886 'template' => 'open_ports', 1887 ]; 1888 } 1889 1890 $ignore_ports[] = [ 1891 'variables' => [ 1892 "ports" => $ports, 1893 ], 1894 'template' => 'ignore_ports', 1895 ]; 1896 $response = [ 1897 'status' => WebTotem::getStatusData($ports['status']), 1898 'last_test' => WebTotem::dateFormatter($ports['lastTest']['time']), 1899 'open_ports' => (isset($open_ports)) ? $template->arrayRender($open_ports) : '', 1900 'open_ports_few' => (isset($open_ports_few)) ? $template->arrayRender($open_ports_few) : '', 1901 'ignore_ports' => $template->arrayRender($ignore_ports), 1902 ]; 1903 1904 $response['success'] = true; 1905 1906 break; 1907 1908 case 'ops': 1909 1910 $open_path_data = WebTotemAPI::getOpenPaths($host['id']); 1911 $open_path[] = [ 1912 'variables' => [ 1913 "paths" => $open_path_data['paths'], 1914 ], 1915 'template' => 'open_paths', 1916 ]; 1917 1918 $response = [ 1919 'status' => WebTotem::getStatusData(($open_path_data['paths']) ? 'warning' : 'clean'), 1920 "last_test" => WebTotem::dateFormatter($open_path_data['time']), 1921 'open_paths' => $template->arrayRender($open_path), 1922 ]; 1923 1924 $response['success'] = true; 1925 break; 1926 } 1927 1928 1929 1930 } 1931 } 1932 1933 $response['notifications'] = self::notifications(); 1934 1935 1936 wp_send_json($response); 1937 } 1870 1938 1871 1939 /** … … 1931 1999 */ 1932 2000 public static function user_feedback() { 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 2001 if (WebTotemRequest::post('ajax_action') !== 'user_feedback') { 2002 return; 2003 } 2004 2005 $data = [ 2006 'score' => (int)WebTotemRequest::post('score'), 2007 'feedback' => WebTotemRequest::post('feedback') 2008 ]; 2009 2010 $response_data = WebTotemAPI::setFeedback($data); 2011 if($response_data['message'] == 'Score added'){ 2012 $response['content'] = '<div style="text-align: center;"><img src="'.WebTotem::getImagePath('').'popup_success_icon.svg" style="width: 85px;"><p class="user-feedback__title" style="margin-bottom: 20px">'.__('Thank you for feedback', 'wtotem').'</p><button id="user-feedback-ok" class="wtotem_control__btn">Okay</button></div>'; 2013 $response['success'] = true; 2014 WebTotemOption::setNotification('success', __('Your reply has been sent successfully.', 'wtotem')); 2015 } else { 2016 WebTotemOption::setNotification('error', __('There were difficulties. Your reply has not been sent.', 'wtotem')); 2017 $response['success'] = false; 2018 } 2019 2020 $response['notifications'] = self::notifications(); 2021 2022 wp_send_json($response); 1955 2023 } 1956 2024 … … 1979 2047 case 'dashboard': 1980 2048 1981 1982 2049 $data = WebTotemAPI::getAllData($host['id']); 2050 WebTotemCache::setData(['getAllData' => $data], $host['id']); 1983 2051 1984 2052 // Start build array for rendering. … … 2081 2149 2082 2150 // Monitoring blocks. 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 'variables' => [ 2109 2110 2151 $ssl= false; 2152 if($data['sslResults']['results']){ 2153 $ssl = [ 2154 'status' => WebTotem::getStatusData($data['sslResults']['results'][0]['certStatus']), 2155 'cert_name' => $data['sslResults']['results'][0]['certIssuerName'], 2156 'days_left' => WebTotem::daysLeft($data['sslResults']['results'][0]['certExpiryDate']), 2157 'issue_date' => WebTotem::dateFormatter($data['sslResults']['results'][0]['certIssueDate']), 2158 'expiry_date' => WebTotem::dateFormatter($data['sslResults']['results'][0]['certExpiryDate']), 2159 ]; 2160 } 2161 2162 $domain = false; 2163 if(WebTotem::isKz()){ 2164 $domain = [ 2165 'status' => WebTotem::getStatusData($data['domain']['lastScanResult']['status']), 2166 "redirect_link" => $data['domain']['lastScanResult']['redirectLink'], 2167 "is_created_at" => (bool)$data['domain']['lastScanResult']['time'], 2168 "created_at" => WebTotem::dateFormatter($data['domain']['lastScanResult']['time']), 2169 "is_taken" => $data['domain']['lastScanResult']['isTaken'], 2170 "ips" => $data['domain']['lastScanResult']['ips'], 2171 "protection" => $data['domain']['lastScanResult']['protection'], 2172 ]; 2173 } 2174 2175 $build['monitoring'] = [ 2176 'variables' => [ 2177 "ssl" => $ssl, 2178 "domain" => $domain, 2111 2179 'reputation' => [ 2112 2180 "status" => WebTotem::getStatusData($data['reputation']['status']), … … 2125 2193 'variables' => [ 2126 2194 "ports" => [ 2127 2128 2129 2130 2195 'status' => WebTotem::getStatusData($data['ports']['status']), 2196 "TCPResults" => WebTotem::getOpenPortsData($data['ports']['TCPResults']), 2197 "ignore_ports" => $data['ports']['ignorePorts'], 2198 "last_test" => WebTotem::dateFormatter($data['ports']['lastTest']['time']), 2131 2199 ], 2132 2133 2134 2135 2136 2200 "open_path" => [ 2201 'status' => WebTotem::getStatusData(($data['openPathSearch']['paths']) ? 'warning' : 'clean'), 2202 "last_test" => WebTotem::dateFormatter($data['openPathSearch']['time']), 2203 "paths" => $data['openPathSearch']['paths'], 2204 ], 2137 2205 ], 2138 2206 'template' => 'scanning', -
wt-security/trunk/readme.txt
r3041272 r3045336 71 71 72 72 == Changelog == 73 = 2.4.24 = 74 * Added forceCheck buttons 75 * Fixed AV data request 76 * Internal improvements 77 73 78 = 2.4.23 = 74 79 * Fixed some errors WP scan -
wt-security/trunk/src/PageHandler.php
r3041272 r3045336 94 94 'notifications' => WebTotem::getNotifications(), 95 95 'current_year' => date('Y'), 96 'page' => 'activation', 96 97 ], 97 98 'template' => 'activation' -
wt-security/trunk/wt-security.php
r3041272 r3045336 7 7 * Text Domain: wtotem 8 8 * Domain Path: /lang 9 * Version: 2.4.2 39 * Version: 2.4.24 10 10 * 11 11 * PHP version 7.1 … … 54 54 * Current version of the plugin's code. 55 55 */ 56 define('WEBTOTEM_VERSION', '2.4.2 3');56 define('WEBTOTEM_VERSION', '2.4.24'); 57 57 58 58 /**
Note: See TracChangeset
for help on using the changeset viewer.