diff --git a/inc/spbc-settings.php b/inc/spbc-settings.php index ffa942d55..735f6d36c 100644 --- a/inc/spbc-settings.php +++ b/inc/spbc-settings.php @@ -2905,6 +2905,100 @@ function spbc_field_scanner__prepare_data__analysis_log(&$table) } } +/** + * Count found in os cron. + * @return int + */ +function spbc_scanner_oscron_count_found() +{ + return count(spbc_scanner_oscron_get_scanned()); +} + +/** + * Get data for oscron. + * @return array + */ +function spbc_scanner_oscron_get_scanned() +{ + $result = get_option('spbc_oscron_result', []); + + if (!empty($result)) { + $result = json_decode($result, true); + } + + if (is_null($result)) { + $result = []; + } + + + return $result; +} + +/** + * Prepare data for oscron. + * @param $table + */ +function spbc_scanner_oscron_prepare_data(&$table) +{ + foreach ($table->rows as $key => $row) { + $table->items[$key] = array( + 'uid' => $row['id'], + 'cb' => $row['id'], + 'id' => $row['id'], + 'repeat' => spbc_scanner_oscron_time_to_human_readable($row['repeat']), + 'command' => $row['command'], + // 'actions' => $row['actions'], + ); + } +} + +/** + * Convert cron time to human readable. + * @param $time + * @return string + */ +function spbc_scanner_oscron_time_to_human_readable($time) +{ + $cronParts = explode(' ', $time); + + if (count($cronParts) !== 5) { + return __('Invalid cron expression', 'security-malware-firewall'); + } + + list($minute, $hour, $dayOfMonth, $month, $dayOfWeek) = $cronParts; + + $humanReadable = __('At ', 'security-malware-firewall'); + + // Handle minutes + if ($minute === '*') { + $humanReadable .= __('every minute', 'security-malware-firewall'); + } else { + $humanReadable .= __('minute', 'security-malware-firewall') . ' ' . $minute; + } + + // Handle hours + if ($hour !== '*') { + $humanReadable .= __(' past hour ', 'security-malware-firewall') . $hour; + } + + // Handle days of the month + if ($dayOfMonth !== '*') { + $humanReadable .= __(' on day ', 'security-malware-firewall') . $dayOfMonth; + } + + // Handle months + if ($month !== '*') { + $humanReadable .= __(' of month ', 'security-malware-firewall') . $month; + } + + // Handle days of the week + if ($dayOfWeek !== '*') { + $humanReadable .= __(' on day of the week ', 'security-malware-firewall') . $dayOfWeek; + } + + return $humanReadable; +} + function spbc_field_scanner__prepare_data__files_quarantine(&$table) { global $spbc; @@ -3265,6 +3359,10 @@ function spbc_field_scanner() echo '' . __('Curing', 'security-malware-firewall') . ' -> '; } + if ($spbc->settings['scanner__os_cron_analysis']) { + echo '' . __('OS Cron Analysis', 'security-malware-firewall') . ' -> '; + } + if ($spbc->settings['scanner__outbound_links']) { echo '' . __('Scanning links', 'security-malware-firewall') . ' -> '; } @@ -3480,6 +3578,10 @@ function spbc_field_scanner__show_accordion($direct_call = false) $tables_files['unknown'] = $unknown_files_description; } + if ($spbc->settings['scanner__os_cron_analysis']) { + $tables_files['oscron'] = __('OS Cron Analysis', 'security-malware-firewall'); + } + if ($spbc->settings['scanner__list_approved_by_cleantalk']) { $tables_files['approved_by_cloud'] = __('Approved by CleanTalk Team or Clout files list. To disable this list view, please disable the `Show approved by CleanTalk Cloud` option.', 'security-malware-firewall'); } @@ -3522,6 +3624,15 @@ function spbc_field_scanner__show_accordion($direct_call = false) 'files_listing', ), ), + 'os_cron_analysis' => array( + 'category_description' => __('OS Cron Analysis', 'security-malware-firewall'), + 'types' => array( + 'oscron', + 'oscron_quarantined', + 'oscron_approved', + ), + 'display' => true + ), 'pages' => array( 'category_description' => __('Pages scan results', 'security-malware-firewall'), 'types' => array( @@ -3999,6 +4110,33 @@ function spbc_list_table__get_args_by_type($table_type) $args['actions']['send'] = array('name' => 'Send for Analysis',); break; + case 'oscron': + $args = array_replace_recursive( + array( + 'func_data_total' => 'spbc_scanner_oscron_count_found', + 'func_data_get' => 'spbc_scanner_oscron_get_scanned', + 'func_data_prepare' => 'spbc_scanner_oscron_prepare_data', + 'if_empty_items' => '

' . __('Crontab not found.', 'security-malware-firewall') . '

', + 'columns' => array( + 'cb' => array('heading' => '', 'class' => 'check-column', 'width_percent' => 5), + 'id' => array('heading' => 'id', 'primary' => true, 'width_percent' => 15), + 'repeat' => array('heading' => 'repeat', 'primary' => true, 'width_percent' => 15), + 'command' => array('heading' => 'command', 'primary' => true, 'width_percent' => 65), + ), + 'actions' => array( + 'delete' => array('name' => 'Delete',), + 'quarantine' => array('name' => 'Quarantine',), + 'approve' => array('name' => 'Approve',), + ), + 'bulk_actions' => array( + 'delete' => array('name' => 'Delete',), + 'quarantine' => array('name' => 'Quarantine',), + 'approve' => array('name' => 'Approve',), + ), + ) + ); + break; + case 'approved': $args = array_replace_recursive( $accordion_default_args, diff --git a/js/spbc-common.min.js b/js/spbc-common.min.js index fa4f588c4..ca9cdd821 100644 --- a/js/spbc-common.min.js +++ b/js/spbc-common.min.js @@ -1,2 +1,2 @@ -function spbcTimestamp(){return Math.floor(+new Date/1e3)}function spbcHighlightElement(e,r){r=r-1||0,jQuery("html, body").animate({scrollTop:jQuery(jQuery("#"+e)).offset().top-100},"slow"),jQuery("#"+e).addClass("spbc_highlighted"),jQuery("#"+e).animate({outlineColor:"rgba(255, 0, 0, 1.0)"},400,"linear",function(){jQuery("#"+e).animate({outlineColor:"rgba(255, 0, 0, 0.0)"},400,"linear",function(){00) {\n spbcHighlightElement(id, times);\n } else {\n jQuery('#'+id).removeClass('spbc_highlighted');\n }\n });\n });\n}\n\n/**\n * Send AJAX Request\n *\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcSendAJAXRequest(data, params, obj) {/* eslint-disable-line no-unused-vars */\n let dataType = params.notJson ? 'text' : 'json';\n\n // Default params\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n let callback = params.callback || null;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n obj = obj || null;\n let context = params.context || this;\n\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) {\n if (Array.isArray(spinner)) {\n spinner.forEach(function(el) {\n jQuery(el).css('display', 'inline');\n });\n } else {\n jQuery(spinner).css('display', 'inline');\n }\n }\n\n // Adding security code\n data.security = spbcSettings.ajax_nonce;\n data.no_cache = Math.random();\n\n // Using passed successCallback() or default\n let success = params.success || function(result) {\n if (button) {\n button.removeAttribute('disabled');\n button.style.cursor = 'pointer';\n }\n\n if (spinner) {\n if (Array.isArray(spinner)) {\n spinner.forEach(function(el) {\n jQuery(el).css('display', 'none');\n });\n } else {\n jQuery(spinner).css('display', 'none');\n }\n }\n\n if (!notJson && typeof result !== 'object') {\n result = JSON.parse(result);\n }\n\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n let errorComment = typeof result.error_comment !== 'undefined' ? result.error_comment : null;\n const hideSupportLink = typeof result.hide_support_link !== 'undefined';\n errorOutput( result.error, errorComment, hideSupportLink );\n jQuery('.tbl-preloader--in_button').css('display', 'none');\n } else if (callback) {\n callback(result, data, params, obj);\n }\n };\n\n // Using passed successCallback() or default\n let error = params.error || function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled');\n button.style.cursor = 'pointer';\n }\n if (spinner) {\n if (Array.isArray(spinner)) {\n spinner.forEach(function(el) {\n jQuery(el).css('display', 'none');\n });\n } else {\n jQuery(spinner).css('display', 'none');\n }\n }\n\n console.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n console.log( textStatus );\n console.log( errorThrown );\n console.log( jqXHR );\n\n errorOutput( textStatus );\n };\n\n var errorOutput = params.errorOutput || function( msg ) {};/* eslint-disable-line no-var */\n\n jQuery.ajax({\n context: context,\n type: 'POST',\n url: spbcSettings.ajaxurl,\n data: data,\n dataType: dataType,\n success: success,\n error: error,\n timeout: timeout,\n });\n}\n"],"names":["spbcTimestamp","Math","floor","Date","spbcHighlightElement","id","times","jQuery","animate","scrollTop","offset","top","addClass","outlineColor","removeClass","spbcSendAJAXRequest","data","params","obj","let","dataType","notJson","button","spinner","progressbar","callback","timeout","context","this","success","setAttribute","style","cursor","Array","isArray","forEach","el","css","security","spbcSettings","ajax_nonce","no_cache","random","result","errorComment","hideSupportLink","removeAttribute","JSON","parse","error","setTimeout","fadeOut","error_comment","hide_support_link","errorOutput","jq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,KAAM,OACNC,IAAKxB,aAAayB,QAClBhD,KAAMA,EACNI,SAAUA,EACVS,QAASA,EACToB,MAAOA,EACPvB,QAASA,CACb,CAAC,CACL"} \ No newline at end of file +{"version":3,"file":"spbc-common.min.js","sources":["spbc-common.js"],"sourcesContent":["/**\n * Timestamp\n *\n * @return {number}\n */\nfunction spbcTimestamp() {/* eslint-disable-line no-unused-vars */\n return Math.floor(+new Date() / 1000);\n}\n\n/**\n * Hightlights element\n *\n * @param {number|string} id\n * @param {number} times\n */\nfunction spbcHighlightElement(id, times) {/* eslint-disable-line no-unused-vars */\n times = times-1 || 0;\n jQuery('html, body').animate({scrollTop: jQuery(jQuery('#'+id)).offset().top - 100}, 'slow');\n jQuery('#'+id).addClass('spbc_highlighted');\n jQuery('#'+id).animate({outlineColor: 'rgba(255, 0, 0, 1.0)'}, 400, 'linear', function() {\n jQuery('#'+id).animate({outlineColor: 'rgba(255, 0, 0, 0.0)'}, 400, 'linear', function() {\n if (times>0) {\n spbcHighlightElement(id, times);\n } else {\n jQuery('#'+id).removeClass('spbc_highlighted');\n }\n });\n });\n}\n\n/**\n * Send AJAX Request\n *\n * @param {obj} data\n * @param {obj} params\n * @param {obj} obj\n */\nfunction spbcSendAJAXRequest(data, params, obj) {/* eslint-disable-line no-unused-vars */\n let dataType = params.notJson ? 'text' : 'json';\n\n // Default params\n let button = params.button || null;\n let spinner = params.spinner || null;\n let progressbar = params.progressbar || null;\n let callback = params.callback || null;\n let notJson = params.notJson || null;\n let timeout = params.timeout || 15000;\n obj = obj || null;\n let context = params.context || this;\n\n // Button and spinner\n if (button) {\n button.setAttribute('disabled', 'disabled'); button.style.cursor = 'not-allowed';\n }\n if (spinner) {\n if (Array.isArray(spinner)) {\n spinner.forEach(function(el) {\n jQuery(el).css('display', 'inline');\n });\n } else {\n jQuery(spinner).css('display', 'inline');\n }\n }\n\n // Adding security code\n data.security = spbcSettings.ajax_nonce;\n data.no_cache = Math.random();\n\n // Using passed successCallback() or default\n let success = params.success || function(result) {\n if (button) {\n button.removeAttribute('disabled');\n button.style.cursor = 'pointer';\n }\n\n if (spinner) {\n if (Array.isArray(spinner)) {\n spinner.forEach(function(el) {\n jQuery(el).css('display', 'none');\n });\n } else {\n jQuery(spinner).css('display', 'none');\n }\n }\n\n if (!notJson && typeof result !== 'object') {\n result = JSON.parse(result);\n }\n\n if (result.error) {\n setTimeout(function() {\n if (progressbar) progressbar.fadeOut('slow');\n }, 1000);\n let errorComment = typeof result.error_comment !== 'undefined' ? result.error_comment : null;\n const hideSupportLink = typeof result.hide_support_link !== 'undefined';\n errorOutput( result.error, errorComment, hideSupportLink );\n jQuery('.tbl-preloader--in_button').css('display', 'none');\n } else if (callback) {\n callback(result, data, params, obj);\n }\n };\n\n // Using passed successCallback() or default\n let error = params.error || function(jqXHR, textStatus, errorThrown) {\n if (button) {\n button.removeAttribute('disabled');\n button.style.cursor = 'pointer';\n }\n if (spinner) {\n if (Array.isArray(spinner)) {\n spinner.forEach(function(el) {\n jQuery(el).css('display', 'none');\n });\n } else {\n jQuery(spinner).css('display', 'none');\n }\n }\n\n console.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n console.log( textStatus );\n console.log( errorThrown );\n console.log( jqXHR );\n\n errorOutput( textStatus );\n };\n\n var errorOutput = params.errorOutput || function( msg ) {};/* eslint-disable-line no-var */\n\n jQuery.ajax({\n context: context,\n type: 'POST',\n url: spbcSettings.ajaxurl,\n data: data,\n dataType: dataType,\n success: success,\n error: error,\n timeout: timeout,\n });\n}\n"],"names":["spbcTimestamp","Math","floor","Date","spbcHighlightElement","id","times","jQuery","animate","scrollTop","offset","top","addClass","outlineColor","removeClass","spbcSendAJAXRequest","data","params","obj","let","dataType","notJson","button","spinner","progressbar","callback","timeout","context","this","success","setAttribute","style","cursor","Array","isArray","forEach","el","css","security","spbcSettings","ajax_nonce","no_cache","random","result","errorComment","hideSupportLink","removeAttribute","JSON","parse","error","setTimeout","fadeOut","error_comment","hide_support_link","errorOutput","msg","ajax","type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,CAAY,EACzBC,QAAQC,IAAKJ,CAAM,EAEnBN,EAAaO,CAAW,CAC5B,EAYInC,QAASA,CACb,CAAC,CACL"} \ No newline at end of file diff --git a/js/spbc-cookie.min.js b/js/spbc-cookie.min.js index f389feeab..b10093e9e 100644 --- a/js/spbc-cookie.min.js +++ b/js/spbc-cookie.min.js @@ -1,2 +1,2 @@ -function spbcSetCookie(e,o,t){"string"!=typeof e||"string"!=typeof o&&"number"!=typeof o||(e=[[e,o,t]]),0!=+spbcPublic.data__set_cookies&&(1==+spbcPublic.data__set_cookies?e.forEach(function(e,o,t){var s=void 0!==e[2]?"expires="+e[2]+"; ":"",c="https:"===location.protocol?"; secure":"";document.cookie=e[0]+"="+encodeURIComponent(e[1])+"; "+s+"path=/; samesite=lax"+c}):2==+spbcPublic.data__set_cookies&&1==+spbcPublic.data__set_cookies__alt_sessions_type&&spbcSendRESTRequest("alt_sessions",{method:"POST",data:{cookies:e}}))}function spbcSendRESTRequest(o,t){let s=t.callback||null;var e=t.data||[],c=t.method||"POST";jQuery.ajax({type:c,url:spbcPublic._rest_url+"cleantalk-security/v1/"+o,data:e,beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",spbcPublic._rest_nonce),e.setRequestHeader("X-Robots-Tag","noindex, nofollow")},success:function(e){e.error?console.log("Security by Cleantalk. Error: "+(e.error||"Unknown")):s&&s(e,o,t,null)},error:function(e,o,t){t&&(console.log("SPBCT_REST_ERROR"),console.log(e),console.log(o),console.log("Security by Cleantalk plugin REST API error: "+t+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/security-malware-firewall/"))}})} +function spbcSetCookie(e,o,t){"string"!=typeof e||"string"!=typeof o&&"number"!=typeof o||(e=[[e,o,t]]),0!=+spbcPublic.data__set_cookies&&(1==+spbcPublic.data__set_cookies?e.forEach(function(e,o,t){var s=void 0!==e[2]?"expires="+e[2]+"; ":"",c="https:"===location.protocol?"; secure":"";document.cookie=e[0]+"="+encodeURIComponent(e[1])+"; "+s+"path=/; samesite=lax"+c}):2==+spbcPublic.data__set_cookies&&1==+spbcPublic.data__set_cookies__alt_sessions_type&&spbcSendRESTRequest("alt_sessions",{method:"POST",data:{cookies:e}}))}function spbcSendRESTRequest(o,t){let s=t.callback||null;jQuery.ajax({type:t.method||"POST",url:spbcPublic._rest_url+"cleantalk-security/v1/"+o,data:t.data||[],beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",spbcPublic._rest_nonce),e.setRequestHeader("X-Robots-Tag","noindex, nofollow")},success:function(e){e.error?console.log("Security by Cleantalk. Error: "+(e.error||"Unknown")):s&&s(e,o,t,null)},error:function(e,o,t){t&&(console.log("SPBCT_REST_ERROR"),console.log(e),console.log(o),console.log("Security by Cleantalk plugin REST API error: "+t+" Please, contact Cleantalk tech support https://wordpress.org/support/plugin/security-malware-firewall/"))}})} //# sourceMappingURL=spbc-cookie.min.js.map diff --git a/js/spbc-cookie.min.js.map b/js/spbc-cookie.min.js.map index a38e945df..b908033db 100644 --- a/js/spbc-cookie.min.js.map +++ b/js/spbc-cookie.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-cookie.min.js","sources":["spbc-cookie.js"],"sourcesContent":["/**\n * Set Cookie\n * @param {string} cookies\n * @param {string} value\n * @param {number} expires\n */\nfunction spbcSetCookie( cookies, value, expires ) {/* eslint-disable-line no-unused-vars */\n if ( typeof cookies === 'string' && ( typeof value === 'string' || typeof value === 'number' ) ) {\n cookies = [[cookies, value, expires]];\n }\n\n // Cookies disabled\n if ( +spbcPublic.data__set_cookies === 0 ) {\n return;\n\n // Using traditional cookies\n } else if ( +spbcPublic.data__set_cookies === 1 ) {\n cookies.forEach( function(item, i, arr) {\n let expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : '';\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] +\n '=' + encodeURIComponent(item[1]) +\n '; ' + expires + 'path=/; samesite=lax' +\n ctSecure;\n });\n\n // Using alternative cookies\n } else if ( +spbcPublic.data__set_cookies === 2 ) {\n // Using REST API handler\n if ( +spbcPublic.data__set_cookies__alt_sessions_type === 1 ) {\n spbcSendRESTRequest(\n 'alt_sessions',\n {\n method: 'POST',\n data: {cookies: cookies},\n },\n );\n }\n // Using AJAX request and handler\n // }else if( +spbcPublic.data__set_cookies__alt_sessions_type === 2 ) {\n // apbct_public_sendAJAX(\n // {\n // action: 'apbct_alt_session__save__AJAX',\n // cookies: cookies,\n // },\n // {\n // apbct_ajax: 1,\n // notJson: 1,\n // }\n // );\n // }\n }\n}\n\n/**\n * Send REST Request\n * @param {string} route\n * @param {obj} params\n */\nfunction spbcSendRESTRequest( route, params ) {\n let callback = params.callback || null;\n let data = params.data || [];\n let method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: spbcPublic._rest_url + 'cleantalk-security/v1/' + route,\n data: data,\n beforeSend: function( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', spbcPublic._rest_nonce );\n xhr.setRequestHeader('X-Robots-Tag', 'noindex, nofollow');\n },\n success: function(result) {\n if (result.error) {\n console.log('Security by Cleantalk. Error: ' + (result.error || 'Unknown'));\n } else {\n if (callback) {\n let obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if ( errorThrown ) {\n console.log('SPBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Security by Cleantalk plugin REST API error: ' +\n errorThrown +\n ' Please, contact Cleantalk tech support ' +\n 'https://wordpress.org/support/plugin/security-malware-firewall/');\n }\n },\n });\n}\n"],"names":["spbcSetCookie","cookies","value","expires","spbcPublic","data__set_cookies","forEach","item","i","arr","let","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__set_cookies__alt_sessions_type","spbcSendRESTRequest","method","data","route","params","callback","jQuery","ajax","type","url","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","success","result","error","console","log","jqXHR","textStatus","errorThrown"],"mappings":"AAMA,SAASA,cAAeC,EAASC,EAAOC,G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3,"file":"spbc-cookie.min.js","sources":["spbc-cookie.js"],"sourcesContent":["/**\n * Set Cookie\n * @param {string} cookies\n * @param {string} value\n * @param {number} expires\n */\nfunction spbcSetCookie( cookies, value, expires ) {/* eslint-disable-line no-unused-vars */\n if ( typeof cookies === 'string' && ( typeof value === 'string' || typeof value === 'number' ) ) {\n cookies = [[cookies, value, expires]];\n }\n\n // Cookies disabled\n if ( +spbcPublic.data__set_cookies === 0 ) {\n return;\n\n // Using traditional cookies\n } else if ( +spbcPublic.data__set_cookies === 1 ) {\n cookies.forEach( function(item, i, arr) {\n let expires = typeof item[2] !== 'undefined' ? 'expires=' + item[2] + '; ' : '';\n let ctSecure = location.protocol === 'https:' ? '; secure' : '';\n document.cookie = item[0] +\n '=' + encodeURIComponent(item[1]) +\n '; ' + expires + 'path=/; samesite=lax' +\n ctSecure;\n });\n\n // Using alternative cookies\n } else if ( +spbcPublic.data__set_cookies === 2 ) {\n // Using REST API handler\n if ( +spbcPublic.data__set_cookies__alt_sessions_type === 1 ) {\n spbcSendRESTRequest(\n 'alt_sessions',\n {\n method: 'POST',\n data: {cookies: cookies},\n },\n );\n }\n // Using AJAX request and handler\n // }else if( +spbcPublic.data__set_cookies__alt_sessions_type === 2 ) {\n // apbct_public_sendAJAX(\n // {\n // action: 'apbct_alt_session__save__AJAX',\n // cookies: cookies,\n // },\n // {\n // apbct_ajax: 1,\n // notJson: 1,\n // }\n // );\n // }\n }\n}\n\n/**\n * Send REST Request\n * @param {string} route\n * @param {obj} params\n */\nfunction spbcSendRESTRequest( route, params ) {\n let callback = params.callback || null;\n let data = params.data || [];\n let method = params.method || 'POST';\n\n jQuery.ajax({\n type: method,\n url: spbcPublic._rest_url + 'cleantalk-security/v1/' + route,\n data: data,\n beforeSend: function( xhr ) {\n xhr.setRequestHeader( 'X-WP-Nonce', spbcPublic._rest_nonce );\n xhr.setRequestHeader('X-Robots-Tag', 'noindex, nofollow');\n },\n success: function(result) {\n if (result.error) {\n console.log('Security by Cleantalk. Error: ' + (result.error || 'Unknown'));\n } else {\n if (callback) {\n let obj = null;\n callback(result, route, params, obj);\n }\n }\n },\n error: function(jqXHR, textStatus, errorThrown) {\n if ( errorThrown ) {\n console.log('SPBCT_REST_ERROR');\n console.log(jqXHR);\n console.log(textStatus);\n console.log('Security by Cleantalk plugin REST API error: ' +\n errorThrown +\n ' Please, contact Cleantalk tech support ' +\n 'https://wordpress.org/support/plugin/security-malware-firewall/');\n }\n },\n });\n}\n"],"names":["spbcSetCookie","cookies","value","expires","spbcPublic","data__set_cookies","forEach","item","i","arr","let","ctSecure","location","protocol","document","cookie","encodeURIComponent","data__set_cookies__alt_sessions_type","spbcSendRESTRequest","method","data","route","params","callback","jQuery","ajax","type","url","_rest_url","beforeSend","xhr","setRequestHeader","_rest_nonce","success","result","error","console","log","jqXHR","textStatus","errorThrown"],"mappings":"AAMA,SAASA,cAAeC,EAASC,EAAOC,GACZ,UAAnB,OAAOF,GAA2C,UAAjB,OAAOC,GAAuC,UAAjB,OAAOA,IACtED,EAAU,CAAC,CAACA,EAASC,EAAOC,KAIO,GAAlC,CAACC,WAAWC,oBAI6B,GAAlC,CAACD,WAAWC,kBACpBJ,EAAQK,QAAS,SAASC,EAAMC,EAAGC,GAC/BC,IAAIP,EAA6B,KAAA,IAAZI,EAAK,GAAqB,WAAaA,EAAK,GAAK,KAAO,GACzEI,EAAiC,WAAtBC,SAASC,SAAwB,WAAa,GAC7DC,SAASC,OAASR,EAAK,GACnB,IAAMS,mBAAmBT,EAAK,EAAE,EAChC,KAAOJ,EAAU,uBACjBQ,CACR,CAAC,EAGyC,GAAlC,CAACP,WAAWC,mBAEsC,GAArD,CAACD,WAAWa,sCACbC,oBACI,eACA,CACIC,OAAQ,OACRC,KAAM,CAACnB,QAASA,CAAO,CAC3B,CACJ,EAgBZ,CAOA,SAASiB,oBAAqBG,EAAOC,GACjCZ,IAAIa,EAAWD,EAAOC,UAAY,KAIlCC,OAAOC,KAAK,CACRC,KAHSJ,EAAOH,QAAU,OAI1BQ,IAAKvB,WAAWwB,UAAY,yBAA2BP,EACvDD,KANOE,EAAOF,MAAQ,GAOtBS,WAAY,SAAUC,GAClBA,EAAIC,iBAAkB,aAAc3B,WAAW4B,WAAY,EAC3DF,EAAIC,iBAAiB,eAAgB,mBAAmB,CAC5D,EACAE,QAAS,SAASC,GACVA,EAAOC,MACPC,QAAQC,IAAI,kCAAoCH,EAAOC,OAAS,UAAU,EAEtEZ,GAEAA,EAASW,EAAQb,EAAOC,EADd,IACyB,CAG/C,EACAa,MAAO,SAASG,EAAOC,EAAYC,GAC1BA,IACDJ,QAAQC,IAAI,kBAAkB,EAC9BD,QAAQC,IAAIC,CAAK,EACjBF,QAAQC,IAAIE,CAAU,EACtBH,QAAQC,IAAI,gDACRG,EAEA,yGAAiE,EAE7E,CACJ,CAAC,CACL"} \ No newline at end of file diff --git a/js/spbc-scanner-plugin.min.js b/js/spbc-scanner-plugin.min.js index abc8af228..4c672c6a1 100644 --- a/js/spbc-scanner-plugin.min.js +++ b/js/spbc-scanner-plugin.min.js @@ -1,2 +1,2 @@ -"use strict";class SpbcMalwareScanner{first_start=!0;active=!1;root="";settings=[];states=["get_cms_hashes","get_modules_hashes","clean_results","file_system_analysis","get_approved_hashes","get_denied_hashes","signature_analysis","heuristic_analysis","schedule_send_heuristic_suspicious_files","auto_cure_backup","auto_cure","outbound_links","frontend_analysis","important_files_listing","send_results"];state=null;offset=0;amount=0;amount_coefficient=1;total_scanned=0;scan_percent=0;percent_completed=0;paused=!1;button=null;spinner=null;progress_overall=null;progressbar=null;progressbar_text=null;timeout=6e4;state_timer=0;constructor(t){for(var e in console.log("init"),jQuery("#spbcscan-results-log-module").length&&jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),void 0!==t.settings.auto_cure&&(t.settings.scanner__auto_cure_backup="1"),t)void 0!==this[e]&&(this[e]=t[e])}actionControl(){null===this.state?this.start():this.paused?(this.resume(),this.controller()):this.pause()}start(){this.active=!0,this.state_timer=Math.round((new Date).getTime()/1e3),this.state=this.getNextState(null),this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold"),this.progressbar.show(500),this.progress_overall.show(500),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),setTimeout(()=>{this.controller()},1e3)}pause(t,e,s){console.log("PAUSE"),this.button.html(spbcScaner.button_scan_resume),this.spinner.css({display:"none"}),this.paused=!0,this.active=!1}resume(t){console.log("RESUME"),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),this.paused=!1,this.active=!0}end(t){this.progressbar.hide(500),this.progress_overall.hide(500),this.button.html(spbcScaner.button_scan_perform),this.spinner.css({display:"none"}),this.state=null,this.plug=!1,this.total_scanned=0,this.active=!1,t?document.location=document.location:(spbcSendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(t,e,s,i){jQuery(i).accordion("destroy").html(t).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcTblPaginationListen(),spbcTblSortListen(),spbcStartShowHide(),spbcScannerReloadScanInfo()}},jQuery("#spbc_scan_accordion")),jQuery("#spbc_scanner_clear").length||jQuery('
').insertBefore("#spbcscan-scanner-caption"))}controller(t){if(console.log(this.state),void 0!==t&&t.end){if(this.state=this.getNextState(this.state),void 0===this.state)return void this.end();this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold")}if(!0!==this.paused){var e={action:"spbc_scanner_controller_front",method:this.state,offset:this.offset},t={type:"GET",success:this.success,callback:this.successCallback,error:this.error,errorOutput:this.errorOutput,complete:null,context:this,timeout:12e4};switch(this.state){case"get_modules_hashes":this.amount=2;break;case"clear_table":this.amount=1e4;break;case"file_system_analysis":this.amount=700;break;case"auto_cure":this.amount=5;break;case"outbound_links":this.amount=10;break;case"frontend_analysis":this.amount=spbcSettings.frontendAnalysisAmount;break;case"signature_analysis":this.amount=10,e.status="UNKNOWN,MODIFIED,OK,INFECTED,ERROR";break;case"heuristic_analysis":this.amount=4,e.status="UNKNOWN,MODIFIED,OK,INFECTED,ERROR";break;case"schedule_send_heuristic_suspicious_files":this.amount=1}e.amount=Math.round(this.amount*this.amount_coefficient),spbcSendAJAXRequest(e,t,jQuery("#spbc_scan_accordion"))}}setCoefficients(t){let e=this.amount_coefficient;"file_system_analysis"===t&&(e*=1.5),this.amount_coefficient=e}getNextState(t){return t=null===t?this.states[0]:this.states[this.states.indexOf(t)+1],t=void 0!==this.settings["scanner__"+t]&&0==+this.settings["scanner__"+t]?this.getNextState(t):t}setPercents(t){this.percent_completed=Math.floor(100*t)/100,this.progressbar.progressbar("option","value",this.percent_completed),this.progressbar_text.text(spbcScaner["progressbar_"+this.state]+" - "+this.percent_completed+"%")}success(t){t.error?this.error({status:200,responseText:t.error},t.error,t.msg):this.successCallback&&this.successCallback(t,this.data,this.obj)}successCallback(e){if(console.log(e),this.interactAccordion(e),void 0!==e.total&&(this.scan_percent=100/e.total),void 0!==e.processed_items&&("heuristic_analysis"===this.state&&0!==typeof e.total&&this.logRaw('

Heuristic Analysis

'),"signature_analysis"===this.state&&0!==typeof e.total&&this.logRaw('

Signature Analysis

'),this.logFileEntry(e.processed_items)),void 0!==e.stage_data_for_logging&&this.logStageEntry(e.stage_data_for_logging),void 0!==e.cured&&0{this.controller(e)},300)}interactAccordion(t){t.hasOwnProperty("interactivity_data")&&t.interactivity_data.hasOwnProperty("update_text")&&t.interactivity_data.update_text&&t.interactivity_data.hasOwnProperty("refresh_data")&&t.interactivity_data.refresh_data.hasOwnProperty("do_refresh")&&t.interactivity_data.refresh_data.do_refresh&&t.interactivity_data.refresh_data.hasOwnProperty("control_tab")&&t.interactivity_data.refresh_data.control_tab&&spbcReloadAccordion(t.interactivity_data.refresh_data.control_tab,t.interactivity_data.update_text)}error(t,e,s){var i=this.errorOutput;if(console.log("%c APBCT_AJAX_ERROR","color: red;"),console.log(e),console.log(s),console.log(t),"error"==e&&(""==s||"Not found"==s)&&(this.tryCount||(this.tryCount=0,this.retryLimit=30),this.tryCount++,console.log("Try #"+this.tryCount),this.setCoefficients(this.state),this.tryCount<=this.retryLimit))this.pause(),this.resume(),this.controller();else{if(200===t.status)if("parsererror"===e)i("Unexpected response from server. See console for details.",this.state),console.log("%c "+t.responseText,"color: pink;");else{let t=e;void 0!==s&&(t+=" Additional info: "+s),i(t,this.state)}else 500===t.status?i("Internal server error.",this.state):i("Unexpected response code: "+t.status+". Error: "+e,this.state);this.progressbar&&this.progressbar.fadeOut("slow"),this.end()}}errorOutput(t,e){spbcModal.open().putError(t+"
Stage: "+e)}logRaw(t){jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper .panel-body").prepend(t)}logFileEntry(t){for(var e in t)e&&this.logRaw('

'+this.getSiteUTCShiftedTimeString()+" - "+t[e].path+" - "+t[e].module+": "+t[e].status+"

")}logStageEntry(t){void 0!==jQuery(".panel-body .spbc_log-line span").first()&&void 0!==jQuery(".panel-body .spbc_log-line span").first()[0]&&jQuery(".panel-body .spbc_log-line span").first()[0].textContent===t.description||this.logRaw('

test '+this.getSiteUTCShiftedTimeString()+" - "+t.title+" "+t.description+"

")}showLinkForShuffleSalts(t){jQuery("#spbc_notice_about_shuffle_link").remove(),jQuery(jQuery(".spbc_tab--active .spbc_wrapper_field p")[1]).after('")}getSiteUTCShiftedTimeString(){let t=!1;var e=-1*(new Date).getTimezoneOffset()*1e3*60,e=(t="undefined"!=typeof spbcScaner&&void 0!==spbcScaner.timezone_shift&&!1!==spbcScaner.timezone_shift?Date.now()-e+1e3*spbcScaner.timezone_shift:t)?new Date(t):new Date,s=new Intl.DateTimeFormat("en-US",{month:"short"}).format,i=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return s(e)+" "+e.getDate()+" "+e.getFullYear()+" "+e.getHours()+":"+i+":"+a}} +class SpbcMalwareScanner{first_start=!0;active=!1;root="";settings=[];states=["get_cms_hashes","get_modules_hashes","clean_results","file_system_analysis","get_approved_hashes","get_denied_hashes","signature_analysis","heuristic_analysis","schedule_send_heuristic_suspicious_files","auto_cure_backup","auto_cure","os_cron_analysis","outbound_links","frontend_analysis","important_files_listing","send_results"];state=null;offset=0;amount=0;amount_coefficient=1;total_scanned=0;scan_percent=0;percent_completed=0;paused=!1;button=null;spinner=null;progress_overall=null;progressbar=null;progressbar_text=null;timeout=6e4;state_timer=0;constructor(t){for(var e in console.log("init"),jQuery("#spbcscan-results-log-module").length&&jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),void 0!==t.settings.auto_cure&&(t.settings.scanner__auto_cure_backup="1"),t)void 0!==this[e]&&(this[e]=t[e])}actionControl(){null===this.state?this.start():this.paused?(this.resume(),this.controller()):this.pause()}start(){this.active=!0,this.state_timer=Math.round((new Date).getTime()/1e3),this.state=this.getNextState(null),this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold"),this.progressbar.show(500),this.progress_overall.show(500),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),setTimeout(()=>{this.controller()},1e3)}pause(t,e,s){console.log("PAUSE"),this.button.html(spbcScaner.button_scan_resume),this.spinner.css({display:"none"}),this.paused=!0,this.active=!1}resume(t){console.log("RESUME"),this.button.html(spbcScaner.button_scan_pause),this.spinner.css({display:"inline"}),this.paused=!1,this.active=!0}end(t){this.progressbar.hide(500),this.progress_overall.hide(500),this.button.html(spbcScaner.button_scan_perform),this.spinner.css({display:"none"}),this.state=null,this.plug=!1,this.total_scanned=0,this.active=!1,t?document.location=document.location:(spbcSendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(t,e,s,a){jQuery(a).accordion("destroy").html(t).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcTblPaginationListen(),spbcTblSortListen(),spbcStartShowHide(),spbcScannerReloadScanInfo()}},jQuery("#spbc_scan_accordion")),jQuery("#spbc_scanner_clear").length||jQuery('
').insertBefore("#spbcscan-scanner-caption"))}controller(t){if(console.log(this.state),void 0!==t&&t.end){if(this.state=this.getNextState(this.state),void 0===this.state)return void this.end();this.setPercents(0),this.scan_percent=0,this.offset=0,this.progress_overall.children("span").removeClass("spbc_bold").filter(".spbc_overall_scan_status_"+this.state).addClass("spbc_bold")}if(!0!==this.paused){var e={action:"spbc_scanner_controller_front",method:this.state,offset:this.offset},t={type:"GET",success:this.success,callback:this.successCallback,error:this.error,errorOutput:this.errorOutput,complete:null,context:this,timeout:12e4};switch(this.state){case"get_modules_hashes":this.amount=2;break;case"clear_table":this.amount=1e4;break;case"file_system_analysis":this.amount=700;break;case"auto_cure":this.amount=5;break;case"outbound_links":this.amount=10;break;case"frontend_analysis":this.amount=spbcSettings.frontendAnalysisAmount;break;case"signature_analysis":this.amount=10,e.status="UNKNOWN,MODIFIED,OK,INFECTED,ERROR";break;case"heuristic_analysis":this.amount=4,e.status="UNKNOWN,MODIFIED,OK,INFECTED,ERROR";break;case"schedule_send_heuristic_suspicious_files":this.amount=1}e.amount=Math.round(this.amount*this.amount_coefficient),spbcSendAJAXRequest(e,t,jQuery("#spbc_scan_accordion"))}}setCoefficients(t){let e=this.amount_coefficient;"file_system_analysis"===t&&(e*=1.5),this.amount_coefficient=e}getNextState(t){return t=null===t?this.states[0]:this.states[this.states.indexOf(t)+1],t=void 0!==this.settings["scanner__"+t]&&0==+this.settings["scanner__"+t]?this.getNextState(t):t}setPercents(t){this.percent_completed=Math.floor(100*t)/100,this.progressbar.progressbar("option","value",this.percent_completed),this.progressbar_text.text(spbcScaner["progressbar_"+this.state]+" - "+this.percent_completed+"%")}success(t){t.error?this.error({status:200,responseText:t.error},t.error,t.msg):this.successCallback&&this.successCallback(t,this.data,this.obj)}successCallback(e){if(console.log(e),this.interactAccordion(e),void 0!==e.total&&(this.scan_percent=100/e.total),void 0!==e.processed_items&&("heuristic_analysis"===this.state&&0!==typeof e.total&&this.logRaw('

Heuristic Analysis

'),"signature_analysis"===this.state&&0!==typeof e.total&&this.logRaw('

Signature Analysis

'),this.logFileEntry(e.processed_items)),void 0!==e.stage_data_for_logging&&this.logStageEntry(e.stage_data_for_logging),void 0!==e.cured&&0{this.controller(e)},300)}interactAccordion(t){t.hasOwnProperty("interactivity_data")&&t.interactivity_data.hasOwnProperty("update_text")&&t.interactivity_data.update_text&&t.interactivity_data.hasOwnProperty("refresh_data")&&t.interactivity_data.refresh_data.hasOwnProperty("do_refresh")&&t.interactivity_data.refresh_data.do_refresh&&t.interactivity_data.refresh_data.hasOwnProperty("control_tab")&&t.interactivity_data.refresh_data.control_tab&&spbcReloadAccordion(t.interactivity_data.refresh_data.control_tab,t.interactivity_data.update_text)}error(t,e,s){var a=this.errorOutput;if(console.log("%c APBCT_AJAX_ERROR","color: red;"),console.log(e),console.log(s),console.log(t),"error"==e&&(""==s||"Not found"==s)&&(this.tryCount||(this.tryCount=0,this.retryLimit=30),this.tryCount++,console.log("Try #"+this.tryCount),this.setCoefficients(this.state),this.tryCount<=this.retryLimit))this.pause(),this.resume(),this.controller();else{if(200===t.status)if("parsererror"===e)a("Unexpected response from server. See console for details.",this.state),console.log("%c "+t.responseText,"color: pink;");else{let t=e;void 0!==s&&(t+=" Additional info: "+s),a(t,this.state)}else 500===t.status?a("Internal server error.",this.state):a("Unexpected response code: "+t.status+". Error: "+e,this.state);this.progressbar&&this.progressbar.fadeOut("slow"),this.end()}}errorOutput(t,e){spbcModal.open().putError(t+"
Stage: "+e)}logRaw(t){jQuery(".spbc-scan-log-title").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper").removeClass("spbc---hidden"),jQuery(".spbc_log-wrapper .panel-body").prepend(t)}logFileEntry(t){for(var e in t)e&&this.logRaw('

'+this.getSiteUTCShiftedTimeString()+" - "+t[e].path+" - "+t[e].module+": "+t[e].status+"

")}logStageEntry(t){void 0!==jQuery(".panel-body .spbc_log-line span").first()&&void 0!==jQuery(".panel-body .spbc_log-line span").first()[0]&&jQuery(".panel-body .spbc_log-line span").first()[0].textContent===t.description||this.logRaw('

test '+this.getSiteUTCShiftedTimeString()+" - "+t.title+" "+t.description+"

")}showLinkForShuffleSalts(t){jQuery("#spbc_notice_about_shuffle_link").remove(),jQuery(jQuery(".spbc_tab--active .spbc_wrapper_field p")[1]).after('")}getSiteUTCShiftedTimeString(){let t=!1;var e=-1*(new Date).getTimezoneOffset()*1e3*60,e=(t="undefined"!=typeof spbcScaner&&void 0!==spbcScaner.timezone_shift&&!1!==spbcScaner.timezone_shift?Date.now()-e+1e3*spbcScaner.timezone_shift:t)?new Date(t):new Date,s=new Intl.DateTimeFormat("en-US",{month:"short"}).format,a=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0");return s(e)+" "+e.getDate()+" "+e.getFullYear()+" "+e.getHours()+":"+a+":"+i}} //# sourceMappingURL=spbc-scanner-plugin.min.js.map diff --git a/js/spbc-scanner-plugin.min.js.map b/js/spbc-scanner-plugin.min.js.map index 41611b1ba..6ea56f56e 100644 --- a/js/spbc-scanner-plugin.min.js.map +++ b/js/spbc-scanner-plugin.min.js.map @@ -1 +1 @@ -{"version":3,"file":"spbc-scanner-plugin.min.js","sources":["spbc-scanner-plugin.js"],"sourcesContent":["'use strict';\n\n/**\n * class SpbcMalwareScanner\n */\nclass SpbcMalwareScanner {/* eslint-disable-line no-unused-vars */\n first_start = true;\n\n active = false;\n\n root = '';\n settings = [];\n states = [\n 'get_cms_hashes',\n 'get_modules_hashes',\n 'clean_results',\n 'file_system_analysis',\n 'get_approved_hashes',\n 'get_denied_hashes',\n 'signature_analysis',\n 'heuristic_analysis',\n 'schedule_send_heuristic_suspicious_files',\n 'auto_cure_backup',\n 'auto_cure',\n 'outbound_links',\n 'frontend_analysis',\n 'important_files_listing',\n 'send_results',\n ];\n state = null;\n offset = 0;\n amount = 0;\n amount_coefficient = 1;\n total_scanned = 0;\n scan_percent = 0;\n percent_completed = 0;\n\n paused = false;\n\n button = null;\n spinner = null;\n\n progress_overall = null;\n progressbar = null;\n progressbar_text = null;\n\n timeout = 60000;\n\n state_timer = 0;\n\n /**\n * constructor\n * @param {array} properties\n */\n constructor( properties ) {\n console.log('init');\n if (jQuery('#spbcscan-results-log-module').length) {\n jQuery('.spbc-scan-log-title').removeClass('spbc---hidden');\n }\n\n // Crunch for cure backups\n if ( typeof properties['settings']['auto_cure'] !== 'undefined' ) {\n properties['settings']['scanner__auto_cure_backup'] = '1';\n }\n\n for ( let key in properties ) {\n if ( typeof this[key] !== 'undefined' ) {\n this[key] = properties[key];\n }\n }\n };\n\n /**\n * Function Action Control\n */\n actionControl() {\n if (this.state === null) {\n this.start();\n } else if (this.paused) {\n this.resume();\n this.controller();\n } else {\n this.pause();\n }\n };\n\n /**\n * Function Start\n */\n start() {\n this.active = true;\n this.state_timer = Math.round(new Date().getTime() /1000);\n\n this.state = this.getNextState( null );\n\n this.setPercents( 0 );\n this.scan_percent = 0;\n this.offset = 0;\n this.progress_overall.children('span')\n .removeClass('spbc_bold')\n .filter('.spbc_overall_scan_status_' + this.state)\n .addClass('spbc_bold');\n\n this.progressbar.show(500);\n this.progress_overall.show(500);\n this.button.html(spbcScaner.button_scan_pause);\n this.spinner.css({display: 'inline'});\n\n setTimeout(() => {\n this.controller();\n }, 1000);\n };\n\n /**\n * Function Pause\n * @param {*} result\n * @param {*} data\n * @param {*} opt\n */\n pause( result, data, opt ) {\n console.log('PAUSE');\n this.button.html(spbcScaner.button_scan_resume);\n this.spinner.css({display: 'none'});\n this.paused = true;\n this.active = false;\n };\n\n /**\n * Function Resume\n * @param {*} opt\n */\n resume( opt ) {\n console.log('RESUME');\n this.button.html(spbcScaner.button_scan_pause);\n this.spinner.css({display: 'inline'});\n this.paused = false;\n this.active = true;\n };\n\n /**\n * Function End\n * @param {bool} reload\n */\n end( reload ) {\n this.progressbar.hide(500);\n this.progress_overall.hide(500);\n this.button.html(spbcScaner.button_scan_perform);\n this.spinner.css({display: 'none'});\n this.state = null;\n this.plug = false;\n this.total_scanned = 0;\n this.active = false;\n\n if (reload) {\n document.location = document.location;\n } else {\n spbcSendAJAXRequest(\n {action: 'spbc_scanner_tab__reload_accordion'},\n {\n notJson: true,\n callback: function(result, data, params, obj) {\n jQuery(obj).accordion('destroy')\n .html(result)\n .accordion({\n header: 'h3',\n heightStyle: 'content',\n collapsible: true,\n active: false,\n });\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcStartShowHide();\n spbcScannerReloadScanInfo();\n },\n },\n jQuery('#spbc_scan_accordion'),\n );\n\n if (!jQuery('#spbc_scanner_clear').length) {\n let clearLink = '

Clear scanner logs


';\n jQuery(clearLink).insertBefore('#spbcscan-scanner-caption');\n }\n }\n };\n\n /**\n * Function Controller\n * @param {obj} result\n */\n controller( result ) {\n console.log(this.state);\n\n // The current stage is over. Switching to the new one\n if ( typeof result !== 'undefined' && result.end ) {\n this.state = this.getNextState( this.state );\n\n // End condition\n if (typeof this.state === 'undefined') {\n this.end();\n return;\n }\n\n // Set percent to 0\n this.setPercents( 0 );\n this.scan_percent = 0;\n this.offset = 0;\n\n // Changing visualizing of the current stage\n this.progress_overall.children('span')\n .removeClass('spbc_bold')\n .filter('.spbc_overall_scan_status_' + this.state)\n .addClass('spbc_bold');\n }\n\n // Break execution if paused\n if ( this.paused === true ) {\n return;\n }\n\n // // AJAX params\n let data = {\n action: 'spbc_scanner_controller_front',\n method: this.state,\n offset: this.offset,\n };\n\n let params = {\n type: 'GET',\n success: this.success,\n callback: this.successCallback,\n error: this.error,\n errorOutput: this.errorOutput,\n complete: null,\n context: this,\n timeout: 120000,\n };\n\n switch (this.state) {\n case 'get_modules_hashes': this.amount = 2; break;\n case 'clear_table': this.amount = 10000; break;\n case 'file_system_analysis': this.amount = 700; break;\n case 'auto_cure': this.amount = 5; break;\n case 'outbound_links': this.amount = 10; break;\n case 'frontend_analysis': this.amount = spbcSettings.frontendAnalysisAmount; break;\n case 'signature_analysis': this.amount = 10; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED,ERROR'; break;\n case 'heuristic_analysis': this.amount = 4; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED,ERROR'; break;\n case 'schedule_send_heuristic_suspicious_files': this.amount = 1; break;\n }\n\n data.amount = Math.round(this.amount * this.amount_coefficient);\n\n spbcSendAJAXRequest(\n data,\n params,\n jQuery('#spbc_scan_accordion'),\n );\n };\n\n /**\n * Set Coefficients\n * @param {string} state\n */\n setCoefficients( state ) {\n let coefficient = this.amount_coefficient;\n switch (state) {\n case 'file_system_analysis': coefficient *= 1.5; break;\n }\n this.amount_coefficient = coefficient;\n };\n\n /**\n * Get Next State\n * @param {string} state\n * @return {number}\n */\n getNextState( state ) {\n state = state === null ? this.states[0] : this.states[this.states.indexOf( state ) + 1];\n\n if (typeof this.settings['scanner__' + state] !== 'undefined' && +this.settings['scanner__' + state] === 0) {\n state = this.getNextState( state );\n }\n\n return state;\n };\n\n /**\n * Set Percents\n * @param {number} percents\n */\n setPercents( percents ) {\n this.percent_completed = Math.floor( percents * 100 ) / 100;\n this.progressbar.progressbar( 'option', 'value', this.percent_completed );\n this.progressbar_text.text( spbcScaner['progressbar_' + this.state] + ' - ' + this.percent_completed + '%' );\n };\n\n /**\n * Function Success\n * @param {obj} response\n */\n success( response ) {\n if ( !! response.error ) {\n this.error(\n {status: 200, responseText: response.error},\n response.error,\n response.msg,\n );\n } else {\n if ( this.successCallback ) {\n this.successCallback( response, this.data, this.obj );\n }\n }\n };\n\n // Processing response from backend\n /**\n * Success Callback\n * @param {obj} result\n */\n successCallback( result ) {\n console.log( result );\n\n this.interactAccordion(result);\n\n if ( typeof result.total !== 'undefined' ) {\n this.scan_percent = 100 / result.total;\n }\n\n if ( typeof result.processed_items !== 'undefined') {\n if ( this.state === 'heuristic_analysis' && typeof result.total !== 0 ) {\n this.logRaw('

Heuristic Analysis

');\n }\n if ( this.state === 'signature_analysis' && typeof result.total !== 0 ) {\n this.logRaw('

Signature Analysis

');\n }\n\n this.logFileEntry( result.processed_items );\n }\n\n if ( typeof result.stage_data_for_logging !== 'undefined') {\n this.logStageEntry( result.stage_data_for_logging );\n }\n\n // Add link on shuffle salt if cured\n if (result.cured !== undefined && Number(result.cured) > 0) {\n this.showLinkForShuffleSalts(result.message);\n }\n\n if ( result.end !== true && result.end !== 1 ) {\n let processedPercents = this.percent_completed + result.processed * this.scan_percent;\n if (result.stage_data_for_logging.title === 'File System Analysis' && processedPercents > 100) {\n processedPercents = 100;\n }\n this.setPercents(processedPercents);\n this.offset = this.offset + result.processed;\n this.controller( result );\n } else {\n console.log( this.state +\n ' stage took ' +\n ( Math.round(new Date().getTime() /1000) - this.state_timer ) +\n ' seconds to complete' );\n this.state_timer = Math.round(new Date().getTime()/1000);\n this.setPercents( 100 );\n this.scan_percent = 0;\n this.offset = 0;\n setTimeout(() => {\n this.controller( result );\n }, 300);\n }\n };\n\n /**\n * Run interactive refresh for accordion.\n * @param {obj|string[]} result\n */\n interactAccordion(result) {\n // validation control\n if (result.hasOwnProperty('interactivity_data') &&\n result.interactivity_data.hasOwnProperty('update_text') &&\n result.interactivity_data.update_text &&\n result.interactivity_data.hasOwnProperty('refresh_data') &&\n result.interactivity_data.refresh_data.hasOwnProperty('do_refresh') &&\n result.interactivity_data.refresh_data.do_refresh &&\n result.interactivity_data.refresh_data.hasOwnProperty('control_tab') &&\n result.interactivity_data.refresh_data.control_tab\n ) {\n spbcReloadAccordion(\n result.interactivity_data.refresh_data.control_tab,\n result.interactivity_data.update_text,\n );\n }\n }\n\n /**\n * Function Error\n * @param {object} xhr\n * @param {string} status\n * @param {string} error\n */\n error( xhr, status, error ) {\n let errorOutput = this.errorOutput;\n\n console.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n console.log( status );\n console.log( error );\n console.log( xhr );\n\n if (status == 'error' && (error == '' || error == 'Not found')) {\n if (!this.tryCount) {\n this.tryCount = 0;\n this.retryLimit = 30;\n }\n this.tryCount++;\n console.log('Try #' + this.tryCount);\n this.setCoefficients(this.state);\n if (this.tryCount <= this.retryLimit) {\n this.pause();\n this.resume();\n this.controller();\n return;\n }\n }\n\n if ( xhr.status === 200 ) {\n if ( status === 'parsererror' ) {\n errorOutput( 'Unexpected response from server. See console for details.', this.state );\n console.log( '%c ' + xhr.responseText, 'color: pink;' );\n } else {\n let errorString = status;\n if ( typeof error !== 'undefined' ) {\n errorString += ' Additional info: ' + error;\n }\n errorOutput( errorString, this.state );\n }\n } else if (xhr.status === 500) {\n errorOutput( 'Internal server error.', this.state);\n } else {\n errorOutput('Unexpected response code: ' + xhr.status + '. Error: ' + status, this.state);\n }\n\n if ( this.progressbar ) {\n this.progressbar.fadeOut('slow');\n }\n\n this.end();\n };\n\n /**\n * Error Output\n * @param {string} errorMsg\n * @param {string} stage\n */\n errorOutput( errorMsg, stage ) {\n spbcModal.open().putError( errorMsg + '
Stage: ' + stage);\n };\n\n /**\n * Log Raw\n * @param {htmlString|Element|Text|Array|jQuery} messageToLog\n */\n logRaw(messageToLog) {\n jQuery('.spbc-scan-log-title').removeClass('spbc---hidden');\n jQuery('.spbc_log-wrapper').removeClass('spbc---hidden');\n jQuery('.spbc_log-wrapper .panel-body').prepend( messageToLog );\n };\n\n /**\n * Log File Entry\n * @param {array} items\n */\n logFileEntry(items) {\n for ( let key in items ) {\n if ( key ) {\n this.logRaw(\n '

' +\n this.getSiteUTCShiftedTimeString() + ' - ' +\n items[key].path + ' - ' + items[key].module +\n ': ' + items[key].status + '' +\n '

');\n }\n }\n };\n\n /**\n * Log Stage Entry\n * @param {obj} data\n */\n logStageEntry(data) {\n if (typeof jQuery('.panel-body .spbc_log-line span').first() !== 'undefined' &&\n typeof jQuery('.panel-body .spbc_log-line span').first()[0] !== 'undefined' &&\n jQuery('.panel-body .spbc_log-line span').first()[0].textContent === data.description\n ) {\n return;\n }\n this.logRaw( '

test ' +\n this.getSiteUTCShiftedTimeString() + ' - ' + '' +\n data.title + ' ' + '' + data.description + '

' );\n };\n\n /**\n * Show Link For Shuffle Salts\n * @param {string} message\n */\n showLinkForShuffleSalts(message) {\n jQuery('#spbc_notice_about_shuffle_link').remove();\n jQuery(jQuery('.spbc_tab--active .spbc_wrapper_field p')[1])\n .after(\n '
' +\n '' +\n message +\n '' +\n '
',\n );\n }\n\n /**\n * Get Site UTC Shifted Time String\n * @return {string}\n */\n getSiteUTCShiftedTimeString() {\n let utcShiftedTs = false;\n // gettings current system/browser offset\n let currentBrowserOffset = new Date().getTimezoneOffset();\n currentBrowserOffset = currentBrowserOffset * -1 * 1000 * 60;\n // chek if global ct object is defined\n if (typeof spbcScaner !== 'undefined' &&\n typeof spbcScaner.timezone_shift !== 'undefined' &&\n spbcScaner.timezone_shift !== false) {\n utcShiftedTs = Date.now() - currentBrowserOffset + (spbcScaner.timezone_shift * 1000);\n }\n let ctDate = utcShiftedTs ? new Date(utcShiftedTs) : new Date();\n // construct date string\n let shortMonthName = new Intl.DateTimeFormat('en-US', {month: 'short'}).format;\n let minutes = String(ctDate.getMinutes()).padStart(2, '0');\n let seconds = String(ctDate.getSeconds()).padStart(2, '0');\n return shortMonthName(ctDate) + ' ' +\n ctDate.getDate() + ' ' + ctDate.getFullYear() + ' ' +\n ctDate.getHours() + ':' + minutes + ':' + seconds;\n }\n}\n"],"names":["SpbcMalwareScanner","first_start","active","root","settings","states","state","offset","amount","amount_coefficient","total_scanned","scan_percent","percent_completed","paused","button","spinner","progress_overall","progressbar","progressbar_text","timeout","state_timer","constructor","properties","let","key","console","log","jQuery","length","removeClass","this","actionControl","start","resume","controller","pause","Math","round","Date","getTime","getNextState","setPercents","children","filter","addClass","show","html","spbcScaner","button_scan_pause","css","display","setTimeout","result","data","opt","button_scan_resume","end","reload","hide","button_scan_perform","plug","document","location","spbcSendAJAXRequest","action","notJson","callback","params","obj","accordion","header","heightStyle","collapsible","spbcTblBulkActionsListen","spbcTblRowActionsListen","spbcTblPaginationListen","spbcTblSortListen","spbcStartShowHide","spbcScannerReloadScanInfo","insertBefore","method","type","success","successCallback","error","errorOutput","complete","context","spbcSettings","frontendAnalysisAmount","status","setCoefficients","coefficient","indexOf","percents","floor","text","response","responseText","msg","interactAccordion","total","processed_items","logRaw","logFileEntry","stage_data_for_logging","logStageEntry","undefined","cured","Number","showLinkForShuffleSalts","message","processedPercents","processed","title","hasOwnProperty","interactivity_data","update_text","refresh_data","do_refresh","control_tab","spbcReloadAccordion","xhr","tryCount","retryLimit","errorString","fadeOut","errorMsg","stage","spbcModal","open","putError","messageToLog","prepend","items","getSiteUTCShiftedTimeString","path","module","first","textContent","description","remove","after","utcShiftedTs","currentBrowserOffset","getTimezoneOffset","ctDate","timezone_shift","now","shortMonthName","Intl","DateTimeFormat","month","format","minutes","String","getMinutes","padStart","seconds","getSeconds","getDate","getFullYear","getHours"],"mappings":"AAAA,mBAKMA,mBACFC,YAAc,CAAA,EAEdC,OAAS,CAAA,EAETC,KAAO,GACPC,SAAW,GACXC,OAAS,CACL,iBACA,qBACA,gBACA,uBACA,sBACA,oBACA,qBACA,qBACA,2CACA,mBACA,YACA,iBACA,oBACA,0BACA,gBAEJC,MAAQ,KACRC,OAAS,EACTC,OAAS,EACTC,mBAAqB,EACrBC,cAAgB,EAChBC,aAAe,EACfC,kBAAoB,EAEpBC,OAAS,CAAA,EAETC,OAAS,KACTC,QAAU,KAEVC,iBAAmB,KACnBC,YAAc,KACdC,iBAAmB,KAEnBC,QAAU,IAEVC,YAAc,EAMdC,YAAaC,GAWT,IAAMC,IAAIC,KAVVC,QAAQC,IAAI,MAAM,EACdC,OAAO,8BAA8B,EAAEC,QACvCD,OAAO,sBAAsB,EAAEE,YAAY,eAAe,EAIV,KAAA,IAAxCP,EAAqB,SAAa,YAC1CA,EAAqB,SAA6B,0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EAAE,GAAGC,cAAgBtF,EAAKuF,aAI/E9G,KAAKyE,OAAQ,iCACTzE,KAAKyG,4BAA4B,EAAY,SAC7ClF,EAAK6D,MAAkB,cAAW7D,EAAKuF,YAAc,aAAc,CAC3E,CAMA9B,wBAAwBC,GACpBpF,OAAO,iCAAiC,EAAEkH,OAAO,EACjDlH,OAAOA,OAAO,yCAAyC,EAAE,EAAE,EACtDmH,MACG,uKAEA/B,EAEA,YACJ,CACR,CAMAwB,8BACIhH,IAAIwH,EAAe,CAAA,EAEnBxH,IACAyH,EAA8C,CAAC,GADpB,IAAI1G,MAAO2G,kBAAkB,EACL,IAAO,GAOtDC,GAFAH,EAHsB,aAAtB,OAAOhG,YAC8B,KAAA,IAA9BA,WAAWoG,gBACY,CAAA,IAA9BpG,WAAWoG,eACI7G,KAAK8G,IAAI,EAAIJ,EAAoD,IAA5BjG,WAAWoG,eAEtDJ,GAAe,IAAIzG,KAAKyG,CAAY,EAAI,IAAIzG,KAErD+G,EAAiB,IAAIC,KAAKC,eAAe,QAAS,CAACC,MAAO,OAAO,CAAC,EAAEC,OACpEC,EAAUC,OAAOT,EAAOU,WAAW,CAAC,EAAEC,SAAS,EAAG,GAAG,EACrDC,EAAUH,OAAOT,EAAOa,WAAW,CAAC,EAAEF,SAAS,EAAG,GAAG,EACzD,OAAOR,EAAeH,CAAM,EAAI,IAC5BA,EAAOc,QAAQ,EAAI,IAAMd,EAAOe,YAAY,EAAI,IAChDf,EAAOgB,SAAS,EAAI,IAAMR,EAAU,IAAMI,CAClD,CACJ"} \ No newline at end of file +{"version":3,"file":"spbc-scanner-plugin.min.js","sources":["spbc-scanner-plugin.js"],"sourcesContent":["'use strict';\n\n/**\n * class SpbcMalwareScanner\n */\nclass SpbcMalwareScanner {/* eslint-disable-line no-unused-vars */\n first_start = true;\n\n active = false;\n\n root = '';\n settings = [];\n states = [\n 'get_cms_hashes',\n 'get_modules_hashes',\n 'clean_results',\n 'file_system_analysis',\n 'get_approved_hashes',\n 'get_denied_hashes',\n 'signature_analysis',\n 'heuristic_analysis',\n 'schedule_send_heuristic_suspicious_files',\n 'auto_cure_backup',\n 'auto_cure',\n 'os_cron_analysis',\n 'outbound_links',\n 'frontend_analysis',\n 'important_files_listing',\n 'send_results',\n ];\n state = null;\n offset = 0;\n amount = 0;\n amount_coefficient = 1;\n total_scanned = 0;\n scan_percent = 0;\n percent_completed = 0;\n\n paused = false;\n\n button = null;\n spinner = null;\n\n progress_overall = null;\n progressbar = null;\n progressbar_text = null;\n\n timeout = 60000;\n\n state_timer = 0;\n\n /**\n * constructor\n * @param {array} properties\n */\n constructor( properties ) {\n console.log('init');\n if (jQuery('#spbcscan-results-log-module').length) {\n jQuery('.spbc-scan-log-title').removeClass('spbc---hidden');\n }\n\n // Crunch for cure backups\n if ( typeof properties['settings']['auto_cure'] !== 'undefined' ) {\n properties['settings']['scanner__auto_cure_backup'] = '1';\n }\n\n for ( let key in properties ) {\n if ( typeof this[key] !== 'undefined' ) {\n this[key] = properties[key];\n }\n }\n };\n\n /**\n * Function Action Control\n */\n actionControl() {\n if (this.state === null) {\n this.start();\n } else if (this.paused) {\n this.resume();\n this.controller();\n } else {\n this.pause();\n }\n };\n\n /**\n * Function Start\n */\n start() {\n this.active = true;\n this.state_timer = Math.round(new Date().getTime() /1000);\n\n this.state = this.getNextState( null );\n\n this.setPercents( 0 );\n this.scan_percent = 0;\n this.offset = 0;\n this.progress_overall.children('span')\n .removeClass('spbc_bold')\n .filter('.spbc_overall_scan_status_' + this.state)\n .addClass('spbc_bold');\n\n this.progressbar.show(500);\n this.progress_overall.show(500);\n this.button.html(spbcScaner.button_scan_pause);\n this.spinner.css({display: 'inline'});\n\n setTimeout(() => {\n this.controller();\n }, 1000);\n };\n\n /**\n * Function Pause\n * @param {*} result\n * @param {*} data\n * @param {*} opt\n */\n pause( result, data, opt ) {\n console.log('PAUSE');\n this.button.html(spbcScaner.button_scan_resume);\n this.spinner.css({display: 'none'});\n this.paused = true;\n this.active = false;\n };\n\n /**\n * Function Resume\n * @param {*} opt\n */\n resume( opt ) {\n console.log('RESUME');\n this.button.html(spbcScaner.button_scan_pause);\n this.spinner.css({display: 'inline'});\n this.paused = false;\n this.active = true;\n };\n\n /**\n * Function End\n * @param {bool} reload\n */\n end( reload ) {\n this.progressbar.hide(500);\n this.progress_overall.hide(500);\n this.button.html(spbcScaner.button_scan_perform);\n this.spinner.css({display: 'none'});\n this.state = null;\n this.plug = false;\n this.total_scanned = 0;\n this.active = false;\n\n if (reload) {\n document.location = document.location;\n } else {\n spbcSendAJAXRequest(\n {action: 'spbc_scanner_tab__reload_accordion'},\n {\n notJson: true,\n callback: function(result, data, params, obj) {\n jQuery(obj).accordion('destroy')\n .html(result)\n .accordion({\n header: 'h3',\n heightStyle: 'content',\n collapsible: true,\n active: false,\n });\n spbcTblBulkActionsListen();\n spbcTblRowActionsListen();\n spbcTblPaginationListen();\n spbcTblSortListen();\n spbcStartShowHide();\n spbcScannerReloadScanInfo();\n },\n },\n jQuery('#spbc_scan_accordion'),\n );\n\n if (!jQuery('#spbc_scanner_clear').length) {\n let clearLink = '

Clear scanner logs


';\n jQuery(clearLink).insertBefore('#spbcscan-scanner-caption');\n }\n }\n };\n\n /**\n * Function Controller\n * @param {obj} result\n */\n controller( result ) {\n console.log(this.state);\n\n // The current stage is over. Switching to the new one\n if ( typeof result !== 'undefined' && result.end ) {\n this.state = this.getNextState( this.state );\n\n // End condition\n if (typeof this.state === 'undefined') {\n this.end();\n return;\n }\n\n // Set percent to 0\n this.setPercents( 0 );\n this.scan_percent = 0;\n this.offset = 0;\n\n // Changing visualizing of the current stage\n this.progress_overall.children('span')\n .removeClass('spbc_bold')\n .filter('.spbc_overall_scan_status_' + this.state)\n .addClass('spbc_bold');\n }\n\n // Break execution if paused\n if ( this.paused === true ) {\n return;\n }\n\n // // AJAX params\n let data = {\n action: 'spbc_scanner_controller_front',\n method: this.state,\n offset: this.offset,\n };\n\n let params = {\n type: 'GET',\n success: this.success,\n callback: this.successCallback,\n error: this.error,\n errorOutput: this.errorOutput,\n complete: null,\n context: this,\n timeout: 120000,\n };\n\n switch (this.state) {\n case 'get_modules_hashes': this.amount = 2; break;\n case 'clear_table': this.amount = 10000; break;\n case 'file_system_analysis': this.amount = 700; break;\n case 'auto_cure': this.amount = 5; break;\n case 'outbound_links': this.amount = 10; break;\n case 'frontend_analysis': this.amount = spbcSettings.frontendAnalysisAmount; break;\n case 'signature_analysis': this.amount = 10; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED,ERROR'; break;\n case 'heuristic_analysis': this.amount = 4; data.status = 'UNKNOWN,MODIFIED,OK,INFECTED,ERROR'; break;\n case 'schedule_send_heuristic_suspicious_files': this.amount = 1; break;\n }\n\n data.amount = Math.round(this.amount * this.amount_coefficient);\n\n spbcSendAJAXRequest(\n data,\n params,\n jQuery('#spbc_scan_accordion'),\n );\n };\n\n /**\n * Set Coefficients\n * @param {string} state\n */\n setCoefficients( state ) {\n let coefficient = this.amount_coefficient;\n switch (state) {\n case 'file_system_analysis': coefficient *= 1.5; break;\n }\n this.amount_coefficient = coefficient;\n };\n\n /**\n * Get Next State\n * @param {string} state\n * @return {number}\n */\n getNextState( state ) {\n state = state === null ? this.states[0] : this.states[this.states.indexOf( state ) + 1];\n\n if (typeof this.settings['scanner__' + state] !== 'undefined' && +this.settings['scanner__' + state] === 0) {\n state = this.getNextState( state );\n }\n\n return state;\n };\n\n /**\n * Set Percents\n * @param {number} percents\n */\n setPercents( percents ) {\n this.percent_completed = Math.floor( percents * 100 ) / 100;\n this.progressbar.progressbar( 'option', 'value', this.percent_completed );\n this.progressbar_text.text( spbcScaner['progressbar_' + this.state] + ' - ' + this.percent_completed + '%' );\n };\n\n /**\n * Function Success\n * @param {obj} response\n */\n success( response ) {\n if ( !! response.error ) {\n this.error(\n {status: 200, responseText: response.error},\n response.error,\n response.msg,\n );\n } else {\n if ( this.successCallback ) {\n this.successCallback( response, this.data, this.obj );\n }\n }\n };\n\n // Processing response from backend\n /**\n * Success Callback\n * @param {obj} result\n */\n successCallback( result ) {\n console.log( result );\n\n this.interactAccordion(result);\n\n if ( typeof result.total !== 'undefined' ) {\n this.scan_percent = 100 / result.total;\n }\n\n if ( typeof result.processed_items !== 'undefined') {\n if ( this.state === 'heuristic_analysis' && typeof result.total !== 0 ) {\n this.logRaw('

Heuristic Analysis

');\n }\n if ( this.state === 'signature_analysis' && typeof result.total !== 0 ) {\n this.logRaw('

Signature Analysis

');\n }\n\n this.logFileEntry( result.processed_items );\n }\n\n if ( typeof result.stage_data_for_logging !== 'undefined') {\n this.logStageEntry( result.stage_data_for_logging );\n }\n\n // Add link on shuffle salt if cured\n if (result.cured !== undefined && Number(result.cured) > 0) {\n this.showLinkForShuffleSalts(result.message);\n }\n\n if ( result.end !== true && result.end !== 1 ) {\n let processedPercents = this.percent_completed + result.processed * this.scan_percent;\n if (result.stage_data_for_logging.title === 'File System Analysis' && processedPercents > 100) {\n processedPercents = 100;\n }\n this.setPercents(processedPercents);\n this.offset = this.offset + result.processed;\n this.controller( result );\n } else {\n console.log( this.state +\n ' stage took ' +\n ( Math.round(new Date().getTime() /1000) - this.state_timer ) +\n ' seconds to complete' );\n this.state_timer = Math.round(new Date().getTime()/1000);\n this.setPercents( 100 );\n this.scan_percent = 0;\n this.offset = 0;\n setTimeout(() => {\n this.controller( result );\n }, 300);\n }\n };\n\n /**\n * Run interactive refresh for accordion.\n * @param {obj|string[]} result\n */\n interactAccordion(result) {\n // validation control\n if (result.hasOwnProperty('interactivity_data') &&\n result.interactivity_data.hasOwnProperty('update_text') &&\n result.interactivity_data.update_text &&\n result.interactivity_data.hasOwnProperty('refresh_data') &&\n result.interactivity_data.refresh_data.hasOwnProperty('do_refresh') &&\n result.interactivity_data.refresh_data.do_refresh &&\n result.interactivity_data.refresh_data.hasOwnProperty('control_tab') &&\n result.interactivity_data.refresh_data.control_tab\n ) {\n spbcReloadAccordion(\n result.interactivity_data.refresh_data.control_tab,\n result.interactivity_data.update_text,\n );\n }\n }\n\n /**\n * Function Error\n * @param {object} xhr\n * @param {string} status\n * @param {string} error\n */\n error( xhr, status, error ) {\n let errorOutput = this.errorOutput;\n\n console.log( '%c APBCT_AJAX_ERROR', 'color: red;' );\n console.log( status );\n console.log( error );\n console.log( xhr );\n\n if (status == 'error' && (error == '' || error == 'Not found')) {\n if (!this.tryCount) {\n this.tryCount = 0;\n this.retryLimit = 30;\n }\n this.tryCount++;\n console.log('Try #' + this.tryCount);\n this.setCoefficients(this.state);\n if (this.tryCount <= this.retryLimit) {\n this.pause();\n this.resume();\n this.controller();\n return;\n }\n }\n\n if ( xhr.status === 200 ) {\n if ( status === 'parsererror' ) {\n errorOutput( 'Unexpected response from server. See console for details.', this.state );\n console.log( '%c ' + xhr.responseText, 'color: pink;' );\n } else {\n let errorString = status;\n if ( typeof error !== 'undefined' ) {\n errorString += ' Additional info: ' + error;\n }\n errorOutput( errorString, this.state );\n }\n } else if (xhr.status === 500) {\n errorOutput( 'Internal server error.', this.state);\n } else {\n errorOutput('Unexpected response code: ' + xhr.status + '. Error: ' + status, this.state);\n }\n\n if ( this.progressbar ) {\n this.progressbar.fadeOut('slow');\n }\n\n this.end();\n };\n\n /**\n * Error Output\n * @param {string} errorMsg\n * @param {string} stage\n */\n errorOutput( errorMsg, stage ) {\n spbcModal.open().putError( errorMsg + '
Stage: ' + stage);\n };\n\n /**\n * Log Raw\n * @param {htmlString|Element|Text|Array|jQuery} messageToLog\n */\n logRaw(messageToLog) {\n jQuery('.spbc-scan-log-title').removeClass('spbc---hidden');\n jQuery('.spbc_log-wrapper').removeClass('spbc---hidden');\n jQuery('.spbc_log-wrapper .panel-body').prepend( messageToLog );\n };\n\n /**\n * Log File Entry\n * @param {array} items\n */\n logFileEntry(items) {\n for ( let key in items ) {\n if ( key ) {\n this.logRaw(\n '

' +\n this.getSiteUTCShiftedTimeString() + ' - ' +\n items[key].path + ' - ' + items[key].module +\n ': ' + items[key].status + '' +\n '

');\n }\n }\n };\n\n /**\n * Log Stage Entry\n * @param {obj} data\n */\n logStageEntry(data) {\n if (typeof jQuery('.panel-body .spbc_log-line span').first() !== 'undefined' &&\n typeof jQuery('.panel-body .spbc_log-line span').first()[0] !== 'undefined' &&\n jQuery('.panel-body .spbc_log-line span').first()[0].textContent === data.description\n ) {\n return;\n }\n this.logRaw( '

test ' +\n this.getSiteUTCShiftedTimeString() + ' - ' + '' +\n data.title + ' ' + '' + data.description + '

' );\n };\n\n /**\n * Show Link For Shuffle Salts\n * @param {string} message\n */\n showLinkForShuffleSalts(message) {\n jQuery('#spbc_notice_about_shuffle_link').remove();\n jQuery(jQuery('.spbc_tab--active .spbc_wrapper_field p')[1])\n .after(\n '
' +\n '' +\n message +\n '' +\n '
',\n );\n }\n\n /**\n * Get Site UTC Shifted Time String\n * @return {string}\n */\n getSiteUTCShiftedTimeString() {\n let utcShiftedTs = false;\n // gettings current system/browser offset\n let currentBrowserOffset = new Date().getTimezoneOffset();\n currentBrowserOffset = currentBrowserOffset * -1 * 1000 * 60;\n // chek if global ct object is defined\n if (typeof spbcScaner !== 'undefined' &&\n typeof spbcScaner.timezone_shift !== 'undefined' &&\n spbcScaner.timezone_shift !== false) {\n utcShiftedTs = Date.now() - currentBrowserOffset + (spbcScaner.timezone_shift * 1000);\n }\n let ctDate = utcShiftedTs ? new Date(utcShiftedTs) : new Date();\n // construct date string\n let shortMonthName = new Intl.DateTimeFormat('en-US', {month: 'short'}).format;\n let minutes = String(ctDate.getMinutes()).padStart(2, '0');\n let seconds = String(ctDate.getSeconds()).padStart(2, '0');\n return shortMonthName(ctDate) + ' ' +\n ctDate.getDate() + ' ' + ctDate.getFullYear() + ' ' +\n ctDate.getHours() + ':' + minutes + ':' + seconds;\n }\n}\n"],"names":["SpbcMalwareScanner","first_start","active","root","settings","states","state","offset","amount","amount_coefficient","total_scanned","scan_percent","percent_completed","paused","button","spinner","progress_overall","progressbar","progressbar_text","timeout","state_timer","constructor","properties","let","key","console","log","jQuery","length","removeClass","this","actionControl","start","resume","controller","pause","Math","round","Date","getTime","getNextState","setPercents","children","filter","addClass","show","html","spbcScaner","button_scan_pause","css","display","setTimeout","result","data","opt","button_scan_resume","end","reload","hide","button_scan_perform","plug","document","location","spbcSendAJAXRequest","action","notJson","callback","params","obj","accordion","header","heightStyle","collapsible","spbcTblBulkActionsListen","spbcTblRowActionsListen","spbcTblPaginationListen","spbcTblSortListen","spbcStartShowHide","spbcScannerReloadScanInfo","insertBefore","method","type","success","successCallback","error","errorOutput","complete","context","spbcSettings","frontendAnalysisAmount","status","setCoefficients","coefficient","indexOf","percents","floor","text","response","responseText","msg","interactAccordion","total","processed_items","logRaw","logFileEntry","stage_data_for_logging","logStageEntry","undefined","cured","Number","showLinkForShuffleSalts","message","processedPercents","processed","title","hasOwnProperty","interactivity_data","update_text","refresh_data","do_refresh","control_tab","spbcReloadAccordion","xhr","tryCount","retryLimit","errorString","fadeOut","errorMsg","stage","spbcModal","open","putError","messageToLog","prepend","items","getSiteUTCShiftedTimeString","path","module","first","textContent","description","remove","after","utcShiftedTs","currentBrowserOffset","getTimezoneOffset","ctDate","timezone_shift","now","shortMonthName","Intl","DateTimeFormat","month","format","minutes","String","getMinutes","padStart","seconds","getSeconds","getDate","getFullYear","getHours"],"mappings":"MAKMA,mBACFC,YAAc,CAAA,EAEdC,OAAS,CAAA,EAETC,KAAO,GACPC,SAAW,GACXC,OAAS,CACL,iBACA,qBACA,gBACA,uBACA,sBACA,oBACA,qBACA,qBACA,2CACA,mBACA,YACA,mBACA,iBACA,oBACA,0BACA,gBAEJC,MAAQ,KACRC,OAAS,EACTC,OAAS,EACTC,mBAAqB,EACrBC,cAAgB,EAChBC,aAAe,EACfC,kBAAoB,EAEpBC,OAAS,CAAA,EAETC,OAAS,KACTC,QAAU,KAEVC,iBAAmB,KACnBC,YAAc,KACdC,iBAAmB,KAEnBC,QAAU,IAEVC,YAAc,EAMdC,YAAaC,GAWT,IAAMC,IAAIC,KAVVC,QAAQC,IAAI,MAAM,EACdC,OAAO,8BAA8B,EAAEC,Q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AM,GACS,KAAA,IAA1D/G,OAAO,kCAAkC,EAAE+G,MAAM,EAAE,IAC1D/G,OAAO,kCAAkC,EAAE+G,MAAM,EAAE,GAAGC,cAAgBtF,EAAKuF,aAI/E9G,KAAKyE,OAAQ,iCACTzE,KAAKyG,4BAA4B,EAAY,SAC7ClF,EAAK6D,MAAkB,cAAW7D,EAAKuF,YAAc,aAAc,CAC3E,CAMA9B,wBAAwBC,GACpBpF,OAAO,iCAAiC,EAAEkH,OAAO,EACjDlH,OAAOA,OAAO,yCAAyC,EAAE,EAAE,EACtDmH,MACG,uKAEA/B,EAEA,YACJ,CACR,CAMAwB,8BACIhH,IAAIwH,EAAe,CAAA,EAEnBxH,IACAyH,EAA8C,CAAC,GADpB,IAAI1G,MAAO2G,kBAAkB,EACL,IAAO,GAOtDC,GAFAH,EAHsB,aAAtB,OAAOhG,YAC8B,KAAA,IAA9BA,WAAWoG,gBACY,CAAA,IAA9BpG,WAAWoG,eACI7G,KAAK8G,IAAI,EAAIJ,EAAoD,IAA5BjG,WAAWoG,eAEtDJ,GAAe,IAAIzG,KAAKyG,CAAY,EAAI,IAAIzG,KAErD+G,EAAiB,IAAIC,KAAKC,eAAe,QAAS,CAACC,MAAO,OAAO,CAAC,EAAEC,OACpEC,EAAUC,OAAOT,EAAOU,WAAW,CAAC,EAAEC,SAAS,EAAG,GAAG,EACrDC,EAAUH,OAAOT,EAAOa,WAAW,CAAC,EAAEF,SAAS,EAAG,GAAG,EACzD,OAAOR,EAAeH,CAAM,EAAI,IAC5BA,EAAOc,QAAQ,EAAI,IAAMd,EAAOe,YAAY,EAAI,IAChDf,EAAOgB,SAAS,EAAI,IAAMR,EAAU,IAAMI,CAClD,CACJ"} \ No newline at end of file diff --git a/js/spbc-table.min.js b/js/spbc-table.min.js index 399a1f82e..80f86869d 100644 --- a/js/spbc-table.min.js +++ b/js/spbc-table.min.js @@ -1,2 +1,2 @@ -let spbcBulkAction=null;const noConfirmActions=spbcGetNoConfirmActions(spbcPublic);function spbcReloadAccordion(c=null,s=""){spbcSendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(e,t,n,a){jQuery(a).accordion("destroy"),jQuery(a).html(e),jQuery(a).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbcTblBulkActionsListen(),spbcTblRowActionsListen(),spbcTblPaginationListen(),spbcTblSortListen(),spbcStartShowHide(),null!==c&&null!==s&&interactScannerTab(c,s)}},jQuery("#spbc_scan_accordion"))}function interactScannerTab(e,t){var n,a;"string"==typeof e&&""!==e&&"string"==typeof t&&""!==t&&(n=jQuery('#spbc_scan_accordion div[refresh_control_tab="'+e+'"]')[0],e="h3[aria-controls=spbc_scan_accordion_tab_"+e+"]",e=jQuery(e)[0],void 0!==n)&&void 0!==e&&(jQuery('
').appendTo(e),a=jQuery(".spbc_accordion_header_caption__update_status"),jQuery('
'+t+"
").appendTo(a),e.click(),n.setAttribute("class","ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-active"),jQuery(".row-actions").hide())}function spbcTblBulkActionsListen(){jQuery(".tbl-bulk_actions-all--apply").off("click").on("click",function(){if(spbcScanner.active)alert(spbcTableLocalize.scannerIsActive);else{var e=jQuery(this);let n=e.siblings("select").children()[e.siblings("select").first()[0].selectedIndex].value;if(-1!==["approve","disapprove","send","check_analysis_status","approve_page","disapprove_page","cure","delete_from_analysis_log"].indexOf(n)){if(noConfirmActions.any.includes(n)||confirm(spbcTable.warning_bulk)){var t={action:"spbc_tbl-action--bulk",add_action:n,status:e.parents(".tbl-root").attr("type")};if("cure"===n){var a=e.closest("#spbc_tbl__scanner_cure_log").find(".cb-select");let n=[];a.each(function(e,t){t=jQuery(t).val();n.push(t)}),t.selectedIds=n}if("delete_from_analysis_log"===n){a=e.closest("#spbc_tbl__scanner_analysis_log").find(".cb-select");let n=[];a.each(function(e,t){t=jQuery(t).val();n.push(t)}),t.file_ids=n}a={button:this,spinner:e.children(".tbl-preloader--small"),callback:function(e){var t;spbcReloadAccordion(),"check_analysis_status"===n&&void 0!==e&&(t="

Analysis status updated. Total: "+e.counters.total+", updated: "+e.counters.updated+", skipped: "+e.counters.skipped+", failed: "+e.counters.failed+", queued: "+e.counters.queued+"

",spbcModal.open().put(t)),"send"===n&&void 0!==e&&(t="

Files have been sent: "+e.files_sent_counter+"

",spbcModal.open().put(t))},errorOutput:function(e,t){t&&(e=e+"
Additional information:
"+t),spbcModal.open().putError(e)},timeout:6e4};spbcSendAJAXRequest(t,a)}}else alert("This action is not supported for all files yet =(")}}),jQuery(".tbl-bulk_actions--apply").off("click").on("click",function(e){var n=spbcBulkAction||jQuery(this);let a=(spbcBulkAction=n).siblings("select").children()[n.siblings("select").first()[0].selectedIndex].value;if(spbcBulkAction||noConfirmActions.any.includes(a)||confirm(spbcTable.warning_bulk))if("cure"===a)spbcScannerCureSelected(jQuery(this));else if("delete_from_analysis_log"===a)spbcScannerAnalysisLogDeleteFromLog(jQuery(this));else if("allow"===a||"ban"===a){let t="ban"===a?"deny":a;var c=n.parents(".tbl-root").find(".cb-select:checked"),c=(c&&(n.children(".tbl-preloader--small").show(),c.each(function(){var e=jQuery(this).parents("tr").find(".tbl-row_action--"+a).data("ip");spbcSecLogsFilterIp(e,t,!0),jQuery(this).prop("checked",!1)})),n.children(".tbl-preloader--small").hide(),"allow"===a?"Allowed":"Banned"),c="

Success. Selected IPs have been "+c+". Changes will be applied within 10 minutes.

";spbcModal.open().put(c),void setTimeout(spbcReloadAccordion,1900)}else"-1"!==a&&n.parents(".tbl-root").find(".cb-select").is(":checked")?(n.children(".tbl-preloader--small").show(),n.parents(".tbl-root").find(".cb-select:checked").first().parents("tr").find(".tbl-row_action--"+a)[0]?(n.parents(".tbl-root").find(".cb-select:checked").first().parents("tr").find(".tbl-row_action--"+a).click(),n.parents(".tbl-root").find(".cb-select:checked").first().prop("checked",!1)):(n.parents(".tbl-root").find(".cb-select:checked").first().prop("checked",!1),n.click())):(n.children(".tbl-preloader--small").hide(),spbcBulkAction=null,"check_analysis_status"!==a&&"disapprove"!==a||spbcModal.open().put("

All available files are updated.

"),"send"===a&&spbcModal.open().put("

All available files are sent.

"),setTimeout(spbcReloadAccordion,1900)),noConfirmActions.restricted.includes(a)&&(spbcBulkAction=null)})}function spbcScannerCureSelected(t){var e=t.closest("#spbc_tbl__scanner_cure_log").find(".cb-select:checked");let n=[];0===e.length&&alert("Please, select elements."),e.each(function(e,t){t=jQuery(t).val();n.push(t)});e={action:"spbc_cure_selected",security:spbcSettings.ajax_nonce,selectedIds:n};jQuery.ajax({type:"POST",url:spbcSettings.ajaxurl,data:e,beforeSend:function(){t.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").show()},success:function(e){t.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").hide(),e.success?(spbcModal.open().put(e.data),document.addEventListener("spbcModalClosed",function(e){document.location.reload()})):spbcModal.open().putError(e.data)}})}function spbcTblRowActionsListen(){jQuery(".tbl-row_action--ajax").off("click").on("click",function(){if(spbcScanner.active)alert(spbcTableLocalize.scannerIsActive);else{let t=jQuery(this),n={action:"spbc_tbl-action--row",add_action:t.attr("row-action"),id:t.parents(".row-actions").attr("uid"),cols:t.parents(".row-actions").attr("cols_amount"),page_url:t.parent().attr("uid"),page_id:t.parent().attr("page_id")},a={callback:spbcTblRowActionsCallback,errorOutput:function(e,t,n){spbcModal.open().putError(e,n)},spinner:t.parent().siblings(".tbl-preloader--tiny")};"delete"===t.attr("row-action")&&(a.timeout=6e4);var e,c,s=t.parent().parent()[0].firstChild.innerHTML,i=spbcTable["warning_h_"+t.attr("row-action")]||spbcTable.warning_default,o=spbcTable["warning_t_"+t.attr("row-action")]||"";spbcBulkAction||noConfirmActions.any.includes(n.add_action)?spbcSendAJAXRequest(n,a,t.parents("tr")):(e="quarantine"===t.attr("row-action")?"Quarantine":"Yes",c="quarantine"===t.attr("row-action")?"Cancel":"No",spbcModal.open().confirm(i,o,s,e=>{e&&spbcSendAJAXRequest(n,a,t.parents("tr"))},e,c))}})}function spbcGetNoConfirmActions(e){var t={any:[],restricted:[],defaults:[]};let n=t;try{"function"==typeof(n=void 0!==e&&e.hasOwnProperty("no_confirm_row_actions")?JSON.parse(e.no_confirm_row_actions):n).any.includes&&"function"==typeof n.restricted.includes&&"function"==typeof n.defaults.includes||(n=t)}catch(e){n=t}return n}function spbcTblRowActionsCallback(t,n,e,a){if(t.color&&a.css({background:t.background,color:t.color}),t.html&&(a.parent().parent().parent().prepend(t.html),setTimeout(function(){a.fadeOut(300)},1500),spbcBulkAction||setTimeout(spbcReloadAccordion,1900)),"copy_file_info"===n.add_action&&(!0===t.success&&t.data.file_info?window.prompt("Copy the file info below and send it to support@cleantalk.org: ",t.data.file_info):(c=void 0!==t.data.error?t.data.error:"Unknown copy_file_info error",spbcModal.open().putError(c))),t.temp_html){let e=a.html();if(a.html(t.temp_html),void 0!==t.updated_template){var c=t.updated_template_type,t=t.updated_template,s=jQuery(t).find(".wp-list-table tbody tr").length,i=jQuery('[aria-controls="spbc_scan_accordion_tab_'+c+'"]');if(0n&&jQuery(t).css("outline","1px solid green")}),i.click()}else"analysis_log"===c&&(o='",c='