Plugin Directory

Changeset 3022805


Ignore:
Timestamp:
01/17/2024 08:22:23 AM (2 years ago)
Author:
alexandergull
Message:

Update to 2.126

Location:
security-malware-firewall
Files:
1005 added
40 edited

Legend:

Unmodified
Added
Removed
  • security-malware-firewall/trunk/css/spbc-table.min.css

    r2848900 r3022805  
    1 #spbc_tbl__scanner_frontend_malware th,tbody td{position:relative}[disabled]:hover{cursor:not-allowed}.tbl-width--50px{width:50px}.tbl-width--100px{width:100px}.tbl-width--sma{width:7em}.tbl-widtqh--mid{width:6em}.tbl-min_width--big{width:12em}tr .row-actions{left:0}.tbl-row_action:hover{cursor:pointer;text-decoration:underline}tr .row-actions span{color:gray}tr:hover .row-actions span.tbl-row_action{color:#0073aa}tr:hover .row-actions span.tbl-row_action--delete,tr:hover .row-actions span.tbl-row_action--replace{color:#a00}tr:hover .row-actions span.tbl-row_action--approve{color:#0a0}.tbl-row_action--hide{color:gray}.tbl-sorting_indicator{margin-left:10px;visibility:hidden}.tbl-sorting_indicator--sorted{color:rgba(0,0,0,.6);visibility:visible}.tbl-column-sortable:hover{cursor:pointer}.tbl-column-sortable:hover .tbl-sorting_indicator{visibility:visible;color:rgba(0,0,0,1)}.spbc_hint--icon{color:#999}.spbc_hint--icon:hover{color:#000}.spbc_hint--icon:hover+.spbc_hint--text{display:block}.spbc_hint--text{display:none;color:#999}.tbl-button{display:inline-block;line-height:20px;height:30px;margin:0;padding:0 10px 1px;cursor:pointer;border:1px solid #ccc;border-radius:3px;color:#555;background:#f7f7f7;vertical-align:top}.tbl-button---white_blue{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff}.tbl-select{padding:2px;line-height:20px!important;height:25px!important}.tbl-preloader--small{display:none;width:15px;height:15px;margin:0 5px;vertical-align:middle}.tbl-preloader--tiny{display:none;width:10px;height:10px;margin:0 5px}.tbl-preloader--in_button{margin:0 0 0 8px}.tbl-bulk_actions--wrapper{display:inline-block;margin:5px 0}.tbl-bulk_actions--apply,.tbl-pagination--button,.tbl-pagination--total{margin:0 5px}.tbl-pagination--wrapper{display:inline-block;padding:5px 0;vertical-align:middle}.tbl-pagination--total{vertical-align:baseline}.tbl-pagination--curr_page{width:36px;padding:3px 5px;font-size:13px;text-align:center}
     1#spbc_tbl__scanner_frontend_malware th,tbody td{position:relative}[disabled]:hover{cursor:not-allowed}.tbl-width--50px{width:50px}.tbl-width--100px{width:100px}.tbl-width--sma{width:7em}.tbl-widtqh--mid{width:6em}.tbl-min_width--big{width:12em}tr .row-actions{left:0}.tbl-row_action:hover{cursor:pointer;text-decoration:underline}tr .row-actions span{color:gray}tr:hover .row-actions span.tbl-row_action{color:#0073aa}tr:hover .row-actions span.tbl-row_action--delete,tr:hover .row-actions span.tbl-row_action--replace{color:#a00}tr:hover .row-actions span.tbl-row_action--approve{color:#0a0}.tbl-row_action--hide{color:gray}.tbl-sorting_indicator{margin-left:10px;visibility:hidden}.tbl-sorting_indicator--sorted{color:rgba(0,0,0,.6);visibility:visible}.tbl-column-sortable:hover{cursor:pointer}.tbl-column-sortable:hover .tbl-sorting_indicator{visibility:visible;color:rgba(0,0,0,1)}.spbc_hint--icon{color:#999}.spbc_hint--icon:hover{color:#000}.spbc_hint--icon:hover+.spbc_hint--text{display:block}.spbc_hint--text{display:none;color:#999}.tbl-button{display:inline-block;line-height:20px;height:30px;margin:0;padding:0 10px 1px;cursor:pointer;border:1px solid #ccc;border-radius:3px;color:#555;background:#f7f7f7;vertical-align:top}.tbl-button---white_blue{background:#2ea2cc;border-color:#0074a2;-webkit-box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);color:#fff}.tbl-select{padding:2px;line-height:20px!important;height:25px!important}.tbl-preloader--small{display:none;width:15px;height:15px;margin:0 5px;vertical-align:middle}.tbl-preloader--tiny{display:none;width:10px;height:10px;margin:0 5px}.tbl-preloader--in_button{margin:0 0 0 8px}.tbl-bulk_actions--wrapper{display:inline-block;margin:5px 0}.tbl-bulk_actions--apply,.tbl-pagination--button,.tbl-pagination--total{margin:0 5px}.tbl-pagination--wrapper{display:inline-block;padding:5px 0;vertical-align:middle}.tbl-pagination--total{vertical-align:baseline}.tbl-pagination--curr_page{width:36px;padding:3px 5px;font-size:13px;text-align:center}@media screen and (max-width:782px){#spbc_settings_form .wp-list-table,#spbc_settings_form .wp-list-table thead,tbody,td,tr{display:block}#spbc_settings_form .wp-list-table thead tr{position:absolute;top:-9999px;left:-9999px}#spbc_settings_form .wp-list-table tr{margin:0 0 1rem}#spbc_settings_form .wp-list-table td{display:block;position:relative;height:100%;padding:10px 0 10px 35%}#spbc_settings_form .wp-list-table tbody td:before{content:attr(data-before)!important;position:absolute;left:10px}#spbc_settings_form .spbcShortTextBlock{width:100%}#spbc_settings_form .wp-list-table tbody .mob_entries{display:none}#spbc_settings_form .wp-list-table tbody .mob_table_active{display:block}}
  • security-malware-firewall/trunk/inc/fw-update.php

    r2856893 r3022805  
    2626    sleep((int)$delay);
    2727
     28    $spbc->fw_stats['last_update_log'] = [];
     29
     30    spbc_security_firewall_update_log(__FUNCTION__);
     31
    2832    // Prevent start an update if update is already running and started less than 2 minutes ago
    2933    if (
     
    4549    // Delete temporary tables
    4650    FW::dataTablesDeleteTemporary(DB::getInstance(), array(
    47         SPBC_TBL_FIREWALL_DATA,
    48         SPBC_TBL_FIREWALL_DATA__IPS,
    49         SPBC_TBL_FIREWALL_DATA__COUNTRIES,
     51        SPBC_TBL_FIREWALL_DATA_V4,
     52        SPBC_TBL_FIREWALL_DATA_V6,
     53        SPBC_TBL_FIREWALL_DATA__IPS_V4,
     54        SPBC_TBL_FIREWALL_DATA__IPS_V6,
     55        SPBC_TBL_FIREWALL_DATA__COUNTRIES
    5056    ));
    5157
     
    7581    );
    7682
    77     // Make a direct update if folder creation or test RC fail
    78     if ( ! empty($prepare_dir__result['error']) || ! empty($test_rc_result['error'])) {
     83    // Make a direct update if folder creation, test RC fail or force const exist
     84    if ( ! empty($prepare_dir__result['error']) ||
     85        ! empty($test_rc_result['error']) ||
     86        (defined('SPBCT_FORCE_DIRECT_SECFW_UPDATE') && SPBCT_FORCE_DIRECT_SECFW_UPDATE)
     87    ) {
     88        spbc_security_firewall_update_log('go to direct update');
     89
    7990        return spbc_security_firewall_update_direct();
    8091    }
     
    91102        array( 'async' )
    92103    );
     104
     105    if ( ! empty($result['error']) ) {
     106        spbc_security_firewall_update_log(json_encode($result['error']));
     107    }
    93108
    94109    return ( ! empty($result['error']) && $queue->isQueueFinished() ) ? $result : true;
     
    106121    global $spbc;
    107122
     123    spbc_security_firewall_update_log(__FUNCTION__);
     124
    108125    if ( ! $spbc->key_is_ok ) {
    109126        return array( 'error' => 'KEY_IS_NOT_VALID' );
     
    134151    $queue = new Queue('fw_update', 'update_security_firewall__worker');
    135152    if ( $queue->isQueueFinished() ) {
     153        spbc_security_firewall_update_log('is queue finished');
    136154        return true;
    137155    }
     
    145163            $queue->refreshQueue();
    146164            if ( ! $queue->isQueueInProgress() ) {
    147                 // The stage executed, break waiting and continue sfw_update__worker process
     165                spbc_security_firewall_update_log('The stage executed, break waiting and continue sfw_update__worker process');
    148166                break;
    149167            }
    150168            if ( $i >= 4 ) {
    151                 // The stage still not executed, exit from sfw_update__worker
     169                spbc_security_firewall_update_log('The stage still not executed, exit from sfw_update__worker');
    152170                return true;
    153171            }
     
    175193    // This is the repeat stage request, do not generate any new RC
    176194    if ( stripos(Request::get('stage'), 'Repeat') !== false ) {
     195        spbc_security_firewall_update_log('repeat request');
     196
    177197        return true;
    178198    }
     
    183203        array( 'async' )
    184204    );
     205
     206    if ( ! empty($result['error']) ) {
     207        $spbc->error_add('firewall_update', current(array_column($queue->queue['stages'], 'error')));
     208    }
    185209
    186210    return ! empty($result['error']) && $queue->isQueueFinished() ? $result : true;
     
    332356    // Make sure that the table exists. Creating it if not.
    333357    $db_tables_creator = new \CleantalkSP\SpbctWP\DB\TablesCreator();
    334     $db_tables_creator->createTable($wpdb->base_prefix . 'spbc_firewall_data');
    335     $db_tables_creator->createTable($wpdb->prefix . 'spbc_firewall__personal_ips');
    336     $db_tables_creator->createTable($wpdb->prefix . 'spbc_firewall__personal_countries');
     358    $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA_V4);
     359    $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA_V6);
     360    $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA__IPS_V4);
     361    $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA__IPS_V6);
     362    $db_tables_creator->createTable(SPBC_TBL_FIREWALL_DATA__COUNTRIES);
    337363
    338364    // Update only personal tables for daughter blogs
     
    340366        DB::getInstance(),
    341367        array(
    342             SPBC_TBL_FIREWALL_DATA,
    343             SPBC_TBL_FIREWALL_DATA__IPS,
     368            SPBC_TBL_FIREWALL_DATA_V4,
     369            SPBC_TBL_FIREWALL_DATA_V6,
     370            SPBC_TBL_FIREWALL_DATA__IPS_V4,
     371            SPBC_TBL_FIREWALL_DATA__IPS_V6,
    344372            SPBC_TBL_FIREWALL_DATA__COUNTRIES
    345373        )
     
    351379
    352380    // Copying data without country code
    353     $result = FW::dataTablesCopyCountiesDataFromMainTable(DB::getInstance(), SPBC_TBL_FIREWALL_DATA);
    354     if ( ! empty($result['error']) ) {
    355         return $result;
     381    $result_v4 = FW::dataTablesCopyCountiesDataFromMainTable(DB::getInstance(), SPBC_TBL_FIREWALL_DATA_V4);
     382    $result_v6 = FW::dataTablesCopyCountiesDataFromMainTable(DB::getInstance(), SPBC_TBL_FIREWALL_DATA_V6);
     383    if ( ! empty($result_v4['error']) ) {
     384        return $result_v4;
     385    }
     386    if ( ! empty($result_v6['error']) ) {
     387        return $result_v6;
    356388    }
    357389
     
    488520    //Increment firewall entries
    489521    $tables_to_work_with = array(
    490         SPBC_TBL_FIREWALL_DATA,
    491         SPBC_TBL_FIREWALL_DATA__IPS,
     522        SPBC_TBL_FIREWALL_DATA_V4,
     523        SPBC_TBL_FIREWALL_DATA_V6,
     524        SPBC_TBL_FIREWALL_DATA__IPS_V4,
     525        SPBC_TBL_FIREWALL_DATA__IPS_V6,
    492526        SPBC_TBL_FIREWALL_DATA__COUNTRIES
    493527    );
     
    513547    $spbc->fw_stats['last_updated'] = current_time('timestamp');
    514548    $spbc->fw_stats['is_on_maintenance'] = false; // Remove maintenance mode
    515     $spbc->fw_stats['entries'] =
    516         $wpdb->get_var('SELECT COUNT(*) FROM ' . SPBC_TBL_FIREWALL_DATA) +
    517         $wpdb->get_var('SELECT COUNT(*) FROM ' . SPBC_TBL_FIREWALL_DATA__IPS);
     549
     550    $sql_count_networks = "SELECT SUM(cnt) FROM (
     551                    SELECT COUNT(*) as cnt FROM " . SPBC_TBL_FIREWALL_DATA_V4 . "
     552                    UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA_V6 . "
     553                    UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V4 . "
     554                    UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V6 . ") cnt";
     555    $spbc->fw_stats['entries'] = $wpdb->get_var($sql_count_networks);
    518556
    519557    $spbc->save('fw_stats', true, false);
     
    626664    // process_file
    627665    foreach ( $urls as $url ) {
     666        spbc_security_firewall_update_log('process ' . $url);
    628667        $result_process_file = spbc_security_firewall_update__process_file($url);
    629668        if ( ! empty($result_process_file['error']) ) {
     
    648687    return $result_end_of_update;
    649688}
     689
     690/**
     691 * Log steps
     692 *
     693 * @param string $step
     694 * @return void
     695 */
     696function spbc_security_firewall_update_log($step)
     697{
     698    global $spbc;
     699
     700    $time = date('Y-m-d H:i:s', time());
     701    $spbc->fw_stats['last_update_log'][] = [$time, $step];
     702
     703    $spbc->save('fw_stats', true, false);
     704}
  • security-malware-firewall/trunk/inc/spbc-admin.php

    r3011278 r3022805  
    106106    add_action('wp_ajax_spbc_send_security_log', 'spbc_send_logs', 1, 0);
    107107
    108     // WAF. Notification about blocked file.
    109     add_action('wp_ajax_spbc_check_file_block', array(WAF::class, 'wafFileGetLastBlockedInfo'));
     108    // UploadChecker. Notification about blocked file.
     109    add_action('wp_ajax_spbc_check_file_block', array(\CleantalkSP\SpbctWP\Firewall\UploadChecker::class, 'uploadCheckerGetLastBlockInfo'));
    110110
    111111    // Backups
     
    287287    ));
    288288
    289     if ($spbc->settings['waf__file_check'] && in_array($hook, array('upload.php', 'media-new.php'))) {
     289    if ($spbc->settings['upload_checker__file_check'] && in_array($hook, array('upload.php', 'media-new.php'))) {
    290290        wp_enqueue_script('spbc-upload-js', SPBC_PATH . '/js/spbc-upload.min.js', array('jquery'), SPBC_VERSION, false);
    291291    }
     
    442442            'waf__xss_check'              => __('Cross-Site Scripting (XSS) — prevents malicious code to be executed/sent to any user. As a result malicious scripts can not get access to the cookie files, session tokens and any other confidential information browsers use and store. Such scripts can even overwrite content of HTML pages. CleanTalk WAF monitors for patterns of these parameters and block them.', 'security-malware-firewall'),
    443443            'waf__sql_check'              => __('SQL Injection — one of the most popular ways to hack websites and programs that work with databases. It is based on injection of a custom SQL code into database queries. It could transmit data through GET, POST requests or cookie files in an SQL code. If a website is vulnerable and execute such injections then it would allow attackers to apply changes to the website\'s MySQL database.', 'security-malware-firewall'),
    444             'waf__file_check'             => __('The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'security-malware-firewall'),
     444            'upload_checker__file_check'  => __('The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'security-malware-firewall'),
    445445            'traffic_control__enabled'    => __('It analyzes quantity of requests towards website from any IP address for a certain period of time. For example, for an ordinary visitor it\'s impossible to generate 2000 requests within 1 hour. Big amount of requests towards website from the same IP address indicates that there is a high chance of presence of a malicious program.', 'security-malware-firewall'),
    446446            'scanner__outbound_links'     => __('This option allows you to know the number of outgoing links on your website and website addresses they lead to. These websites addresses will be checked with the CleanTalk Database and the results will show if they were used in spam messages. The option\'s purpose is to check your website and find hidden, forgotten and spam links. You should always remember if you have links to other websites which have a bad reputation, it could affect your visitors\' trust and your SEO.', 'security-malware-firewall'),
     
    807807        FROM ' . SPBC_TBL_SCAN_FILES . '
    808808        WHERE (STATUS = "INFECTED" AND severity = "CRITICAL" AND analysis_status IS NULL)
    809         OR STATUS = "DENIED_BY_CLOUD"';
     809        OR STATUS = "DENIED_BY_CLOUD"
     810        OR STATUS = "DENIED_BY_CT"';
    810811    $critical_count = (int)$wpdb->get_var($query) > 0;
    811812
     
    823824    $query = 'SELECT COUNT(*)
    824825        FROM ' . SPBC_TBL_SCAN_FILES . '
    825         WHERE pscan_status = "DANGEROUS" OR analysis_status = "DANGEROUS" OR status = "DENIED_BY_CT"';
     826        WHERE pscan_status = "DANGEROUS" OR analysis_status = "DANGEROUS" OR
     827        (status = "DENIED_BY_CT" AND last_sent IS NOT NULL)';
    826828    $analysis_has_dangerous = (int)$wpdb->get_var($query) > 0;
    827829
  • security-malware-firewall/trunk/inc/spbc-scanner.php

    r3005428 r3022805  
    236236        }
    237237
    238         // Scan file before send it
    239 
    240238        if ( $do_rescan ) {
    241             // Heuristic
    242             $heuristic_scanner = new \CleantalkSP\Common\Scanner\HeuristicAnalyser\Controller();
    243             $file_to_check = new \CleantalkSP\Common\Scanner\HeuristicAnalyser\Structures\FileInfo(
    244                 $file_info['path'],
    245                 $file_info['full_hash']
    246             );
    247             $result_heur = $heuristic_scanner->scanFile($file_to_check, $root_path);
    248 
    249             if (is_array($result_heur) && ! empty($result_heur['error'])) {
    250                 $output = array('error' => 'RESCANNING_FAILED');
     239            // Scan file before send it
     240            $rescan_results = spbc_scanner_rescan_single_file($file_info['path'], $file_info['full_hash'], $root_path);
     241            if (isset($rescan_results['error'])) {
     242                //break process if any check is failed
     243                $error = array('error' => $rescan_results['error']);
    251244                if ( !$direct_call ) {
    252                     wp_send_json($output);
     245                    wp_send_json($error);
    253246                }
    254                 return $output;
     247                return $error;
    255248            }
    256 
    257             // Signature
    258             $signatures  = $wpdb->get_results('SELECT * FROM ' . SPBC_TBL_SCAN_SIGNATURES, ARRAY_A);
    259 
    260             $signatures_scanner = new \CleantalkSP\Common\Scanner\SignaturesAnalyser\Controller();
    261             $file_to_check = new \CleantalkSP\Common\Scanner\SignaturesAnalyser\Structures\FileInfo(
    262                 $file_info['path'],
    263                 $file_info['full_hash']
    264             );
    265             $result_sign = $signatures_scanner->scanFile($file_to_check, $root_path, $signatures);
    266 
    267             if (is_array($result_sign) && ! empty($result_sign['error'])) {
    268                 $output = array('error' => 'RESCANNING_FAILED');
    269                 if ( !$direct_call ) {
    270                     wp_send_json($output);
    271                 }
    272                 return $output;
    273             }
    274 
    275             $mixed_result = Arr::mergeWithSavingNumericKeysRecursive((array)$result_heur, (array)$result_sign);
    276 
     249            $merged_result = $rescan_results['merged_result'];
     250
     251            //prepare weakspots for DTO
     252            $file_info['weak_spots'] = $merged_result['weak_spots'];
     253
     254            //update file in the table
    277255            $wpdb->update(
    278256                SPBC_TBL_SCAN_FILES,
     
    280258                    'checked_signatures' => $file_info['checked_signatures'],
    281259                    'checked_heuristic'  => $file_info['checked_heuristic'],
    282                     'status'             => $file_info['status'] === 'MODIFIED' ? 'MODIFIED' : $mixed_result['status'],
    283                     'severity'           => $mixed_result['severity'],
    284                     'weak_spots'         => json_encode($mixed_result['weak_spots']),
     260                    'status'             => $file_info['status'] === 'MODIFIED' ? 'MODIFIED' : $merged_result['status'],
     261                    'severity'           => $merged_result['severity'],
     262                    'weak_spots'         => json_encode($merged_result['weak_spots']),
    285263                    'full_hash'          => md5_file($root_path . $file_info['path']),
    286264                ),
     
    289267                array('%s')
    290268            );
    291             $file_info['weak_spots'] = $mixed_result['weak_spots'];
    292         }
    293 
    294         $file_info['full_hash']  = md5_file($root_path . $file_info['path']);
     269        }
    295270
    296271        if ( ! empty($file_info)) {
     
    307282                            }
    308283
     284                            // prepare file hash
     285                            $file_info['full_hash']  = md5_file($root_path . $file_info['path']);
     286
    309287                            // Getting file && API call
    310                             $file   = file_get_contents($root_path . $file_info['path']);
    311 
     288                            $file_content   = file_get_contents($root_path . $file_info['path']);
    312289                            try {
    313290                                $dto = new DTO\MScanFilesDTO(
    314291                                    array(
    315292                                        'path_to_sfile' => $file_info['path'],
    316                                         'attached_sfile' => $file,
     293                                        'attached_sfile' => $file_content,
    317294                                        'md5sum_sfile' => $file_info['full_hash'],
    318295                                        'dangerous_code' => $file_info['weak_spots'],
     
    407384}
    408385
     386
     387/**
     388 * Do rescan a single file with heuristic and signatures.
     389 * @param $file_path
     390 * @param $full_hash
     391 * @param $root_path
     392 * @return array[]|string[]
     393 * <ul>
     394 * <li>array('heuristic_result' => Verdict,
     395 * <br>'signatures_result' => Verdict,
     396 * <br>'merged_result' => array(
     397 * <br>&nbsp&nbsp&nbsp&nbsp 'status' => '',
     398 * <br>&nbsp&nbsp&nbsp&nbsp 'severity' => '',
     399 * <br>&nbsp&nbsp&nbsp&nbsp 'weak_spots' => '')) on success
     400 * </li>
     401 * <li>array('error' => 'error_text') on failure.</li>
     402 * </ul>
     403 */
     404function spbc_scanner_rescan_single_file($file_path, $full_hash, $root_path)
     405{
     406    global $wpdb;
     407    $out = array(
     408        'heuristic_result' => array(),
     409        'signatures_result' => array(),
     410        'merged_result' => array(),
     411    );
     412
     413    //Heuristic
     414    $heuristic_scanner = new \CleantalkSP\Common\Scanner\HeuristicAnalyser\Controller();
     415    $file_to_check = new \CleantalkSP\Common\Scanner\HeuristicAnalyser\Structures\FileInfo(
     416        $file_path,
     417        $full_hash
     418    );
     419    $result_heur = $heuristic_scanner->scanFile($file_to_check, $root_path);
     420
     421    if (is_array($result_heur) && ! empty($result_heur['error'])) {
     422        return array('error' => 'RESCANNING_FAILED');
     423    }
     424
     425    // Signature
     426    $signatures  = $wpdb->get_results('SELECT * FROM ' . SPBC_TBL_SCAN_SIGNATURES, ARRAY_A);
     427    $signatures_scanner = new \CleantalkSP\Common\Scanner\SignaturesAnalyser\Controller();
     428    $file_to_check = new \CleantalkSP\Common\Scanner\SignaturesAnalyser\Structures\FileInfo(
     429        $file_path,
     430        $full_hash
     431    );
     432    $result_sign = $signatures_scanner->scanFile($file_to_check, $root_path, $signatures);
     433
     434    if (is_array($result_sign) && ! empty($result_sign['error'])) {
     435        return array('error' => 'RESCANNING_FAILED');
     436    }
     437
     438    $out['heuristic_result'] = $result_heur;
     439    $out['signature_result'] = $result_sign;
     440
     441    $merged_result = Arr::mergeWithSavingNumericKeysRecursive((array)$result_heur, (array)$result_sign);
     442
     443    //merge weak-spots
     444    if ( isset($merged_result['weak_spots']) &&
     445        is_array($merged_result['weak_spots']) &&
     446        isset($merged_result['weak_spots'][0]) &&
     447        count($merged_result['weak_spots']) > 1 ) {
     448        unset($merged_result['weak_spots'][0]);
     449    }
     450
     451    //merge status and severities
     452    if ($result_sign->status !== 'OK') {
     453        //signatures verdict is prior
     454        $merged_result['status'] = $result_sign->status;
     455        $merged_result['severity'] = $result_sign->severity;
     456    } elseif ($result_heur->status  !== 'OK') {
     457        //if no signatures found - check heuristic verict
     458        $merged_result['status'] = $result_heur->status;
     459        $merged_result['severity'] = $result_heur->severity;
     460    }
     461
     462    $out['merged_result'] = $merged_result;
     463
     464    return $out;
     465}
     466
    409467function spbc_scanner_file_delete($direct_call = false, $file_id = null)
    410468{
     
    582640                        SPBC_TBL_SCAN_FILES,
    583641                        array(
    584                             'status'         => 'APROVED',
     642                            'status'         => 'APPROVED_BY_USER',
    585643                            'previous_state' => $previous,
    586644                            'pscan_status' => null,
     
    764822                    . ' pscan_processing_status  = "DONE",'
    765823                    . ' pscan_status  = %s ,'
     824                    . ' severity  = "CRITICAL",'
    766825                    . ' pscan_balls  = %s,'
    767826                    . ' status  = "DENIED_BY_CLOUD"'
     
    10181077        'SELECT fast_hash FROM ' . SPBC_TBL_SCAN_FILES . '
    10191078        WHERE last_sent IS NULL
    1020         AND status NOT IN ("OK","APROVED","APPROVED_BY_CT","APPROVED_BY_CLOUD")',
     1079        AND status NOT IN ("OK","APPROVED_BY_USER","APPROVED_BY_CT","APPROVED_BY_CLOUD")',
    10211080        ARRAY_A
    10221081    );
     
    10701129            $res = ' WHERE status IN ("DENIED_BY_CLOUD", "DENIED_BY_CT")
    10711130            OR (
    1072                 severity IN("CRITICAL")
     1131                severity = "CRITICAL"
    10731132                AND (
    10741133                    status <> "QUARANTINED" AND
    1075                     status <> "APROVED" AND
     1134                    status <> "APPROVED_BY_USER" AND
    10761135                    status <> "APPROVED_BY_CT"
    10771136                    )
     
    10861145            $res = ' WHERE severity <> "CRITICAL" AND
    10871146                        last_sent IS NULL AND
    1088                         (status = "MODIFIED" AND severity IS NOT NULL)
    1089                         OR (status = "INFECTED" AND severity IN ("SUSPICIOUS","DANGER") )';
     1147                        (status = "MODIFIED" AND source_type IS NOT NULL)
     1148                        OR (status = "INFECTED" AND severity = "SUSPICIOUS")';
    10901149            break;
    10911150        case 'approved':
    1092             $res = ' WHERE ( status = "APROVED" OR status = "APPROVED_BY_CT" OR status = "APPROVED_BY_CLOUD") AND source_type IS NULL';
     1151            $res = ' WHERE ( status = "APPROVED_BY_USER" OR status = "APPROVED_BY_CT" OR status = "APPROVED_BY_CLOUD") AND source_type IS NULL';
    10931152            break;
    10941153        case 'analysis_log':
     
    10961155            break;
    10971156        case 'unknown':
    1098             $res = ' WHERE status NOT IN ("APROVED","APPROVED_BY_CT","APPROVED_BY_CLOUD","DENIED_BY_CT") AND
     1157            $res = ' WHERE status NOT IN ("APPROVED_BY_USER","APPROVED_BY_CT","APPROVED_BY_CLOUD","DENIED_BY_CT") AND
    10991158                            detected_at >= ' . (time() - $spbc->settings['scanner__list_unknown__older_than'] * 86400) . ' AND
    11001159                            source IS NULL AND
     1160                            source_type IS NULL AND
    11011161                            path NOT LIKE "%wp-content%themes%" AND
    11021162                            path NOT LIKE "%wp-content%plugins%" AND
    11031163                            path NOT LIKE "%wp-content%cache%" AND
    11041164                            path NOT LIKE "%wp-config.php" AND
    1105                             (severity IS NULL OR severity NOT IN ("CRITICAL", "DANGER", "SUSPICIOUS")) AND
     1165                            (severity IS NULL OR severity NOT IN ("CRITICAL", "SUSPICIOUS")) AND
    11061166                            last_sent IS NULL';
    11071167            break;
     
    12891349        $page_text = array();
    12901350
     1351        $page_url_sql = str_replace('.', '%', $page_url);
     1352
    12911353        // Getting file info.
    12921354        $sql_result = $wpdb->get_results(
     
    12941356                'SELECT weak_spots'
    12951357                . ' FROM ' . SPBC_TBL_SCAN_FRONTEND
    1296                 . ' WHERE url = %s'
     1358                . ' WHERE url LIKE %s'
    12971359                . ' LIMIT 1',
    1298                 $page_url
     1360                $page_url_sql
    12991361            ),
    13001362            ARRAY_A
     
    19732035    $pdf->drawFilesListByType('critical_files');
    19742036
     2037    $pdf->AddPage();
     2038
     2039    $pdf->drawFilesListByType('suspicious_files');
     2040
    19752041    $pdf->Output();
    19762042}
  • security-malware-firewall/trunk/inc/spbc-settings.php

    r3011278 r3022805  
    11<?php
    22
     3use CleantalkSP\SpbctWP\Cron as SpbcCron;
     4use CleantalkSP\SpbctWP\HTTP\CDNHeadersChecker;
    35use CleantalkSP\SpbctWP\Scanner\ScanningLog\ScanningLogFacade;
    46use CleantalkSP\Variables\Post;
     
    427429                                    'waf__xss_check',
    428430                                    'waf__sql_check',
    429                                     'waf__file_check',
    430431                                    'waf__exploit_check',
    431432                                    'waf_blocker__enabled'
     
    446447                                'parent'           => 'waf__enabled',
    447448                            ),
    448                             'waf__file_check'                   => array(
    449                                 'type'             => 'field',
    450                                 'title'            => __('Check uploaded files', 'security-malware-firewall'),
    451                                 'description'      => __('Check uploaded files for malicious code.', 'security-malware-firewall'),
    452                                 'long_description' => true,
    453                                 'parent'           => 'waf__enabled',
    454                                 'children'         => array('waf__file_check__uploaded_plugins')
    455                             ),
    456                             'waf__file_check__uploaded_plugins' => array(
    457                                 'type'        => 'field',
    458                                 'title'       => __('Check plugins and themes while uploading', 'security-malware-firewall'),
    459                                 'description' => __('Check the plugins and themes uploaded via WordPress built in interface with heuristic and signature analysis.', 'security-malware-firewall'),
    460                                 'parent'      => 'waf__file_check',
    461                                 'class'       => 'spbc_sub2_setting',
    462                             ),
    463449                            'waf__exploit_check'                => array(
    464450                                'type'        => 'field',
     
    472458                                'description' => __('Blocking a visitor for 24 hours after several WAF detected brute force attempts.', 'security-malware-firewall'),
    473459                                'parent'      => 'waf__enabled',
     460                            ),
     461                            'upload_checker__file_check'                   => array(
     462                                'type'             => 'field',
     463                                'title'            => __('Run the Upload Checker module for uploaded files', 'security-malware-firewall'),
     464                                'description'      => __('The plugin will scan files uploaded to the WordPress media library for known malicious code with heuristic and signature analysis. If malware found, upload will stop.', 'security-malware-firewall'),
     465                                'long_description' => true,
     466                                'children'         => array('upload_checker__do_check_wordpress_modules')
     467                            ),
     468                            'upload_checker__do_check_wordpress_modules' => array(
     469                                'type'        => 'field',
     470                                'title'       => __('Check plugins and themes archives before install', 'security-malware-firewall'),
     471                                'description' => __('Check the plugins and themes uploaded via WordPress built in interface with heuristic and signature analysis.', 'security-malware-firewall'),
     472                                'parent'      => 'upload_checker__file_check',
     473                                'class'       => 'spbc_sub2_setting',
    474474                            ),
    475475                            'traffic_control__enabled'          => array(
     
    537537                                'title'      => __('Get visitors IP from additional headers', 'security-malware-firewall'),
    538538                                'description' => spbc_settings_field__secfw__get_ip__get_description(),
     539                                'long_description' => true,
     540                            ),
     541                            'secfw__get_ip__enable_cdn_auto_self_check' => array(
     542                                'type'       => 'field',
     543                                'title'      => __('Enable automatic CDN headers checker', 'security-malware-firewall'),
     544                                'description' => CDNHeadersChecker::getOptionDescriptionText(),
    539545                            ),
    540546                        ),
     
    16511657
    16521658    echo '<br/>';
     1659
     1660
     1661    //cdn checker data
     1662    add_filter('safe_style_css', function ($styles) {
     1663        $styles[] = 'display';
     1664        return $styles;
     1665    });
     1666    echo Escape::escKsesPreset(CDNHeadersChecker::getSummaryBlockHTML(), 'spbc_cdn_checker_table');
     1667
     1668    echo '<br/>';
    16531669    echo 'Plugin version: ' . SPBC_VERSION;
    16541670    echo '</div>';
     
    21692185                case 'DENY_BY_WAF_FILE':
    21702186                    $status = '<span class="spbcRed">'
    2171                               . __('Blocked by Web Application Firewall: ', 'security-malware-firewall')
     2187                              . __('Blocked by Upload Checker module: ', 'security-malware-firewall')
    21722188                              . '<span class="spbc_waf_reason_title">'
    21732189                              . __('Malicious files upload.', 'security-malware-firewall')
     
    24752491                        }
    24762492                    }
    2477                     if ( ! empty($weak_spots['DANGER'])) {
    2478                         // collecting all kinds of code
    2479                         $all_unique_weak_spots = array();
    2480                         foreach ($weak_spots['DANGER'] as $_string => $weak_spot_in_string) {
    2481                             $all_unique_weak_spots[] = $weak_spot_in_string[0];
    2482                         }
    2483                         $all_unique_weak_spots = array_unique($all_unique_weak_spots);
    2484                         foreach ($all_unique_weak_spots as $weak_spot_in_string) {
    2485                             $ws_string .= '<p style="margin: 0;"><span class="spbcRed"><i setting="danger_' . str_replace(' ', '_', $weak_spot_in_string) . '" class="spbc_long_description__show spbc-icon-help-circled"></i> Danger: </span>'
    2486                                 . (strlen($weak_spot_in_string) > 30
    2487                                     ? substr($weak_spot_in_string, 0, 30) . '...'
    2488                                     : $weak_spot_in_string);
    2489 
    2490                             $ws_string .= '</p>';
    2491                         }
    2492                     }
    24932493                }
    24942494
     
    25782578            }
    25792579
    2580             if ( isset($row->status) && $row->status === 'APROVED' ) {
     2580            if ( isset($row->status) && $row->status === 'APPROVED_BY_USER' ) {
    25812581                $pscan_status = 'APPROVED';
    25822582                $analysis_comment = __('Approved by user', 'security-malware-firewall');
     
    31883188        ),
    31893189        'actions'        => array(
    3190             'delete' => array('name' => 'Delete',),
    31913190            'view'   => array('name' => 'View', 'handler' => 'spbc_scanner_button_file_view_event(this);',),
    31923191        ),
    31933192        'bulk_actions'   => array(
    3194             'delete' => array('name' => 'Delete',),
    31953193        ),
    31963194        'sortable'       => array('path', 'size', 'perms', 'mtime',),
     
    35613559                    'if_empty_items'    => false,
    35623560                    'actions'           => array(
     3561                        'delete' => array('name' => 'Delete',),
    35633562                        'approve' => array('name' => 'Approve',),
    35643563                        'view'    => array('name' => 'View',),
    35653564                    ),
    35663565                    'bulk_actions'      => array(
     3566                        'delete' => array('name' => 'Delete',),
    35673567                        'approve' => array('name' => 'Approve',),
    35683568                    ),
     
    45144514            'desc'  => __('SQL Injection — one of the most popular ways to hack websites and programs that work with databases. It is based on injection of a custom SQL code into database queries. It could transmit data through GET, POST requests or cookie files in an SQL code. If a website is vulnerable and execute such injections then it would allow attackers to apply changes to the website\'s MySQL database.', 'security-malware-firewall')
    45154515        ),
    4516         'waf__file_check'             => array(
     4516        'upload_checker__file_check'             => array(
    45174517            'title' => __('Check uploaded files', 'security-malware-firewall'),
    45184518            'desc'  => __('The option checks each uploaded file to a website for malicious code. If it\'s possible for visitors to upload files to a website, for instance a work resume, then attackers could abuse it and upload an infected file to execute it later and get access to your website.', 'security-malware-firewall')
     
    47214721            'desc'  => __('The file hash is in denied list. It means that the Security analysts have marked this file
    47224722             as critically dangerous early. We do recommend you to order the Security Audit service.', 'security-malware-firewall')
     4723        ),
     4724        'secfw__get_ip' => array(
     4725            'title' => IP::getOptionLongDescriptionArray()['title'],
     4726            'desc'  => IP::getOptionLongDescriptionArray()['desc'],
    47234727        ),
    47244728        'no_description' => array(
     
    49965000}
    49975001
     5002add_action('spbc_before_returning_settings', 'spbc_cdn_checker__run_check_on_settings_change');
     5003
     5004function spbc_cdn_checker__run_check_on_settings_change($settings)
     5005{
     5006    if ( isset($settings['secfw__get_ip__enable_cdn_auto_self_check']) && $settings['secfw__get_ip__enable_cdn_auto_self_check'] != 0) {
     5007        CDNHeadersChecker::sendCDNCheckerRequest();
     5008        SpbcCron::updateTask('cdn_check', 'spbc_cdn_checker__send_request', 86400, time() + 86400);
     5009    }
     5010}
     5011
     5012
    49985013/**
    49995014 *
     
    50385053function spbc_settings_field__secfw__get_ip__get_labels()
    50395054{
    5040     $available_header = array(
    5041         2  => array('slug' => 'remote_addr', 'name' => 'Remote Addr'),
    5042         3  => array('slug' => 'x_forwarded_for', 'name' => 'X-Forwarder-For'),
    5043         4  => array('slug' => 'x_real_ip', 'name' => 'X-Real-Ip'),
    5044         5  => array('slug' => 'incapsula', 'name' => 'Incap-Client-Ip'),
    5045         6  => array('slug' => 'ico_x_forwarded_for', 'name' => 'Ico-X-Forwarded-For'),
    5046         7  => array('slug' => 'stackpath', 'name' => 'X-Sp-Forwarded-Ip'),
    5047         8  => array('slug' => 'x_forwarded_by', 'name' => 'X-Client-Ip'),
    5048         9  => array('slug' => 'sucury', 'name' => 'X-Sucuri-Clientip'),
    5049         10 => array('slug' => 'ezoic', 'name' => 'X-Middleton-Ip'),
    5050         11 => array('slug' => 'gtranslate', 'name' => 'X-Gt-Viewer-Ip'),
    5051         12 => array('slug' => 'cloud_flare', 'name' => 'Cf-Connecting-Ip'),
    5052         13 => array('slug' => 'ovh', 'name' => 'Remote-Ip'),
    5053     );
    50545055    $options          = array();
    50555056    $options[]        = array('val' => 1, 'label' => __('Auto', 'security-malware-firewall'),);
    50565057
    5057     foreach ( $available_header as $key => $header ) {
     5058    foreach (IP::$known_headers_collection as $key => $header ) {
    50585059        IP::get($header['slug'], [], true);
    50595060        $option_value = $header['name'];
     
    52265227        if ((int)$spbc->data['notice_show'] === 1) {
    52275228            return '<a href="https://cleantalk.org/my/bill/security?user_token=' . $spbc->user_token . '" class="spbc--status spbc--marker-yellow" target="_blank">'
    5228                    . __('Security license expires in next 7 days', 'security-malware-firewall')
     5229                   . __('Security license expires in next 30 days', 'security-malware-firewall')
    52295230                   . '<i class="spbc-icon-link-ext"></i></a>';
    52305231        }
     
    52705271        $show_exclaim_triangle = true;
    52715272        $button_text = __('Request Malware removal', 'security-malware-firewall');
    5272         $landing_page_link = 'https://l.cleantalk.org/website-manual-cure?email=' . esc_attr($email) . '&website=' . esc_attr($website);
     5273        $landing_page_link = 'https://l.cleantalk.org/website-malware-removal?email=' . esc_attr($email) . '&website=' . esc_attr($website);
    52735274    } elseif ($for === 'unknown' || $for === 'suspicious' || $for === 'analysis') {
    52745275        $text = __('If you are not sure about the results or looking for professional help from security specialists,
  • security-malware-firewall/trunk/js/spbc-admin.min.js

    r2848900 r3022805  
    1 function spbcGetGoogleQrCode(){var e={},c={};return e.security=spbcSettings.ajax_nonce,e.action="spbc_get_google_qr_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){c=e}}),c}function spbcCheckGoogleCode(){var e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_google_code",e.code=jQuery("#spbct-google-qr-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("#spbct-google-qr-code").dialog("close"),document.location.reload()):alert(e.data)}})}function spbcDisableG2fa(e){var c={};c.security=spbcSettings.ajax_nonce,c.action="spbc_disable_google_2fa",c.user_id=jQuery(e).data("user-id"),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:c,success:function(e){e.success?document.location.reload():alert(e.data)}})}jQuery(document).ready(function(){jQuery(".spbc_update_notice").on("click","button",function(){spbc_setCookie("spbc_update_banner_closed",1,2592e3)}),jQuery(document).on("click","#spbc-g2fa-enable",function(e){e.preventDefault();e=spbcGetGoogleQrCode();e.success?(jQuery("#spbct-google-qr-code-img").html(e.data.img+"<p>"+e.data.code+"</p>"),jQuery("#spbct-google-qr-code input").val(""),jQuery("#spbct-google-qr-code").dialog({modal:!0,title:"Google authenticator activation",buttons:{Cancel:function(){jQuery(this).dialog("close")},Ok:function(){spbcCheckGoogleCode()}},draggable:!1,resizable:!1})):alert(spbcGetGoogleQrCode.data)}),jQuery(document).on("click","#spbc-g2fa-disable",function(e){e.preventDefault(),confirm("Are you sure?")&&spbcDisableG2fa(this)});function e(e,c,t){setTimeout(function(){null!==e&&(jQuery(".spbc-admin_bar--user_counter").html(e.count),e.count<=3?(jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").show(),jQuery(".spbc-admin_bar--online_admins").html(e.users.join(", "))):jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").hide()),spbc_sendAJAXRequest(c,t)},15e3)}1==+spbcSettings.admin_bar__admins_online_counter&&e(null,{action:"spbc_get_authorized_admins"},{callback:e}),jQuery("body").on("click",".spbc-notice .notice-dismiss",function(e){e=jQuery(e.target).parent(".notice").attr("id");e&&spbc_sendAJAXRequest({action:"spbc_dismiss_banner",banner_id:e},{callback:null})}),1==+spbcSettings.needToWhitelist&&spbc_sendAJAXRequest({action:"spbc_private_list_add"},{callback:null})});
     1function spbcGetGoogleQrCode(){var e={},c={};return e.security=spbcSettings.ajax_nonce,e.action="spbc_get_google_qr_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){c=e}}),c}function spbcCheckGoogleCode(){var e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_google_code",e.code=jQuery("#spbct-google-qr-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("#spbct-google-qr-code").dialog("close"),document.location.reload()):alert(e.data)}})}function spbcDisableG2fa(e){var c={};c.security=spbcSettings.ajax_nonce,c.action="spbc_disable_google_2fa",c.user_id=jQuery(e).data("user-id"),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:c,success:function(e){e.success?document.location.reload():alert(e.data)}})}function spbcSummaryShowCDNCheckerTable(){event.preventDefault();var e=document.getElementById("spbc_stats_cdn_checker_table");void 0!==e&&("block"===e.style.display?e.style.display="none":e.style.display="block")}jQuery(document).ready(function(){jQuery(".spbc_update_notice").on("click","button",function(){spbc_setCookie("spbc_update_banner_closed",1,2592e3)}),jQuery(document).on("click","#spbc-g2fa-enable",function(e){e.preventDefault();e=spbcGetGoogleQrCode();e.success?(jQuery("#spbct-google-qr-code-img").html(e.data.img+"<p>"+e.data.code+"</p>"),jQuery("#spbct-google-qr-code input").val(""),jQuery("#spbct-google-qr-code").dialog({modal:!0,title:"Google authenticator activation",buttons:{Cancel:function(){jQuery(this).dialog("close")},Ok:function(){spbcCheckGoogleCode()}},draggable:!1,resizable:!1})):alert(spbcGetGoogleQrCode.data)}),jQuery(document).on("click","#spbc-g2fa-disable",function(e){e.preventDefault(),confirm("Are you sure?")&&spbcDisableG2fa(this)});function e(e,c,t){setTimeout(function(){null!==e&&(jQuery(".spbc-admin_bar--user_counter").html(e.count),e.count<=3?(jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").show(),jQuery(".spbc-admin_bar--online_admins").html(e.users.join(", "))):jQuery("#wp-admin-bar-spbc_admin_bar__online_admins").hide()),spbc_sendAJAXRequest(c,t)},15e3)}1==+spbcSettings.admin_bar__admins_online_counter&&e(null,{action:"spbc_get_authorized_admins"},{callback:e}),jQuery("body").on("click",".spbc-notice .notice-dismiss",function(e){e=jQuery(e.target).parent(".notice").attr("id");e&&spbc_sendAJAXRequest({action:"spbc_dismiss_banner",banner_id:e},{callback:null})}),1==+spbcSettings.needToWhitelist&&spbc_sendAJAXRequest({action:"spbc_private_list_add"},{callback:null})});
    22//# sourceMappingURL=spbc-admin.min.js.map
  • security-malware-firewall/trunk/js/spbc-admin.min.js.map

    r3011278 r3022805  
    1 {"version":3,"file":"spbc-admin.min.js","sources":["spbc-admin.js"],"sourcesContent":["function spbcGetGoogleQrCode() {\r\n\tvar data = {};\r\n\tvar res = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_get_google_qr_code';\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tres = result;\r\n\t\t},\r\n\t});\r\n\treturn res;\r\n}\r\n\r\nfunction spbcCheckGoogleCode() {\r\n\tvar data = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_check_google_code';\r\n\tdata.code = jQuery('#spbct-google-qr-code input').val();\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(result.success) {\r\n\t\t\t\tjQuery('#spbct-google-qr-code').dialog( \"close\" );\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t} else {\r\n\t\t\t\talert(result.data);\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\nfunction spbcDisableG2fa( element ) {\r\n\tvar data = {};\r\n\tdata.security = spbcSettings.ajax_nonce;\r\n\tdata.action = 'spbc_disable_google_2fa';\r\n    data.user_id = jQuery(element).data('user-id');\r\n\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\tasync: false,\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tsuccess: function(result){\r\n\t\t\tif(result.success) {\r\n\t\t\t\tdocument.location.reload();\r\n\t\t\t} else {\r\n\t\t\t\talert(result.data);\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Auto update banner close handler \r\n\tjQuery('.spbc_update_notice').on('click', 'button', function(){\r\n\t\tspbc_setCookie('spbc_update_banner_closed', 1, 86400 * 30);\r\n\t});\r\n\r\n\t// Enable G2FA from user profile page\r\n\tjQuery(document).on('click', '#spbc-g2fa-enable', function(e){\r\n\r\n\t\te.preventDefault();\r\n\t\tvar spbcGoogleQrCode = spbcGetGoogleQrCode();\r\n\r\n\t\tif( spbcGoogleQrCode.success ) {\r\n\t\t\tvar qr_code_div = jQuery('#spbct-google-qr-code-img');\r\n\t\t\tqr_code_div.html(spbcGoogleQrCode.data.img + '<p>' + spbcGoogleQrCode.data.code + '</p>');\r\n\t\t\tjQuery('#spbct-google-qr-code input').val('');\r\n\t\t\tjQuery('#spbct-google-qr-code').dialog({\r\n\t\t\t\tmodal: true,\r\n\t\t\t\ttitle: 'Google authenticator activation',\r\n\t\t\t\tbuttons: {\r\n\t\t\t\t\tCancel: function() {\r\n\t\t\t\t\t\tjQuery( this ).dialog( \"close\" );\r\n\t\t\t\t\t},\r\n\t\t\t\t\tOk: function() {\r\n\t\t\t\t\t\tspbcCheckGoogleCode();\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\tdraggable: false,\r\n\t\t\t\tresizable: false,\r\n\t\t\t});\r\n\t\t} else {\r\n\t\t\talert(spbcGetGoogleQrCode.data);\r\n\t\t}\r\n\r\n\t});\r\n\r\n\t// Disable G2FA from user profile page\r\n\tjQuery(document).on('click', '#spbc-g2fa-disable', function(e){\r\n\r\n\t\te.preventDefault();\r\n\t\tif( confirm( 'Are you sure?' ) ) {\r\n\t\t\tspbcDisableG2fa( this );\r\n\t\t}\r\n\r\n\t});\r\n\r\n\tvar refresh_user_online_counter = function( result, data, params ){\r\n\t\tsetTimeout(function () {\r\n\t\t\tif( result !== null ){\r\n\t\t\t\tjQuery('.spbc-admin_bar--user_counter').html(result.count);\r\n\t\t\t\tif( result.count <= 3 ) {\r\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').show();\r\n\t\t\t\t\tjQuery('.spbc-admin_bar--online_admins').html(result.users.join(', '));\r\n\t\t\t\t}else{\r\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').hide();\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\tspbc_sendAJAXRequest( data, params );\r\n\t\t}, 15000 );\r\n\t};\r\n\r\n\tif( +spbcSettings.admin_bar__admins_online_counter === 1 ) {\r\n\t\trefresh_user_online_counter(null, {action: 'spbc_get_authorized_admins'}, {callback: refresh_user_online_counter});\r\n\t}\r\n\r\n\t// Dismiss admin banner\r\n\tjQuery('body').on('click', '.spbc-notice .notice-dismiss', function(e){\r\n\t\tvar bannerId = jQuery(e.target).parent('.notice').attr('id');\r\n\t\tif( bannerId ) {\r\n\t\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_dismiss_banner', 'banner_id' : bannerId }, { 'callback' : null } );\r\n\t\t}\r\n\t});\r\n\r\n\tif (+spbcSettings.needToWhitelist === 1) {\r\n\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_private_list_add' }, { 'callback' : null } );\r\n\t}\r\n});"],"names":["spbcGetGoogleQrCode","data","res","security","spbcSettings","ajax_nonce","action","jQuery","ajax","type","async","url","ajaxurl","success","result","spbcCheckGoogleCode","code","val","dialog","document","location","reload","alert","spbcDisableG2fa","element","user_id","ready","on","spbc_setCookie","e","preventDefault","spbcGoogleQrCode","html","img","modal","title","buttons","Cancel","this","Ok","draggable","resizable","confirm","refresh_user_online_counter","params","setTimeout","count","show","users","join","hide","spbc_sendAJAXRequest","admin_bar__admins_online_counter","callback","bannerId","target","parent","attr","banner_id","needToWhitelist"],"mappings":"AAAA,SAASA,sBACR,IAAIC,EAAO,GACPC,EAAM,GAaV,OAZAD,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,0BAEdC,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAAS,SAASC,GACjBZ,EAAMY,CACP,CACD,CAAC,EACMZ,CACR,CAEA,SAASa,sBACR,IAAId,EAAO,GACXA,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,yBACdL,EAAKe,KAAOT,OAAO,6BAA6B,EAAEU,IAAI,EAEtDV,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAAS,SAASC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,EACbY,QAAS,eAAgB,GAC5BnB,gBAAiBe,IAAK,CAGxB,CAAC,EAEiC,SAA9BK,EAAwC7B,EAAQb,EAAM2C,GACzDC,WAAW,WACK,OAAX/B,IACHP,OAAO,+BAA+B,EAAEyB,KAAKlB,EAAOgC,KAAK,EACrDhC,EAAOgC,OAAS,GACnBvC,OAAO,6CAA6C,EAAEwC,KAAK,EAC3DxC,OAAO,gCAAgC,EAAEyB,KAAKlB,EAAOkC,MAAMC,KAAK,IAAI,CAAC,GAErE1C,OAAO,6CAA6C,EAAE2C,KAAK,GAI7DC,qBAAsBlD,EAAM2C,CAAO,CACpC,EAAG,IAAM,CACV,CAEuD,GAAnD,CAACxC,aAAagD,kCACjBT,EAA4B,KAAM,CAACrC,OAAQ,4BAA4B,EAAG,CAAC+C,SAAUV,CAA2B,CAAC,EAIlHpC,OAAO,MAAM,EAAEoB,GAAG,QAAS,+BAAgC,SAASE,GAC/DyB,EAAW/C,OAAOsB,EAAE0B,MAAM,EAAEC,OAAO,SAAS,EAAEC,KAAK,IAAI,EACvDH,GACHH,qBAAsB,CAAE7C,OAAW,sBAAuBoD,UAAcJ,CAAS,EAAG,CAAED,SAAa,IAAK,CAAE,CAE5G,CAAC,EAEqC,GAAlC,CAACjD,aAAauD,iBACjBR,qBAAsB,CAAE7C,OAAW,uBAAwB,EAAG,CAAE+C,SAAa,IAAK,CAAE,CAEtF,CAAC"}
     1{"version":3,"file":"spbc-admin.min.js","sources":["spbc-admin.js"],"sourcesContent":["function spbcGetGoogleQrCode() {\n\tvar data = {};\n\tvar res = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_get_google_qr_code';\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tres = result;\n\t\t},\n\t});\n\treturn res;\n}\n\nfunction spbcCheckGoogleCode() {\n\tvar data = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_check_google_code';\n\tdata.code = jQuery('#spbct-google-qr-code input').val();\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tjQuery('#spbct-google-qr-code').dialog( \"close\" );\n\t\t\t\tdocument.location.reload();\n\t\t\t} else {\n\t\t\t\talert(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\nfunction spbcDisableG2fa( element ) {\n\tvar data = {};\n\tdata.security = spbcSettings.ajax_nonce;\n\tdata.action = 'spbc_disable_google_2fa';\n    data.user_id = jQuery(element).data('user-id');\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: false,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result){\n\t\t\tif(result.success) {\n\t\t\t\tdocument.location.reload();\n\t\t\t} else {\n\t\t\t\talert(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\njQuery(document).ready(function(){\n\n\t// Auto update banner close handler\n\tjQuery('.spbc_update_notice').on('click', 'button', function(){\n\t\tspbc_setCookie('spbc_update_banner_closed', 1, 86400 * 30);\n\t});\n\n\t// Enable G2FA from user profile page\n\tjQuery(document).on('click', '#spbc-g2fa-enable', function(e){\n\n\t\te.preventDefault();\n\t\tvar spbcGoogleQrCode = spbcGetGoogleQrCode();\n\n\t\tif( spbcGoogleQrCode.success ) {\n\t\t\tvar qr_code_div = jQuery('#spbct-google-qr-code-img');\n\t\t\tqr_code_div.html(spbcGoogleQrCode.data.img + '<p>' + spbcGoogleQrCode.data.code + '</p>');\n\t\t\tjQuery('#spbct-google-qr-code input').val('');\n\t\t\tjQuery('#spbct-google-qr-code').dialog({\n\t\t\t\tmodal: true,\n\t\t\t\ttitle: 'Google authenticator activation',\n\t\t\t\tbuttons: {\n\t\t\t\t\tCancel: function() {\n\t\t\t\t\t\tjQuery( this ).dialog( \"close\" );\n\t\t\t\t\t},\n\t\t\t\t\tOk: function() {\n\t\t\t\t\t\tspbcCheckGoogleCode();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdraggable: false,\n\t\t\t\tresizable: false,\n\t\t\t});\n\t\t} else {\n\t\t\talert(spbcGetGoogleQrCode.data);\n\t\t}\n\n\t});\n\n\t// Disable G2FA from user profile page\n\tjQuery(document).on('click', '#spbc-g2fa-disable', function(e){\n\n\t\te.preventDefault();\n\t\tif( confirm( 'Are you sure?' ) ) {\n\t\t\tspbcDisableG2fa( this );\n\t\t}\n\n\t});\n\n\tvar refresh_user_online_counter = function( result, data, params ){\n\t\tsetTimeout(function () {\n\t\t\tif( result !== null ){\n\t\t\t\tjQuery('.spbc-admin_bar--user_counter').html(result.count);\n\t\t\t\tif( result.count <= 3 ) {\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').show();\n\t\t\t\t\tjQuery('.spbc-admin_bar--online_admins').html(result.users.join(', '));\n\t\t\t\t}else{\n\t\t\t\t\tjQuery('#wp-admin-bar-spbc_admin_bar__online_admins').hide();\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tspbc_sendAJAXRequest( data, params );\n\t\t}, 15000 );\n\t};\n\n\tif( +spbcSettings.admin_bar__admins_online_counter === 1 ) {\n\t\trefresh_user_online_counter(null, {action: 'spbc_get_authorized_admins'}, {callback: refresh_user_online_counter});\n\t}\n\n\t// Dismiss admin banner\n\tjQuery('body').on('click', '.spbc-notice .notice-dismiss', function(e){\n\t\tvar bannerId = jQuery(e.target).parent('.notice').attr('id');\n\t\tif( bannerId ) {\n\t\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_dismiss_banner', 'banner_id' : bannerId }, { 'callback' : null } );\n\t\t}\n\t});\n\n\tif (+spbcSettings.needToWhitelist === 1) {\n\t\tspbc_sendAJAXRequest( { 'action' : 'spbc_private_list_add' }, { 'callback' : null } );\n\t}\n});\n\nfunction spbcSummaryShowCDNCheckerTable()\n{\n\tevent.preventDefault()\n\tlet table = document.getElementById('spbc_stats_cdn_checker_table')\n\tif (typeof (table) !== 'undefined') {\n\t\tif (table.style.display === 'block') {\n\t\t\ttable.style.display = 'none'\n\t\t} else {\n\t\t\ttable.style.display = 'block'\n\t\t}\n\t}\n}\n"],"names":["spbcGetGoogleQrCode","data","res","security","spbcSettings","ajax_nonce","action","jQuery","ajax","type","async","url","ajaxurl","success","result","spbcCheckGoogleCode","code","val","dialog","document","location","reload","alert","spbcDisableG2fa","element","user_id","spbcSummaryShowCDNCheckerTable","event","preventDefault","let","table","getElementById","style","display","ready","on","spbc_setCookie","e","spbcGoogleQrCode","html","img","modal","title","buttons","Cancel","this","Ok","draggable","resizable","confirm","refresh_user_online_counter","params","setTimeout","count","show","users","join","hide","spbc_sendAJAXRequest","admin_bar__admins_online_counter","callback","bannerId","target","parent","attr","banner_id","needToWhitelist"],"mappings":"AAAA,SAASA,sBACR,IAAIC,EAAO,GACPC,EAAM,GAaV,OAZAD,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,0BAEdC,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAAS,SAASC,GACjBZ,EAAMY,CACP,CACD,CAAC,EACMZ,CACR,CAEA,SAASa,sBACR,IAAId,EAAO,GACXA,EAAKE,SAAWC,aAAaC,WAC7BJ,EAAKK,OAAS,yBACdL,EAAKe,KAAOT,OAAO,6BAA6B,EAAEU,IAAI,EAEtDV,OAAOC,KAAK,CACXC,KAAM,OACNC,MAAO,CAAA,EACPC,IAAKP,aAAaQ,QAClBX,KAAMA,EACNY,QAAS,SAASC,GACdA,EAAOD,SACTN,OAAO,uBAAuB,EAAEW,OAAQ,OAAQ,EAChDC,SAASC,SAASC,OAAO,GAEzBC,MAAMR,EAAOb,IAAI,CAEnB,CACD,CAAC,CACF,CAEA,SAASsB,gBAAiBC,GACzB,IAAIvB,E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EAAET,eAAe,EACbqB,QAAS,eAAgB,GAC5B1B,gBAAiBsB,IAAK,CAGxB,CAAC,EAEiC,SAA9BK,EAAwCpC,EAAQb,EAAMkD,GACzDC,WAAW,WACK,OAAXtC,IACHP,OAAO,+BAA+B,EAAEgC,KAAKzB,EAAOuC,KAAK,EACrDvC,EAAOuC,OAAS,GACnB9C,OAAO,6CAA6C,EAAE+C,KAAK,EAC3D/C,OAAO,gCAAgC,EAAEgC,KAAKzB,EAAOyC,MAAMC,KAAK,IAAI,CAAC,GAErEjD,OAAO,6CAA6C,EAAEkD,KAAK,GAI7DC,qBAAsBzD,EAAMkD,CAAO,CACpC,EAAG,IAAM,CACV,CAEuD,GAAnD,CAAC/C,aAAauD,kCACjBT,EAA4B,KAAM,CAAC5C,OAAQ,4BAA4B,EAAG,CAACsD,SAAUV,CAA2B,CAAC,EAIlH3C,OAAO,MAAM,EAAE4B,GAAG,QAAS,+BAAgC,SAASE,GAC/DwB,EAAWtD,OAAO8B,EAAEyB,MAAM,EAAEC,OAAO,SAAS,EAAEC,KAAK,IAAI,EACvDH,GACHH,qBAAsB,CAAEpD,OAAW,sBAAuB2D,UAAcJ,CAAS,EAAG,CAAED,SAAa,IAAK,CAAE,CAE5G,CAAC,EAEqC,GAAlC,CAACxD,aAAa8D,iBACjBR,qBAAsB,CAAEpD,OAAW,uBAAwB,EAAG,CAAEsD,SAAa,IAAK,CAAE,CAEtF,CAAC"}
  • security-malware-firewall/trunk/js/spbc-settings_tab--scanner.min.js

    r2998673 r3022805  
    1 function spbc_popup_tip___show(e){function s(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_popup_tip--wrapper").length&&!jQuery(e.target).hasClass("spbc_popup_tip--icon---cancel")||jQuery(e.target).hasClass("spbc_popup_tip--icon---show"))||(jQuery(".spbc_popup_tip--wrapper").hide(),jQuery(document).off("click",s))}var t=e.attr("spbc_tip_title")||null,n=e.attr("spbc_tip_text")||null,o=(s(),e.after("<div class='spbc_popup_tip--wrapper'></div>"),jQuery(".spbc_popup_tip--wrapper"));o.empty().append("<div class='spbc_popup_tip--angle'></div>").css({top:e.position().top-2,left:e.position().left+25}),o.append("<i class='spbc_popup_tip--icon---cancel icon-cancel'></i>").append("<h3 class='spbc_popup_tip--title'>"+t+"</h3>").append("<p class='spbc_popup_tip--text'>"+n+"</p>"),jQuery(document).on("click",s),e.parents("tr").on("mouseout",s)}function spbc_scanner_button_file_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_view",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_analysis_log_delete_from_log(e){let t=[];var s=jQuery(e);let n;if(jQuery(e).hasClass("tbl-row_action"))t.push(s.parents(".row-actions").attr("uid")),n=s.parent().siblings(".tbl-preloader--tiny");else{e=s.closest("#spbc_tbl__scanner_analysis_log").find(".cb-select:checked");if(0===e.length)return void alert("Please, select elements.");e.each(function(e,s){s=jQuery(s).val();t.push(s)}),n=s.children(".tbl-preloader--small")}e={action:"spbc_scanner_analysis_log_delete_from_log",file_ids:t},s={spinner:n,callback:function(){window.location.reload()}};spbc_sendAJAXRequest(e,s)}function spbc_scanner_button_page_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_page_view",page_url:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}},t=jQuery("#wpwrap"),n=jQuery("#spbc_dialog"),o=(n.dialog({modal:!0,title:"Loading..",position:{my:"center top",at:"center top+100px",of:window},width:t.width()/100*90,show:{effect:"blind",duration:500},draggable:!1,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow="auto",jQuery("#spbc_dialog").height(document.documentElement.clientHeight/100*25)},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}}),n.append('<img id="spbc_file_view_preloader" alt="Wait for downloading" class="spbc_preloader" src="../../wp-content/plugins/security-malware-firewall/images/preloader2.gif" style="display: block; position: absolute; ">'),jQuery("#spbc_file_view_preloader")),t=4e-4*t.width();o.height(128*t),o.width(128*t),o.css({left:n.width()/2-128*t/2}),o.css({top:n.height()/2-128*t/2}),spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonView_callback(e){var s,t=jQuery("#spbc_dialog");t.empty(),jQuery("#spbc_file_view_preloader").css({display:"none"});for(s in e.file)t.append('<div class="spbc_view_file_row_wrapper"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row">%s</p><br /></div>'.printf(s,e.file[s]));let n=19*Object.keys(e.file).length<76?76:19*Object.keys(e.file).length,o=document.documentElement.clientHeight/100*75,a=n<o?"hidden":"scroll",c="scroll"==a?o:n;t.css({height:c,overflow:a}),t.dialog({modal:!0,title:"Loaded: "+e.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,show:{effect:"blind",duration:500},draggable:!0,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow=a,jQuery("#spbc_dialog").height(c),jQuery(".ui-widget-overlay").on("click",function(){jQuery("#spbc_dialog").dialog("close")})},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}}),console.log("FILE_VIEWED")}function spbc_scanner_button_file_view_bad_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_view",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonViewBadFile_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_button_page_view_bad_event(e){var e=jQuery(e),s={action:"spbc_scanner_page_view",page_url:e.parent().attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonViewBad_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonViewBadFile_callback(s,e,t){console.log("FILE_VIEWED_BAD_CODE_FILE"),console.log(arguments),jQuery("#spbc_dialog").empty();var n,o,a,c='<div class="spbc_view_file_row_wrapper"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row">%s</p><br /></div>',r=[],i=[];for(o in s.weak_spots=JSON.parse(s.weak_spots),s.weak_spots)r[o]=Object.keys(s.weak_spots[o]);for(key in n=Object.keys(r).sort())i[n[key]]=r[n[key]];for(a in i){var l,p="spbc-dialog-row-header-"+a.toLowerCase(),_='<span id="'+p+'" style="text-align: center"><b>'+a+" weakspots:</b></span>",d=jQuery("#spbc_dialog"),_=(d.append(c.printf("",_)),d.append(c.printf("<b>...</b>","<b>...</b>")),d.find("#"+p));for(l in _.parent().parent().css("text-align","center"),_.parent().parent().css("border","1px dotted"),_.parent().parent().css("background","darkgrey"),r[a]){l=[...new Set(l)].sort();var u=+r[a][l];for(let e=u-2;e<=2+u;e++)void 0!==s.file[e]&&d.append((u===e?'<div class="spbc_view_file_row_wrapper" style="background: rgba(200,40,40,0.8);"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row">%s</p><br /></div>':c).printf(e,s.file[e]));d.append(c.printf("<b>...</b>","<b>...</b>"))}}jQuery("#spbc_dialog div").last().remove();let b=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,f=document.documentElement.clientHeight/100*75,g=b<f?"no_scroll":"scroll",y="scroll"==g?f:b;jQuery("#spbc_dialog").dialog({modal:!0,title:s.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,show:{effect:"blind",duration:500},draggable:!0,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow=g,jQuery("#spbc_dialog").height(y),jQuery(".ui-widget-overlay").on("click",function(){jQuery("#spbc_dialog").dialog("close")})},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}})}function spbc_scannerButtonViewBad_callback(n,e,s){console.log("FILE_VIEWED_BAD_CODE"),console.log(arguments);let t=()=>{};if(1==n.success){console.log(n);var o,a='<div class="spbc_view_file_row_wrapper"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row" style="word-break: break-all">%s</p><br /></div>',c=[];for(o in n.weak_spots=JSON.parse(n.weak_spots),n.weak_spots)c=c.concat(Object.keys(n.weak_spots[o]));var r,c=[...new Set(c)].sort(),i=new Map(Object.entries(n.weak_spots.CRITICAL));for(r in c)if(0!=r||!i.get(c[r]).toLowerCase().includes("doctype")){var l=+c[r];for(let t=l-2;t<=2+l;t++)if(void 0!==n.file[t]){var p=l===t;let e,s;e=p?'<div class="spbc_view_file_row_wrapper" style="background: rgb(200,120,120);"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row" style="word-break: break-all">%s</p><br /></div>':a,s=p&&!n.file[t].includes("iframe")?e.printf(t,i.get(c[r])):e.printf(t,n.file[t]),jQuery("#spbc_dialog").append(s)}jQuery("#spbc_dialog").append(a.printf("","")),jQuery("#spbc_dialog div").last().remove()}}else jQuery("#spbc_dialog").append('<div style="margin:40px;text-align:center;">%s</div>'.printf(n.content)),t=()=>{document.location.reload()};let _=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,d=document.documentElement.clientHeight/100*75,u=_<d?"no_scroll":"scroll";jQuery("#spbc_dialog").dialog({modal:!0,title:n.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,show:{effect:"blind",duration:500},draggable:!0,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow=u,jQuery("#spbc_dialog").height("auto"),jQuery(".ui-widget-overlay").on("click",function(){jQuery("#spbc_dialog").dialog("close")})},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()},close:t})}function spbc_scanner_button_file_compare_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_compare",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonFileCompare_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonFileCompare_callback(s,e,t){console.log("FILE_COMPARED");var n='<div class="spbc_compare_file_row_wrapper"><p class="spbc_compare_file_row">%s</p><span class="spbc_compare_file_row_num">%s</span><p class="spbc_compare_file_row">%s</p><br /></div>';jQuery("#spbc_dialog").append(n.printf('<span class="spbc_compare_file_headings">Modified</span>',"Line",'<span class="spbc_compare_file_headings">Original</span>'));for(var o=1;void 0!==s.file[o]||void 0!==s.file_original[o];o++)if(void 0===s.file[o]&&(s.file[o]=""),void 0===s.file_original[o]&&(s.file_original[o]=""),-1!=s.difference.indexOf(o)){for(let e=o-2;e<=o+2;e++)void 0!==s.file[e]&&void 0!==s.file_original[o]&&jQuery("#spbc_dialog").append((o===e?'<div class="spbc_compare_file_row_wrapper" style="background: rgba(200,40,40,0.8);"><p class="spbc_compare_file_row">%s</p><span class="spbc_compare_file_row_num">%s</span><p class="spbc_compare_file_row">%s</p><br /></div>':n).printf(s.file[e]||"",e,s.file_original[e]||""));jQuery("#spbc_dialog").append(n.printf("","",""))}var a=19*jQuery("#spbc_dialog div").length+19,c=document.documentElement.clientHeight/100*75,r=a<c?"no_scroll":"scroll",i="scroll"==r?c:a;jQuery("#spbc_dialog").dialog({modal:!0,title:s.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,height:i,show:{effect:"blind",duration:500},draggable:!0,resizable:!0,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){document.body.style.overflow="hidden",e.target.style.overflow=r,jQuery("#spbc_dialog").height(i)},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}})}function spbc_scanner__reload_scan_info(){jQuery(".spbc_hint__last_scan_title").text(spbcScaner.look_below_for_scan_res);spbc_sendAJAXRequest({action:"spbc_scanner__last_scan_info"},{callback:e=>{document.getElementById("spbc_scanner__last_scan_info").innerText=e.data}})}function spbc_scanner_file_monitoring_show_current_snapshot(e){var e=jQuery(e),s=e.parents(".row-actions").attr("uid");const t=e.closest(".column-path").find(".title").text(),n=jQuery("[data-remodal-id=spbc-file-monitoring-modal]");n.remodal().open();e={action:"spbc_file_monitoring_show_snapshots",file_id:s,security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success&&(n.find("#spbc-fm-snapshot-list ul").remove(),n.find("#spbc-fm-snapshot-file-name").text(t),drawSnapshotList(e.data,n),drawCurrentSnapshot(e.data[0].id,n))}})}function drawSnapshotList(e,s){let t="";for(var n of e)t+=`<li data-spanshot-id="${n.id}">${n.created_at}</li>`;e=`<ul>
     1function spbc_popup_tip___show(e){function s(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_popup_tip--wrapper").length&&!jQuery(e.target).hasClass("spbc_popup_tip--icon---cancel")||jQuery(e.target).hasClass("spbc_popup_tip--icon---show"))||(jQuery(".spbc_popup_tip--wrapper").hide(),jQuery(document).off("click",s))}var t=e.attr("spbc_tip_title")||null,n=e.attr("spbc_tip_text")||null,o=(s(),e.after("<div class='spbc_popup_tip--wrapper'></div>"),jQuery(".spbc_popup_tip--wrapper"));o.empty().append("<div class='spbc_popup_tip--angle'></div>").css({top:e.position().top-2,left:e.position().left+25}),o.append("<i class='spbc_popup_tip--icon---cancel icon-cancel'></i>").append("<h3 class='spbc_popup_tip--title'>"+t+"</h3>").append("<p class='spbc_popup_tip--text'>"+n+"</p>"),jQuery(document).on("click",s),e.parents("tr").on("mouseout",s)}function spbc_scanner_button_file_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_view",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_analysis_log_delete_from_log(e){let t=[];var s=jQuery(e);let n;if(jQuery(e).hasClass("tbl-row_action"))t.push(s.parents(".row-actions").attr("uid")),n=s.parent().siblings(".tbl-preloader--tiny");else{e=s.closest("#spbc_tbl__scanner_analysis_log").find(".cb-select:checked");if(0===e.length)return void alert("Please, select elements.");e.each(function(e,s){s=jQuery(s).val();t.push(s)}),n=s.children(".tbl-preloader--small")}e={action:"spbc_scanner_analysis_log_delete_from_log",file_ids:t},s={spinner:n,callback:function(){window.location.reload()}};spbc_sendAJAXRequest(e,s)}function spbc_scanner_button_page_view_event(e){var e=jQuery(e),s={action:"spbc_scanner_page_view",page_url:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonView_callback,errorOutput:function(e){spbcModal.open().putError(e)}},t=jQuery("#wpwrap"),n=jQuery("#spbc_dialog"),o=(n.dialog({modal:!0,title:"Loading..",position:{my:"center top",at:"center top+100px",of:window},width:t.width()/100*90,show:{effect:"blind",duration:500},draggable:!1,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow="auto",jQuery("#spbc_dialog").height(document.documentElement.clientHeight/100*25)},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}}),n.append('<img id="spbc_file_view_preloader" alt="Wait for downloading" class="spbc_preloader" src="../../wp-content/plugins/security-malware-firewall/images/preloader2.gif" style="display: block; position: absolute; ">'),jQuery("#spbc_file_view_preloader")),t=4e-4*t.width();o.height(128*t),o.width(128*t),o.css({left:n.width()/2-128*t/2}),o.css({top:n.height()/2-128*t/2}),spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonView_callback(e){var s,t=jQuery("#spbc_dialog");t.empty(),jQuery("#spbc_file_view_preloader").css({display:"none"});for(s in e.file)t.append('<div class="spbc_view_file_row_wrapper"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row">%s</p><br /></div>'.printf(s,e.file[s]));let n=19*Object.keys(e.file).length<76?76:19*Object.keys(e.file).length,o=document.documentElement.clientHeight/100*75,a=n<o?"hidden":"scroll",c="scroll"==a?o:n;t.css({height:c,overflow:a}),t.dialog({modal:!0,title:"Loaded: "+e.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,show:{effect:"blind",duration:500},draggable:!0,resizable:!1,height:c,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow=a,jQuery("#spbc_dialog").height(c),jQuery(".ui-widget-overlay").on("click",function(){jQuery("#spbc_dialog").dialog("close")})},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}}),console.log("FILE_VIEWED")}function spbc_scanner_button_file_view_bad_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_view",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonViewBadFile_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scanner_button_page_view_bad_event(e){var e=jQuery(e),s={action:"spbc_scanner_page_view",page_url:e.parent().attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonViewBad_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonViewBadFile_callback(s,e,t){console.log("FILE_VIEWED_BAD_CODE_FILE"),console.log(arguments),jQuery("#spbc_dialog").empty();var n,o,a,c='<div class="spbc_view_file_row_wrapper"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row">%s</p><br /></div>',r=[],i=[];for(o in s.weak_spots=JSON.parse(s.weak_spots),s.weak_spots)r[o]=Object.keys(s.weak_spots[o]);for(key in n=Object.keys(r).sort())i[n[key]]=r[n[key]];for(a in i){var l,p="spbc-dialog-row-header-"+a.toLowerCase(),_='<span id="'+p+'" style="text-align: center"><b>'+a+" weakspots:</b></span>",d=jQuery("#spbc_dialog"),_=(d.append(c.printf("",_)),d.append(c.printf("<b>...</b>","<b>...</b>")),d.find("#"+p));for(l in _.parent().parent().css("text-align","center"),_.parent().parent().css("border","1px dotted"),_.parent().parent().css("background","darkgrey"),r[a]){l=[...new Set(l)].sort();var u=+r[a][l];for(let e=u-2;e<=2+u;e++)void 0!==s.file[e]&&d.append((u===e?'<div class="spbc_view_file_row_wrapper" style="background: rgba(200,40,40,0.8);"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row">%s</p><br /></div>':c).printf(e,s.file[e]));d.append(c.printf("<b>...</b>","<b>...</b>"))}}jQuery("#spbc_dialog div").last().remove();let b=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,f=document.documentElement.clientHeight/100*75,g=b<f?"no_scroll":"scroll",y="scroll"==g?f:b;jQuery("#spbc_dialog").dialog({modal:!0,title:s.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,show:{effect:"blind",duration:500},draggable:!0,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow=g,jQuery("#spbc_dialog").height(y),jQuery(".ui-widget-overlay").on("click",function(){jQuery("#spbc_dialog").dialog("close")})},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}})}function spbc_scannerButtonViewBad_callback(n,e,s){console.log("FILE_VIEWED_BAD_CODE"),console.log(arguments);let t=()=>{};if(1==n.success){console.log(n);var o,a='<div class="spbc_view_file_row_wrapper"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row" style="word-break: break-all">%s</p><br /></div>',c=[];for(o in n.weak_spots=JSON.parse(n.weak_spots),n.weak_spots)c=c.concat(Object.keys(n.weak_spots[o]));var r,c=[...new Set(c)].sort(),i=new Map(Object.entries(n.weak_spots.CRITICAL));for(r in c)if(0!=r||!i.get(c[r]).toLowerCase().includes("doctype")){var l=+c[r];for(let t=l-2;t<=2+l;t++)if(void 0!==n.file[t]){var p=l===t;let e,s;e=p?'<div class="spbc_view_file_row_wrapper" style="background: rgb(200,120,120);"><span class="spbc_view_file_row_num">%s</span><p class="spbc_view_file_row" style="word-break: break-all">%s</p><br /></div>':a,s=p&&!n.file[t].includes("iframe")?e.printf(t,i.get(c[r])):e.printf(t,n.file[t]),jQuery("#spbc_dialog").append(s)}jQuery("#spbc_dialog").append(a.printf("","")),jQuery("#spbc_dialog div").last().remove()}}else jQuery("#spbc_dialog").append('<div style="margin:40px;text-align:center;">%s</div>'.printf(n.content)),t=()=>{document.location.reload()};let _=19*jQuery("#spbc_dialog div").length<76?76:19*jQuery("#spbc_dialog div").length,d=document.documentElement.clientHeight/100*75,u=_<d?"no_scroll":"scroll";jQuery("#spbc_dialog").dialog({modal:!0,title:n.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,show:{effect:"blind",duration:500},draggable:!0,resizable:!1,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){e.target.style.overflow=u,jQuery("#spbc_dialog").height("auto"),jQuery(".ui-widget-overlay").on("click",function(){jQuery("#spbc_dialog").dialog("close")})},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()},close:t})}function spbc_scanner_button_file_compare_event(e){var e=jQuery(e),s={action:"spbc_scanner_file_compare",file_id:e.parents(".row-actions").attr("uid")},e={spinner:e.parent().siblings(".tbl-preloader--tiny"),callback:spbc_scannerButtonFileCompare_callback,errorOutput:function(e){spbcModal.open().putError(e)}};spbc_sendAJAXRequest(s,e)}function spbc_scannerButtonFileCompare_callback(s,e,t){console.log("FILE_COMPARED");var n='<div class="spbc_compare_file_row_wrapper"><p class="spbc_compare_file_row">%s</p><span class="spbc_compare_file_row_num">%s</span><p class="spbc_compare_file_row">%s</p><br /></div>';jQuery("#spbc_dialog").append(n.printf('<span class="spbc_compare_file_headings">Modified</span>',"Line",'<span class="spbc_compare_file_headings">Original</span>'));for(var o=1;void 0!==s.file[o]||void 0!==s.file_original[o];o++)if(void 0===s.file[o]&&(s.file[o]=""),void 0===s.file_original[o]&&(s.file_original[o]=""),-1!=s.difference.indexOf(o)){for(let e=o-2;e<=o+2;e++)void 0!==s.file[e]&&void 0!==s.file_original[o]&&jQuery("#spbc_dialog").append((o===e?'<div class="spbc_compare_file_row_wrapper" style="background: rgba(200,40,40,0.8);"><p class="spbc_compare_file_row">%s</p><span class="spbc_compare_file_row_num">%s</span><p class="spbc_compare_file_row">%s</p><br /></div>':n).printf(s.file[e]||"",e,s.file_original[e]||""));jQuery("#spbc_dialog").append(n.printf("","",""))}var a=19*jQuery("#spbc_dialog div").length+19,c=document.documentElement.clientHeight/100*75,r=a<c?"no_scroll":"scroll",i="scroll"==r?c:a;jQuery("#spbc_dialog").dialog({modal:!0,title:s.file_path,position:{my:"center top",at:"center top+100px",of:window},width:jQuery("#wpwrap").width()/100*90,height:i,show:{effect:"blind",duration:500},draggable:!0,resizable:!0,closeText:"X",classes:{"ui-dialog":"spbc---top"},open:function(e,s){document.body.style.overflow="hidden",e.target.style.overflow=r,jQuery("#spbc_dialog").height(i)},beforeClose:function(e,s){document.body.style.overflow="auto",jQuery("#spbc_dialog").empty()}})}function spbc_scanner__reload_scan_info(){jQuery(".spbc_hint__last_scan_title").text(spbcScaner.look_below_for_scan_res);spbc_sendAJAXRequest({action:"spbc_scanner__last_scan_info"},{callback:e=>{document.getElementById("spbc_scanner__last_scan_info").innerText=e.data}})}function spbc_scanner_file_monitoring_show_current_snapshot(e){var e=jQuery(e),s=e.parents(".row-actions").attr("uid");const t=e.closest(".column-path").find(".title").text(),n=jQuery("[data-remodal-id=spbc-file-monitoring-modal]");n.remodal().open();e={action:"spbc_file_monitoring_show_snapshots",file_id:s,security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success&&(n.find("#spbc-fm-snapshot-list ul").remove(),n.find("#spbc-fm-snapshot-file-name").text(t),drawSnapshotList(e.data,n),drawCurrentSnapshot(e.data[0].id,n))}})}function drawSnapshotList(e,s){let t="";for(var n of e)t+=`<li data-spanshot-id="${n.id}">${n.created_at}</li>`;e=`<ul>
    22            ${t}
    33        </ul>`;s.find("#spbc-fm-snapshot-list").append(e)}function drawCurrentSnapshot(s,t){var e={action:"spbc_file_monitoring_show_current_snapshot",snapshot_id:s,security:spbcSettings.ajax_nonce};jQuery.ajax({type:"POST",async:!0,url:spbcSettings.ajaxurl,data:e,beforeSend:function(){jQuery("#spbc-file-monitoring-modal-preloader").show()},success:function(e){e.success&&(t.find("#spbc-fm-snapshot-view .wrap").remove(),t.find("[data-spanshot-id").removeClass("active"),t.find("[data-spanshot-id="+s+"]").addClass("active"),e=`<div class="wrap">
  • security-malware-firewall/trunk/js/spbc-settings_tab--scanner.min.js.map

    r2998673 r3022805  
    1 {"version":3,"file":"spbc-settings_tab--scanner.min.js","sources":["spbc-settings_tab--scanner.js"],"sourcesContent":["function spbc_popup_tip___show(show_icon){\n\n\tvar tip_title = show_icon.attr('spbc_tip_title') || null;\n\tvar\ttip_text  = show_icon.attr('spbc_tip_text')  || null;\n\tvar remove_desc_func = function(e){\n\n\t\tif(\n\t\t\ttypeof e === 'undefined' ||\n\t\t\t(\n\t\t\t\t(jQuery(e.target).parent('.spbc_popup_tip--wrapper').length == 0 || jQuery(e.target).hasClass('spbc_popup_tip--icon---cancel')) &&\n\t\t\t\t!jQuery(e.target).hasClass('spbc_popup_tip--icon---show')\n\t\t\t)\n\t\t){\n\t\t\tjQuery('.spbc_popup_tip--wrapper').hide();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tshow_icon.after(\"<div class='spbc_popup_tip--wrapper'></div>\");\n\n\tvar obj = jQuery('.spbc_popup_tip--wrapper');\n\n\tobj.empty()\n\t\t.append(\"<div class='spbc_popup_tip--angle'></div>\")\n\t\t.css({\n\t\t\ttop: show_icon.position().top - 2,\n\t\t\tleft: show_icon.position().left + 25\n\t\t});\n\tobj.append(\"<i class='spbc_popup_tip--icon---cancel icon-cancel'></i>\")\n\t\t.append(\"<h3 class='spbc_popup_tip--title'>\" + tip_title + \"</h3>\")\n\t\t.append(\"<p class='spbc_popup_tip--text'>\" + tip_text + \"</p>\");\n\n\tjQuery(document).on('click', remove_desc_func);\n\tshow_icon.parents('tr').on('mouseout', remove_desc_func);\n}\n\nfunction spbc_scanner_button_file_view_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_view',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonView_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Delete file from analysis log\n */\nfunction spbc_scanner_analysis_log_delete_from_log(obj) {\n\n\tlet fileIds = [];\n\tconst self = jQuery(obj);\n\tlet spinner;\n\n\tif ( jQuery(obj).hasClass('tbl-row_action') ) {\n\t\tfileIds.push(self.parents('.row-actions').attr('uid'));\n\t\tspinner = self.parent().siblings('.tbl-preloader--tiny');\n\t} else {\n\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select:checked');\n\t\tif (selectedItems.length === 0) {\n\t\t\talert('Please, select elements.');\n\t\t\treturn;\n\t\t}\n\n\t\tselectedItems.each(function (index, element) {\n\t\t\tconst elementId = jQuery(element).val();\n\t\t\tfileIds.push(elementId);\n\t\t});\n\t\tspinner = self.children('.tbl-preloader--small');\n\t}\n\n\tconst data = {\n\t\taction: 'spbc_scanner_analysis_log_delete_from_log',\n\t\tfile_ids: fileIds,\n\t};\n\n\tvar params = {\n\t\tspinner: spinner,\n\t\tcallback: function() { window.location.reload(); },\n\t};\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonView_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\n\tlet wp_wrap = jQuery('#wpwrap')\n\tlet dialog_window = jQuery('#spbc_dialog')\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: 'Loading..',\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(wp_wrap.width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: false,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').height((document.documentElement.clientHeight) / 100 * 25);\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t})\n\n\tdialog_window.append('<img id=\"spbc_file_view_preloader\" alt=\"Wait for downloading\" ' +\n\t\t'class=\"spbc_preloader\" ' +\n\t\t'src=\"../../wp-content/plugins/security-malware-firewall/images/preloader2.gif\" ' +\n\t\t'style=\"' +\n\t\t'display: block; ' +\n\t\t'position: absolute; ' +\n\t\t'\">')\n\n\tlet spinner = jQuery('#spbc_file_view_preloader')\n\tlet size_multiplier = (wp_wrap.width() * 0.0004)\n\n\tspinner.height(128 * size_multiplier)\n\tspinner.width(128 * size_multiplier)\n\tspinner.css({left: dialog_window.width()/2 - (128 * size_multiplier / 2)})\n\tspinner.css({top: dialog_window.height()/2 - (128 * size_multiplier / 2)})\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonView_callback(result){\n\n\tlet dialog_window = jQuery('#spbc_dialog')\n\tdialog_window.empty();\n\n\tjQuery('#spbc_file_view_preloader').css({display:'none'})\n\n\tlet row_template = '<div class=\"spbc_view_file_row_wrapper\"><span class=\"spbc_view_file_row_num\">%s</span><p class=\"spbc_view_file_row\">%s</p><br /></div>';\n\n\tfor(let row in result.file){\n\t\tdialog_window.append(row_template.printf(row, result.file[row]));\n\t}\n\n\tlet content_height = Object.keys(result.file).length * 19 < 76 ? 76 : Object.keys(result.file).length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow       = content_height < visible_height ? 'hidden' : 'scroll',\n\t\theight         = overflow === 'scroll' ? visible_height : content_height;\n\n\tdialog_window.css({\n\t\theight: height,\n\t\toverflow: overflow\n\t})\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: ('Loaded: ' + result.file_path),\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() {\n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close');\n\t\t\t});\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t});\n\n\tconsole.log('FILE_VIEWED');\n\n}\n\nfunction spbc_scanner_button_file_view_bad_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_view',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonViewBadFile_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_bad_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parent().attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonViewBad_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonViewBadFile_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE_FILE');\n\tconsole.log(arguments);\n\tjQuery('#spbc_dialog').empty();\n\n\tvar row_template     = '<div class=\"spbc_view_file_row_wrapper\"><span class=\"spbc_view_file_row_num\">%s</span><p class=\"spbc_view_file_row\">%s</p><br /></div>',\n\t\trow_template_bad = '<div class=\"spbc_view_file_row_wrapper\" style=\"background: rgba(200,40,40,0.8);\"><span class=\"spbc_view_file_row_num\">%s</span><p class=\"spbc_view_file_row\">%s</p><br /></div>',\n\t\tseverity_parts = [],\n\t\tseverity_parts_sorted = [],\n\t\tseverity_keys_sorted = [];\n\n\tresult.weak_spots = JSON.parse(result.weak_spots)\n\tfor(let severity in result.weak_spots){\n\t\tseverity_parts[severity] = Object.keys(result.weak_spots[severity])\n\t}\n\n\tseverity_keys_sorted = Object.keys(severity_parts).sort();\n\n\tfor(key in severity_keys_sorted){\n\t\tseverity_parts_sorted[severity_keys_sorted[key]] = severity_parts[severity_keys_sorted[key]]\n\t}\n\n\tfor (let severity_part in severity_parts_sorted) {\n\t\tlet header_name = 'spbc-dialog-row-header-' + severity_part.toLowerCase();\n\t\tlet header_html = '<span id=\"' + header_name + '\" style=\"text-align: center\"><b>' + severity_part + ' weakspots:</b></span>';\n\t\tconst dialog = jQuery('#spbc_dialog');\n\n\t\tdialog.append(row_template.printf('',header_html));\n\t\tdialog.append(row_template.    printf('<b>...</b>','<b>...</b>'));\n\n\t\tlet header = dialog.find('#' + header_name);\n\t\theader.parent().parent().css('text-align', 'center');\n\t\theader.parent().parent().css('border', '1px dotted');\n\t\theader.parent().parent().css('background', 'darkgrey');\n\n\t\tfor(let str_num in severity_parts[severity_part]){\n\t\t\t// Sort bad line\n\t\t\tstr_num = [...new Set(str_num)].sort()\n\n\t\t\tlet row = +severity_parts[severity_part][str_num],\n\t\t\t\tdisplay_depth = 2;\n\n\t\t\t// Display only existing lines of file\n\t\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\t\tdialog.append((row === curr_row ? row_template_bad : row_template).printf(curr_row, result.file[curr_row]));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Placing an empty string between results\n\t\t\tdialog.append(row_template.    printf('<b>...</b>','<b>...</b>'));\n\t\t}\n\t}\n\n\t// Removing last empty string\n\tjQuery('#spbc_dialog div').last().remove();\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow       = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight         = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() {\n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close');\n\t\t\t});\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t});\n}\n\nfunction spbc_scannerButtonViewBad_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE');\n\n\tconsole.log(arguments);\n\n\tlet afterClose = () => {};\n\n\tif ( result.success == true ) {\n\t\tconsole.log(result);\n\t\tvar row_template     = '<div class=\"spbc_view_file_row_wrapper\">' +\n\t\t\t\t'<span class=\"spbc_view_file_row_num\">%s</span>' +\n\t\t\t\t'<p class=\"spbc_view_file_row\" style=\"word-break: break-all\">%s</p>' +\n\t\t\t\t'<br /></div>',\n\t\t\trow_template_bad = '<div class=\"spbc_view_file_row_wrapper\" style=\"background: rgb(200,120,120);\">' +\n\t\t\t\t'<span class=\"spbc_view_file_row_num\">%s</span>' +\n\t\t\t\t'<p class=\"spbc_view_file_row\" style=\"word-break: break-all\">%s</p>' +\n\t\t\t\t'<br /></div>',\n\t\t\tstr_nums = [];\n\n\t\tresult.weak_spots = JSON.parse(result.weak_spots);\n\t\tfor(let severity in result.weak_spots){\n\t\t\tstr_nums = str_nums.concat(Object.keys(result.weak_spots[severity]));\n\t\t}\n\n\t\tstr_nums = [...new Set(str_nums)].sort(); // Sort bad line\n\t\t//get a map of bad strings\n\t\tlet bad_strings_map = new Map(Object.entries(result.weak_spots.CRITICAL)) //TODO: Probably there can get something else except CRITICAL in the future\n\t\tfor(let str_num in str_nums){\n\t\t\tif (str_num == 0 && bad_strings_map.get(str_nums[str_num]).toLowerCase().includes('doctype')) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet row = +str_nums[str_num],\n\t\t\t\tdisplay_depth = 2;\n\n\t\t\t// Display only existing lines of file\n\t\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\t\tlet is_bad_string = (row === curr_row)\n\t\t\t\t\tlet unformatted_row\n\t\t\t\t\tlet highlited_row\n\t\t\t\t\tif (is_bad_string){\n\t\t\t\t\t\tunformatted_row = row_template_bad\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunformatted_row = row_template\n\t\t\t\t\t}\n\t\t\t\t\tif (is_bad_string && !result.file[curr_row].includes('iframe')){\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, bad_strings_map.get(str_nums[str_num]));\n\t\t\t\t\t} else {\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, result.file[curr_row]);\n\t\t\t\t\t}\n\t\t\t\t\tjQuery('#spbc_dialog').append(highlited_row);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Placing an empty string between results\n\t\t\tjQuery('#spbc_dialog').append(row_template.    printf('', ''));\n\n\t\t\t// Removing last empty string\n\t\t\tjQuery('#spbc_dialog div').last().remove();\n\t\t}\n\t} else {\n\t\tlet wrapperElement = '<div style=\"margin:40px;text-align:center;\">%s</div>'\n\t\tjQuery('#spbc_dialog').append(wrapperElement.printf(result.content));\n\t\tafterClose = () => {document.location.reload();};\n\t}\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\theight         = 'auto',\n\t\toverflow       = content_height < visible_height ? 'no_scroll' : 'scroll';\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() {\n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close');\n\t\t\t});\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t\tclose: afterClose,\n\t});\n}\n\nfunction spbc_scanner_button_file_compare_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_compare',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonFileCompare_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonFileCompare_callback(result, data, params){\n\n\tconsole.log('FILE_COMPARED');\n\n\tlet row_template = '<div class=\"spbc_compare_file_row_wrapper\"><p class=\"spbc_compare_file_row\">%s</p><span class=\"spbc_compare_file_row_num\">%s</span><p class=\"spbc_compare_file_row\">%s</p><br /></div>';\n\tlet row_template_bad = '<div class=\"spbc_compare_file_row_wrapper\" style=\"background: rgba(200,40,40,0.8);\"><p class=\"spbc_compare_file_row\">%s</p><span class=\"spbc_compare_file_row_num\">%s</span><p class=\"spbc_compare_file_row\">%s</p><br /></div>';\n\n\tjQuery('#spbc_dialog').append(row_template.printf('<span class=\"spbc_compare_file_headings\">Modified</span>', 'Line', '<span class=\"spbc_compare_file_headings\">Original</span>'));\n\n\tfor(var row=1, prev = false, next = false; typeof result.file[row] != 'undefined' || typeof result.file_original[row] != 'undefined'; row++){\n\n\t\tif(typeof result.file[row] == 'undefined')          result.file[row] = '';\n\t\tif(typeof result.file_original[row] == 'undefined') result.file_original[row] = '';\n\n\t\t// Display only existing lines of file\n\t\tif(result.difference.indexOf(row) != -1){\n\t\t\tfor(let display_depth = 2, curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' && typeof result.file_original[row] !== 'undefined') {\n\t\t\t\t\tjQuery('#spbc_dialog').append(\n\t\t\t\t\t\t(row === curr_row ? row_template_bad : row_template).printf(\n\t\t\t\t\t\t\tresult.file[curr_row] ? result.file[curr_row] : '',\n\t\t\t\t\t\t\tcurr_row,\n\t\t\t\t\t\t\tresult.file_original[curr_row] ? result.file_original[curr_row] : ''\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tjQuery('#spbc_dialog').append(row_template.    printf('', '', ''));\n\t\t}\n\t}\n\n\tvar content_height = jQuery('#spbc_dialog div').length * 19 + 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\theight: height,\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: true,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t}\n\t});\n}\n\nfunction spbc_scanner__reload_scan_info() {\n\tjQuery('.spbc_hint__last_scan_title').text(spbcScaner.look_below_for_scan_res);\n\tconst data = {\n\t\taction: 'spbc_scanner__last_scan_info'\n\t};\n\tconst params = {\n\t\tcallback: (result) => {\n\t\t\tdocument.getElementById('spbc_scanner__last_scan_info').innerText = result.data;\n\t\t}\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Show snapshots of file\n * @param obj\n */\nfunction spbc_scanner_file_monitoring_show_current_snapshot(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileId = self.parents('.row-actions').attr('uid');\n\tconst file_name = self.closest('.column-path').find('.title').text();\n\n\t// Init and open remodal\n\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\tconst remodalObject = remodal.remodal();\n\tremodalObject.open();\n\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_snapshots',\n\t\tfile_id: fileId,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-list ul').remove();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-file-name').text(file_name);\n\t\t\t\tdrawSnapshotList(result.data, remodal);\n\t\t\t\tdrawCurrentSnapshot(result.data[0].id, remodal);\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n *\n * @param data\n * @param remodal\n */\nfunction drawSnapshotList(data, remodal)\n{\n\tlet list = '';\n\n\tfor (let item of data) {\n\t\tlist += `<li data-spanshot-id=\"${item.id}\">${item.created_at}</li>`;\n\t}\n\n\tlet html =\n\t\t`<ul>\n            ${list}\n        </ul>`;\n\n\tremodal.find('#spbc-fm-snapshot-list').append(html);\n}\n\nfunction drawCurrentSnapshot(snapshot_id, remodal)\n{\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_current_snapshot',\n\t\tsnapshot_id,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tbeforeSend: function() {\n\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').show();\n\t\t},\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view .wrap').remove();\n\t\t\t\tremodal.find('[data-spanshot-id').removeClass('active');\n\t\t\t\tremodal.find('[data-spanshot-id=' + snapshot_id + ']').addClass('active');\n\n\t\t\t\tlet html =\n\t\t\t\t\t`<div class=\"wrap\">\n                        <pre>\n                            <code>\n                                ${result.data.content}\n                            </code>\n                        </pre>\n                    </div>`;\n\n\t\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').hide();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view').append(html);\n\t\t\t\tdocument.querySelectorAll('pre code').forEach((el) => {\n\t\t\t\t\thljs.highlightElement(el);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Cure file\n * @param obj\n */\nfunction spbc_scanner_button_cure_file_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_file_cure_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Restore file from backup\n * @param obj\n */\nfunction spbc_scanner_button_restore_from_backup_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_restore_file_from_backup_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Clear scan results\n */\nfunction spbc_scanner_button_clear_scan_results()\n{\n\tif( ! confirm('Do you confirm to clear the scan results?') )\n\t\treturn;\n\n\tconsole.log('CLEAR');\n\n\tspbc_sendAJAXRequest(\n\t\t{ action: 'spbc_scanner_clear', },\n\t\t{\n\t\t\ttype: 'GET',\n\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\tcomplete: null,\n\t\t\terrorOutput: null,\n\t\t\tcontext: this,\n\t\t\ttimeout: 40000,\n\t\t\tsuccess: function() {\n\t\t\t\tdocument.location.reload();\n\t\t\t},\n\t\t},\n\t);\n}\n\njQuery(document).ready(function(){\n\n\t// EVENT HADLING\n\tspbc_tbl__bulk_actions__listen(); // Table. Row bulk handler\n\tspbc_tbl__row_actions__listen();  // Table. Row actions handler\n\tspbc_tbl__pagination__listen();   // Table. Pagination handler\n\tspbc_tbl__sort__listen();         // Table. Sort handler\n\n\tspbcStartShowHide();\n\n\t// Preparing progressbar\n\tjQuery('#spbc_scaner_progress_bar').progressbar({\n\t\tvalue: 0,\n\t\tcreate: function( event, ui ) {\n\t\t\tevent.target.style.position = 'relative';\n\t\t\tevent.target.style.marginBottom = '12px';\n\t\t},\n\t\tchange: function(event, ui){\n\t\t\tjQuery('.spbc_progressbar_counter span').text(jQuery(event.target).progressbar('option', 'value') + ' %');\n\t\t},\n\t});\n\n\t// Preparing accordion\n\tjQuery('#spbc_scan_accordion').accordion({\n\t\theader: \"h3\",\n\t\theightStyle: 'content',\n\t\tcollapsible: true,\n\t\tactive: false,\n\t\tactivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 0 && ui.oldHeader.length === 0 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom spbc-overflow--visible\");\n\t\t},\n\t\tbeforeActivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 1 && ui.oldHeader.length === 1 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom\");\n\t\t}\n\t});\n\n\t// Init scanner plugin\n\twindow.spbc_scanner = new spbcMalwareScanner({\n\t\tsettings: spbcScaner.settings,\n\t\tstates: spbcScaner.states,\n\t\tbutton: jQuery('#spbc_perform_scan'),\n\t\tspinner: jQuery('#spbc_perform_scan').next(),\n\t\tcallback: null,\n\t\tprogress_overall: jQuery('#spbc_scaner_progress_overall'),\n\t\tprogressbar: jQuery('#spbc_scaner_progress_bar'),\n\t\tprogressbar_text: jQuery('.spbc_progressbar_counter span'),\n\t\twrapper: document.getElementsByClassName('spbc_unchecked_file_list'),\n\t\twarnings: {\n\t\t\tlong_scan: jQuery('.spbc_hint_warning__long_scan'),\n\t\t\toutdated:  jQuery('.spbc_hint_warning__outdated')\n\t\t}\n\t});\n\n\tjQuery(document).on('click', '.spbc_popup_tip--icon---show', function(){\n\t\tspbc_popup_tip___show( jQuery( this ) );\n\t});\n\n\tjQuery('#spbc_perform_scan').on('click', function(){\n\t\tjQuery('#spbcscan-results-log-module').remove();\n\t\tspbc_scanner.actionControl();\n\n\t\tif (!jQuery(\".spbc_log-wrapper .panel-body\").length) {\n\t\t\tjQuery(\".spbc_log-wrapper\").append('<div class=\"panel-body\"></div>');\n\t\t}\n\n\t\tjQuery(\".spbc_log-wrapper\").resizable({\n\t\t\thandles: 'n, s',\n\t\t\tcontainment: 'document',\n\t\t});\n\t});\n\n\tjQuery(\"#spbcscan-results-log-module\").resizable({\n\t\thandles: 'n, s',\n\t\tcontainment: 'document',\n\t});\n\n\t// Clear scanner's tables\n\tjQuery('#spbc_scanner_clear').on('click', function(){\n\n\t\tif( ! confirm('Do you confirm to clear the scan results?') )\n\t\t\treturn;\n\n\t\tconsole.log('CLEAR');\n\n\t\tspbc_sendAJAXRequest(\n\t\t\t{ action: 'spbc_scanner_clear', },\n\t\t\t{\n\t\t\t\ttype: 'GET',\n\t\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\t\tcomplete: null,\n\t\t\t\terrorOutput: null,\n\t\t\t\tcontext: this,\n\t\t\t\ttimeout: 40000,\n\t\t\t\tsuccess: function() {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t});\n\n\tjQuery('#spbc_scanner_save_to_pdf').on('click', function(){\n\t\tjQuery.ajax({\n\t\t\turl: spbcSettings.ajaxurl,\n\t\t\ttype: 'POST',\n\t\t\tdata: {\n\t\t\t\taction: 'spbc_scanner_save_to_pdf',\n\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\tno_cache: Math.random()\n\t\t\t},\n\t\t\txhrFields: {\n\t\t\t\tresponseType: 'blob'\n\t\t\t},\n\t\t\tsuccess: function(data) {\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\turl: spbcSettings.ajaxurl,\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\taction: 'spbc_scanner_get_pdf_file_name',\n\t\t\t\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\t\t\t\tno_cache: Math.random()\n\t\t\t\t\t\t},\n\t\t\t\t\t\txhrFields: {\n\t\t\t\t\t\t\tresponseType: 'text'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(filename) {\n\t\t\t\t\t\t\tlet blob=new Blob([data]);\n\t\t\t\t\t\t\tlet link=document.createElement('a');\n\t\t\t\t\t\t\tlink.href=window.URL.createObjectURL(blob);\n\t\t\t\t\t\t\tlink.download=filename.data;\n\t\t\t\t\t\t\tlink.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t});\n\t});\n\n\t// Select snapshot\n\tjQuery(document).on('click', '.spbc-fm-snapshot-list [data-spanshot-id]', function() {\n\t\tconst currentSnapshotId = jQuery(this).data('spanshot-id');\n\t\tconst activeSnapshotId = jQuery('.spbc-fm-snapshot-list [data-spanshot-id].active').data('spanshot-id');\n\n\t\tif (currentSnapshotId === activeSnapshotId) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\t\tdrawCurrentSnapshot(currentSnapshotId, remodal)\n\t});\n});\n"],"names":["spbc_popup_tip___show","show_icon","remove_desc_func","e","jQuery","target","parent","length","hasClass","hide","document","off","tip_title","attr","tip_text","obj","after","empty","append","css","top","position","left","on","parents","spbc_scanner_button_file_view_event","self","data","action","file_id","params","spinner","siblings","callback","spbc_scannerButtonView_callback","errorOutput","msg","spbcModal","open","putError","spbc_sendAJAXRequest","spbc_scanner_analysis_log_delete_from_log","let","fileIds","push","selectedItems","closest","find","alert","each","index","element","elementId","val","children","file_ids","window","location","reload","spbc_scanner_button_page_view_event","page_url","wp_wrap","dialog_window","dialog","modal","title","my","at","of","width","show","effect","duration","draggable","resizable","closeText","classes","ui-dialog","event","ui","style","overflow","height","documentElement","beforeClose","body","size_multiplier","result","row","display","file","printf","content_height","Object","keys","visible_height","file_path","console","log","spbc_scanner_button_file_view_bad_event","spbc_scannerButtonViewBadFile_callback","spbc_scanner_button_page_view_bad_event","spbc_scannerButtonViewBad_callback","arguments","severity_keys_sorted","severity","severity_part","row_template","severity_parts","severity_parts_sorted","weak_spots","JSON","parse","key","sort","str_num","header_name","toLowerCase","header_html","header","Set","curr_row","last","remove","afterClose","success","str_nums","concat","bad_strings_map","Map","entries","CRITICAL","get","includes","is_bad_string","unformatted_row","highlited_row","content","close","spbc_scanner_button_file_compare_event","spbc_scannerButtonFileCompare_callback","file_original","difference","indexOf","spbc_scanner__reload_scan_info","text","spbcScaner","look_below_for_scan_res","getElementById","innerText","spbc_scanner_file_monitoring_show_current_snapshot","fileId","file_name","remodal","security","spbcSettings","ajax_nonce","ajax","type","async","url","ajaxurl","drawSnapshotList","drawCurrentSnapshot","id","list","item","created_at","html","snapshot_id","beforeSend","removeClass","addClass","querySelectorAll","forEach","hljs","highlightElement","el","spbc_scanner_button_cure_file_ajax_handler","file_fast_hash","put","addEventListener","spbc_scanner_button_restore_from_backup_ajax_handler","spbc_scanner_button_clear_scan_results","confirm","successCallback","complete","context","this","timeout","ready","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","progressbar","value","create","marginBottom","change","accordion","heightStyle","collapsible","active","activate","oldPanel","oldHeader","beforeActivate","spbc_scanner","spbcMalwareScanner","settings","states","button","next","progress_overall","progressbar_text","wrapper","getElementsByClassName","warnings","long_scan","outdated","actionControl","handles","containment","no_cache","Math","random","xhrFields","responseType","filename","blob","Blob","link","createElement","href","URL","createObjectURL","download","click","currentSnapshotId"],"mappings":"AAAA,SAASA,sBAAsBC,GAIP,SAAnBC,EAA4BC,GAGjB,KAAA,IAANA,IAEyD,GAA9DC,OAAOD,EAAEE,MAAM,EAAEC,OAAO,0BAA0B,EAAEC,QAAeH,CAAAA,OAAOD,EAAEE,MAAM,EAAEG,SAAS,+BAA+B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AKnL,OAAOoL,IAAIC,gBAAgBN,CAAI,EACzCE,EAAKK,SAASR,EAAS3M,KACvB8M,EAAKM,MAAM,CACZ,CACD,CACD,CACD,CACD,CAAC,CACF,CAAC,EAGD3O,OAAOM,QAAQ,EAAEa,GAAG,QAAS,4CAA6C,WACzE,IAAMyN,EAAoB5O,OAAOwL,IAAI,EAAEjK,KAAK,aAAa,EAGrDqN,IAFqB5O,OAAO,kDAAkD,EAAEuB,KAAK,aAAa,GAOtGwI,oBAAoB6E,EADJ5O,OAAO,8CAA8C,CACvB,CAC/C,CAAC,CACF,CAAC"}
     1{"version":3,"file":"spbc-settings_tab--scanner.min.js","sources":["spbc-settings_tab--scanner.js"],"sourcesContent":["function spbc_popup_tip___show(show_icon){\n\n\tvar tip_title = show_icon.attr('spbc_tip_title') || null;\n\tvar\ttip_text  = show_icon.attr('spbc_tip_text')  || null;\n\tvar remove_desc_func = function(e){\n\n\t\tif(\n\t\t\ttypeof e === 'undefined' ||\n\t\t\t(\n\t\t\t\t(jQuery(e.target).parent('.spbc_popup_tip--wrapper').length == 0 || jQuery(e.target).hasClass('spbc_popup_tip--icon---cancel')) &&\n\t\t\t\t!jQuery(e.target).hasClass('spbc_popup_tip--icon---show')\n\t\t\t)\n\t\t){\n\t\t\tjQuery('.spbc_popup_tip--wrapper').hide();\n\t\t\tjQuery(document).off('click', remove_desc_func);\n\t\t}\n\t};\n\n\tremove_desc_func();\n\n\tshow_icon.after(\"<div class='spbc_popup_tip--wrapper'></div>\");\n\n\tvar obj = jQuery('.spbc_popup_tip--wrapper');\n\n\tobj.empty()\n\t\t.append(\"<div class='spbc_popup_tip--angle'></div>\")\n\t\t.css({\n\t\t\ttop: show_icon.position().top - 2,\n\t\t\tleft: show_icon.position().left + 25\n\t\t});\n\tobj.append(\"<i class='spbc_popup_tip--icon---cancel icon-cancel'></i>\")\n\t\t.append(\"<h3 class='spbc_popup_tip--title'>\" + tip_title + \"</h3>\")\n\t\t.append(\"<p class='spbc_popup_tip--text'>\" + tip_text + \"</p>\");\n\n\tjQuery(document).on('click', remove_desc_func);\n\tshow_icon.parents('tr').on('mouseout', remove_desc_func);\n}\n\nfunction spbc_scanner_button_file_view_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_view',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonView_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Delete file from analysis log\n */\nfunction spbc_scanner_analysis_log_delete_from_log(obj) {\n\n\tlet fileIds = [];\n\tconst self = jQuery(obj);\n\tlet spinner;\n\n\tif ( jQuery(obj).hasClass('tbl-row_action') ) {\n\t\tfileIds.push(self.parents('.row-actions').attr('uid'));\n\t\tspinner = self.parent().siblings('.tbl-preloader--tiny');\n\t} else {\n\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select:checked');\n\t\tif (selectedItems.length === 0) {\n\t\t\talert('Please, select elements.');\n\t\t\treturn;\n\t\t}\n\n\t\tselectedItems.each(function (index, element) {\n\t\t\tconst elementId = jQuery(element).val();\n\t\t\tfileIds.push(elementId);\n\t\t});\n\t\tspinner = self.children('.tbl-preloader--small');\n\t}\n\n\tconst data = {\n\t\taction: 'spbc_scanner_analysis_log_delete_from_log',\n\t\tfile_ids: fileIds,\n\t};\n\n\tvar params = {\n\t\tspinner: spinner,\n\t\tcallback: function() { window.location.reload(); },\n\t};\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonView_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\n\tlet wp_wrap = jQuery('#wpwrap')\n\tlet dialog_window = jQuery('#spbc_dialog')\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: 'Loading..',\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(wp_wrap.width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: false,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').height((document.documentElement.clientHeight) / 100 * 25);\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t})\n\n\tdialog_window.append('<img id=\"spbc_file_view_preloader\" alt=\"Wait for downloading\" ' +\n\t\t'class=\"spbc_preloader\" ' +\n\t\t'src=\"../../wp-content/plugins/security-malware-firewall/images/preloader2.gif\" ' +\n\t\t'style=\"' +\n\t\t'display: block; ' +\n\t\t'position: absolute; ' +\n\t\t'\">')\n\n\tlet spinner = jQuery('#spbc_file_view_preloader')\n\tlet size_multiplier = (wp_wrap.width() * 0.0004)\n\n\tspinner.height(128 * size_multiplier)\n\tspinner.width(128 * size_multiplier)\n\tspinner.css({left: dialog_window.width()/2 - (128 * size_multiplier / 2)})\n\tspinner.css({top: dialog_window.height()/2 - (128 * size_multiplier / 2)})\n\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonView_callback(result){\n\n\tlet dialog_window = jQuery('#spbc_dialog')\n\tdialog_window.empty();\n\n\tjQuery('#spbc_file_view_preloader').css({display:'none'})\n\n\tlet row_template = '<div class=\"spbc_view_file_row_wrapper\"><span class=\"spbc_view_file_row_num\">%s</span><p class=\"spbc_view_file_row\">%s</p><br /></div>';\n\n\tfor(let row in result.file){\n\t\tdialog_window.append(row_template.printf(row, result.file[row]));\n\t}\n\n\tlet content_height = Object.keys(result.file).length * 19 < 76 ? 76 : Object.keys(result.file).length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow       = content_height < visible_height ? 'hidden' : 'scroll',\n\t\theight         = overflow === 'scroll' ? visible_height : content_height;\n\n\tdialog_window.css({\n\t\theight: height,\n\t\toverflow: overflow\n\t})\n\n\tdialog_window.dialog({\n\t\tmodal:true,\n\t\ttitle: ('Loaded: ' + result.file_path),\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: false,\n\t\theight: height,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() {\n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close');\n\t\t\t});\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t});\n\n\tconsole.log('FILE_VIEWED');\n\n}\n\nfunction spbc_scanner_button_file_view_bad_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_view',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonViewBadFile_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scanner_button_page_view_bad_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_page_view',\n\t\tpage_url: self.parent().attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonViewBad_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonViewBadFile_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE_FILE');\n\tconsole.log(arguments);\n\tjQuery('#spbc_dialog').empty();\n\n\tvar row_template     = '<div class=\"spbc_view_file_row_wrapper\"><span class=\"spbc_view_file_row_num\">%s</span><p class=\"spbc_view_file_row\">%s</p><br /></div>',\n\t\trow_template_bad = '<div class=\"spbc_view_file_row_wrapper\" style=\"background: rgba(200,40,40,0.8);\"><span class=\"spbc_view_file_row_num\">%s</span><p class=\"spbc_view_file_row\">%s</p><br /></div>',\n\t\tseverity_parts = [],\n\t\tseverity_parts_sorted = [],\n\t\tseverity_keys_sorted = [];\n\n\tresult.weak_spots = JSON.parse(result.weak_spots)\n\tfor(let severity in result.weak_spots){\n\t\tseverity_parts[severity] = Object.keys(result.weak_spots[severity])\n\t}\n\n\tseverity_keys_sorted = Object.keys(severity_parts).sort();\n\n\tfor(key in severity_keys_sorted){\n\t\tseverity_parts_sorted[severity_keys_sorted[key]] = severity_parts[severity_keys_sorted[key]]\n\t}\n\n\tfor (let severity_part in severity_parts_sorted) {\n\t\tlet header_name = 'spbc-dialog-row-header-' + severity_part.toLowerCase();\n\t\tlet header_html = '<span id=\"' + header_name + '\" style=\"text-align: center\"><b>' + severity_part + ' weakspots:</b></span>';\n\t\tconst dialog = jQuery('#spbc_dialog');\n\n\t\tdialog.append(row_template.printf('',header_html));\n\t\tdialog.append(row_template.    printf('<b>...</b>','<b>...</b>'));\n\n\t\tlet header = dialog.find('#' + header_name);\n\t\theader.parent().parent().css('text-align', 'center');\n\t\theader.parent().parent().css('border', '1px dotted');\n\t\theader.parent().parent().css('background', 'darkgrey');\n\n\t\tfor(let str_num in severity_parts[severity_part]){\n\t\t\t// Sort bad line\n\t\t\tstr_num = [...new Set(str_num)].sort()\n\n\t\t\tlet row = +severity_parts[severity_part][str_num],\n\t\t\t\tdisplay_depth = 2;\n\n\t\t\t// Display only existing lines of file\n\t\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\t\tdialog.append((row === curr_row ? row_template_bad : row_template).printf(curr_row, result.file[curr_row]));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Placing an empty string between results\n\t\t\tdialog.append(row_template.    printf('<b>...</b>','<b>...</b>'));\n\t\t}\n\t}\n\n\t// Removing last empty string\n\tjQuery('#spbc_dialog div').last().remove();\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow       = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight         = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() {\n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close');\n\t\t\t});\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t});\n}\n\nfunction spbc_scannerButtonViewBad_callback(result, data, params){\n\n\tconsole.log('FILE_VIEWED_BAD_CODE');\n\n\tconsole.log(arguments);\n\n\tlet afterClose = () => {};\n\n\tif ( result.success == true ) {\n\t\tconsole.log(result);\n\t\tvar row_template     = '<div class=\"spbc_view_file_row_wrapper\">' +\n\t\t\t\t'<span class=\"spbc_view_file_row_num\">%s</span>' +\n\t\t\t\t'<p class=\"spbc_view_file_row\" style=\"word-break: break-all\">%s</p>' +\n\t\t\t\t'<br /></div>',\n\t\t\trow_template_bad = '<div class=\"spbc_view_file_row_wrapper\" style=\"background: rgb(200,120,120);\">' +\n\t\t\t\t'<span class=\"spbc_view_file_row_num\">%s</span>' +\n\t\t\t\t'<p class=\"spbc_view_file_row\" style=\"word-break: break-all\">%s</p>' +\n\t\t\t\t'<br /></div>',\n\t\t\tstr_nums = [];\n\n\t\tresult.weak_spots = JSON.parse(result.weak_spots);\n\t\tfor(let severity in result.weak_spots){\n\t\t\tstr_nums = str_nums.concat(Object.keys(result.weak_spots[severity]));\n\t\t}\n\n\t\tstr_nums = [...new Set(str_nums)].sort(); // Sort bad line\n\t\t//get a map of bad strings\n\t\tlet bad_strings_map = new Map(Object.entries(result.weak_spots.CRITICAL)) //TODO: Probably there can get something else except CRITICAL in the future\n\t\tfor(let str_num in str_nums){\n\t\t\tif (str_num == 0 && bad_strings_map.get(str_nums[str_num]).toLowerCase().includes('doctype')) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet row = +str_nums[str_num],\n\t\t\t\tdisplay_depth = 2;\n\n\t\t\t// Display only existing lines of file\n\t\t\tfor(let curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' ){\n\t\t\t\t\tlet is_bad_string = (row === curr_row)\n\t\t\t\t\tlet unformatted_row\n\t\t\t\t\tlet highlited_row\n\t\t\t\t\tif (is_bad_string){\n\t\t\t\t\t\tunformatted_row = row_template_bad\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunformatted_row = row_template\n\t\t\t\t\t}\n\t\t\t\t\tif (is_bad_string && !result.file[curr_row].includes('iframe')){\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, bad_strings_map.get(str_nums[str_num]));\n\t\t\t\t\t} else {\n\t\t\t\t\t\thighlited_row = unformatted_row.printf(curr_row, result.file[curr_row]);\n\t\t\t\t\t}\n\t\t\t\t\tjQuery('#spbc_dialog').append(highlited_row);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Placing an empty string between results\n\t\t\tjQuery('#spbc_dialog').append(row_template.    printf('', ''));\n\n\t\t\t// Removing last empty string\n\t\t\tjQuery('#spbc_dialog div').last().remove();\n\t\t}\n\t} else {\n\t\tlet wrapperElement = '<div style=\"margin:40px;text-align:center;\">%s</div>'\n\t\tjQuery('#spbc_dialog').append(wrapperElement.printf(result.content));\n\t\tafterClose = () => {document.location.reload();};\n\t}\n\n\tlet content_height = jQuery('#spbc_dialog div').length * 19 < 76 ? 76 : jQuery('#spbc_dialog div').length * 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\theight         = 'auto',\n\t\toverflow       = content_height < visible_height ? 'no_scroll' : 'scroll';\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: false,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t\tjQuery('.ui-widget-overlay').on('click', function() {\n\t\t\t\tjQuery(\"#spbc_dialog\").dialog('close');\n\t\t\t});\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t},\n\t\tclose: afterClose,\n\t});\n}\n\nfunction spbc_scanner_button_file_compare_event(obj){\n\tvar self = jQuery(obj);\n\tvar data = {\n\t\taction: 'spbc_scanner_file_compare',\n\t\tfile_id: self.parents('.row-actions').attr('uid'),\n\t};\n\tvar params = {\n\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\tcallback: spbc_scannerButtonFileCompare_callback,\n\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\nfunction spbc_scannerButtonFileCompare_callback(result, data, params){\n\n\tconsole.log('FILE_COMPARED');\n\n\tlet row_template = '<div class=\"spbc_compare_file_row_wrapper\"><p class=\"spbc_compare_file_row\">%s</p><span class=\"spbc_compare_file_row_num\">%s</span><p class=\"spbc_compare_file_row\">%s</p><br /></div>';\n\tlet row_template_bad = '<div class=\"spbc_compare_file_row_wrapper\" style=\"background: rgba(200,40,40,0.8);\"><p class=\"spbc_compare_file_row\">%s</p><span class=\"spbc_compare_file_row_num\">%s</span><p class=\"spbc_compare_file_row\">%s</p><br /></div>';\n\n\tjQuery('#spbc_dialog').append(row_template.printf('<span class=\"spbc_compare_file_headings\">Modified</span>', 'Line', '<span class=\"spbc_compare_file_headings\">Original</span>'));\n\n\tfor(var row=1, prev = false, next = false; typeof result.file[row] != 'undefined' || typeof result.file_original[row] != 'undefined'; row++){\n\n\t\tif(typeof result.file[row] == 'undefined')          result.file[row] = '';\n\t\tif(typeof result.file_original[row] == 'undefined') result.file_original[row] = '';\n\n\t\t// Display only existing lines of file\n\t\tif(result.difference.indexOf(row) != -1){\n\t\t\tfor(let display_depth = 2, curr_row = row - display_depth; curr_row <= row + display_depth; curr_row++ ){\n\t\t\t\tif( typeof result.file[curr_row] !== 'undefined' && typeof result.file_original[row] !== 'undefined') {\n\t\t\t\t\tjQuery('#spbc_dialog').append(\n\t\t\t\t\t\t(row === curr_row ? row_template_bad : row_template).printf(\n\t\t\t\t\t\t\tresult.file[curr_row] ? result.file[curr_row] : '',\n\t\t\t\t\t\t\tcurr_row,\n\t\t\t\t\t\t\tresult.file_original[curr_row] ? result.file_original[curr_row] : ''\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tjQuery('#spbc_dialog').append(row_template.    printf('', '', ''));\n\t\t}\n\t}\n\n\tvar content_height = jQuery('#spbc_dialog div').length * 19 + 19,\n\t\tvisible_height = (document.documentElement.clientHeight) / 100 * 75,\n\t\toverflow = content_height < visible_height ? 'no_scroll' : 'scroll',\n\t\theight = overflow === 'scroll' ? visible_height : content_height;\n\n\tjQuery('#spbc_dialog').dialog({\n\t\tmodal:true,\n\t\ttitle: result.file_path,\n\t\tposition: { my: \"center top\", at: \"center top+100px\" , of: window },\n\t\twidth: +(jQuery('#wpwrap').width() / 100 * 90),\n\t\theight: height,\n\t\tshow: { effect: \"blind\", duration: 500 },\n\t\tdraggable: true,\n\t\tresizable: true,\n\t\tcloseText: \"X\",\n\t\tclasses: {\"ui-dialog\": 'spbc---top'},\n\t\topen: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\tevent.target.style.overflow = overflow;\n\t\t\tjQuery('#spbc_dialog').height(height);\n\t\t},\n\t\tbeforeClose: function(event, ui) {\n\t\t\tdocument.body.style.overflow = 'auto';\n\t\t\tjQuery('#spbc_dialog').empty();\n\t\t}\n\t});\n}\n\nfunction spbc_scanner__reload_scan_info() {\n\tjQuery('.spbc_hint__last_scan_title').text(spbcScaner.look_below_for_scan_res);\n\tconst data = {\n\t\taction: 'spbc_scanner__last_scan_info'\n\t};\n\tconst params = {\n\t\tcallback: (result) => {\n\t\t\tdocument.getElementById('spbc_scanner__last_scan_info').innerText = result.data;\n\t\t}\n\t};\n\tspbc_sendAJAXRequest(data, params);\n}\n\n/**\n * Show snapshots of file\n * @param obj\n */\nfunction spbc_scanner_file_monitoring_show_current_snapshot(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileId = self.parents('.row-actions').attr('uid');\n\tconst file_name = self.closest('.column-path').find('.title').text();\n\n\t// Init and open remodal\n\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\tconst remodalObject = remodal.remodal();\n\tremodalObject.open();\n\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_snapshots',\n\t\tfile_id: fileId,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-list ul').remove();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-file-name').text(file_name);\n\t\t\t\tdrawSnapshotList(result.data, remodal);\n\t\t\t\tdrawCurrentSnapshot(result.data[0].id, remodal);\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n *\n * @param data\n * @param remodal\n */\nfunction drawSnapshotList(data, remodal)\n{\n\tlet list = '';\n\n\tfor (let item of data) {\n\t\tlist += `<li data-spanshot-id=\"${item.id}\">${item.created_at}</li>`;\n\t}\n\n\tlet html =\n\t\t`<ul>\n            ${list}\n        </ul>`;\n\n\tremodal.find('#spbc-fm-snapshot-list').append(html);\n}\n\nfunction drawCurrentSnapshot(snapshot_id, remodal)\n{\n\t// Ajax request to get data for slider\n\tlet data = {\n\t\taction: 'spbc_file_monitoring_show_current_snapshot',\n\t\tsnapshot_id,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tbeforeSend: function() {\n\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').show();\n\t\t},\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view .wrap').remove();\n\t\t\t\tremodal.find('[data-spanshot-id').removeClass('active');\n\t\t\t\tremodal.find('[data-spanshot-id=' + snapshot_id + ']').addClass('active');\n\n\t\t\t\tlet html =\n\t\t\t\t\t`<div class=\"wrap\">\n                        <pre>\n                            <code>\n                                ${result.data.content}\n                            </code>\n                        </pre>\n                    </div>`;\n\n\t\t\t\tjQuery('#spbc-file-monitoring-modal-preloader').hide();\n\t\t\t\tremodal.find('#spbc-fm-snapshot-view').append(html);\n\t\t\t\tdocument.querySelectorAll('pre code').forEach((el) => {\n\t\t\t\t\thljs.highlightElement(el);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// TODO: show errors\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Cure file\n * @param obj\n */\nfunction spbc_scanner_button_cure_file_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_file_cure_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Restore file from backup\n * @param obj\n */\nfunction spbc_scanner_button_restore_from_backup_ajax_handler(obj)\n{\n\tconst self = jQuery(obj);\n\tconst fileFastHash = self.parents('.row-actions').attr('uid');\n\n\tlet data = {\n\t\taction: 'spbc_restore_file_from_backup_ajax_action',\n\t\tfile_fast_hash: fileFastHash,\n\t\tsecurity: spbcSettings.ajax_nonce\n\t};\n\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tsuccess: function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n/**\n * Clear scan results\n */\nfunction spbc_scanner_button_clear_scan_results()\n{\n\tif( ! confirm('Do you confirm to clear the scan results?') )\n\t\treturn;\n\n\tconsole.log('CLEAR');\n\n\tspbc_sendAJAXRequest(\n\t\t{ action: 'spbc_scanner_clear', },\n\t\t{\n\t\t\ttype: 'GET',\n\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\tcomplete: null,\n\t\t\terrorOutput: null,\n\t\t\tcontext: this,\n\t\t\ttimeout: 40000,\n\t\t\tsuccess: function() {\n\t\t\t\tdocument.location.reload();\n\t\t\t},\n\t\t},\n\t);\n}\n\njQuery(document).ready(function(){\n\n\t// EVENT HADLING\n\tspbc_tbl__bulk_actions__listen(); // Table. Row bulk handler\n\tspbc_tbl__row_actions__listen();  // Table. Row actions handler\n\tspbc_tbl__pagination__listen();   // Table. Pagination handler\n\tspbc_tbl__sort__listen();         // Table. Sort handler\n\n\tspbcStartShowHide();\n\n\t// Preparing progressbar\n\tjQuery('#spbc_scaner_progress_bar').progressbar({\n\t\tvalue: 0,\n\t\tcreate: function( event, ui ) {\n\t\t\tevent.target.style.position = 'relative';\n\t\t\tevent.target.style.marginBottom = '12px';\n\t\t},\n\t\tchange: function(event, ui){\n\t\t\tjQuery('.spbc_progressbar_counter span').text(jQuery(event.target).progressbar('option', 'value') + ' %');\n\t\t},\n\t});\n\n\t// Preparing accordion\n\tjQuery('#spbc_scan_accordion').accordion({\n\t\theader: \"h3\",\n\t\theightStyle: 'content',\n\t\tcollapsible: true,\n\t\tactive: false,\n\t\tactivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 0 && ui.oldHeader.length === 0 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom spbc-overflow--visible\");\n\t\t},\n\t\tbeforeActivate: function( event, ui ) {\n\t\t\tif( ui.oldPanel.length === 1 && ui.oldHeader.length === 1 )\n\t\t\t\tjQuery(\"#spbc_scan_accordion\").accordion(\"option\", \"classes.ui-accordion-content\", \"ui-corner-bottom\");\n\t\t}\n\t});\n\n\t// Init scanner plugin\n\twindow.spbc_scanner = new spbcMalwareScanner({\n\t\tsettings: spbcScaner.settings,\n\t\tstates: spbcScaner.states,\n\t\tbutton: jQuery('#spbc_perform_scan'),\n\t\tspinner: jQuery('#spbc_perform_scan').next(),\n\t\tcallback: null,\n\t\tprogress_overall: jQuery('#spbc_scaner_progress_overall'),\n\t\tprogressbar: jQuery('#spbc_scaner_progress_bar'),\n\t\tprogressbar_text: jQuery('.spbc_progressbar_counter span'),\n\t\twrapper: document.getElementsByClassName('spbc_unchecked_file_list'),\n\t\twarnings: {\n\t\t\tlong_scan: jQuery('.spbc_hint_warning__long_scan'),\n\t\t\toutdated:  jQuery('.spbc_hint_warning__outdated')\n\t\t}\n\t});\n\n\tjQuery(document).on('click', '.spbc_popup_tip--icon---show', function(){\n\t\tspbc_popup_tip___show( jQuery( this ) );\n\t});\n\n\tjQuery('#spbc_perform_scan').on('click', function(){\n\t\tjQuery('#spbcscan-results-log-module').remove();\n\t\tspbc_scanner.actionControl();\n\n\t\tif (!jQuery(\".spbc_log-wrapper .panel-body\").length) {\n\t\t\tjQuery(\".spbc_log-wrapper\").append('<div class=\"panel-body\"></div>');\n\t\t}\n\n\t\tjQuery(\".spbc_log-wrapper\").resizable({\n\t\t\thandles: 'n, s',\n\t\t\tcontainment: 'document',\n\t\t});\n\t});\n\n\tjQuery(\"#spbcscan-results-log-module\").resizable({\n\t\thandles: 'n, s',\n\t\tcontainment: 'document',\n\t});\n\n\t// Clear scanner's tables\n\tjQuery('#spbc_scanner_clear').on('click', function(){\n\n\t\tif( ! confirm('Do you confirm to clear the scan results?') )\n\t\t\treturn;\n\n\t\tconsole.log('CLEAR');\n\n\t\tspbc_sendAJAXRequest(\n\t\t\t{ action: 'spbc_scanner_clear', },\n\t\t\t{\n\t\t\t\ttype: 'GET',\n\t\t\t\tsuccessCallback: function(){ document.location = document.location },\n\t\t\t\tcomplete: null,\n\t\t\t\terrorOutput: null,\n\t\t\t\tcontext: this,\n\t\t\t\ttimeout: 40000,\n\t\t\t\tsuccess: function() {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t});\n\n\tjQuery('#spbc_scanner_save_to_pdf').on('click', function(){\n\t\tjQuery.ajax({\n\t\t\turl: spbcSettings.ajaxurl,\n\t\t\ttype: 'POST',\n\t\t\tdata: {\n\t\t\t\taction: 'spbc_scanner_save_to_pdf',\n\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\tno_cache: Math.random()\n\t\t\t},\n\t\t\txhrFields: {\n\t\t\t\tresponseType: 'blob'\n\t\t\t},\n\t\t\tsuccess: function(data) {\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\turl: spbcSettings.ajaxurl,\n\t\t\t\t\t\ttype: 'POST',\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\taction: 'spbc_scanner_get_pdf_file_name',\n\t\t\t\t\t\t\tsecurity: spbcSettings.ajax_nonce,\n\t\t\t\t\t\t\tno_cache: Math.random()\n\t\t\t\t\t\t},\n\t\t\t\t\t\txhrFields: {\n\t\t\t\t\t\t\tresponseType: 'text'\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess: function(filename) {\n\t\t\t\t\t\t\tlet blob=new Blob([data]);\n\t\t\t\t\t\t\tlet link=document.createElement('a');\n\t\t\t\t\t\t\tlink.href=window.URL.createObjectURL(blob);\n\t\t\t\t\t\t\tlink.download=filename.data;\n\t\t\t\t\t\t\tlink.click();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t}\n\t\t});\n\t});\n\n\t// Select snapshot\n\tjQuery(document).on('click', '.spbc-fm-snapshot-list [data-spanshot-id]', function() {\n\t\tconst currentSnapshotId = jQuery(this).data('spanshot-id');\n\t\tconst activeSnapshotId = jQuery('.spbc-fm-snapshot-list [data-spanshot-id].active').data('spanshot-id');\n\n\t\tif (currentSnapshotId === activeSnapshotId) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst remodal = jQuery('[data-remodal-id=spbc-file-monitoring-modal]');\n\t\tdrawCurrentSnapshot(currentSnapshotId, remodal)\n\t});\n});\n"],"names":["spbc_popup_tip___show","show_icon","remove_desc_func","e","jQuery","target","parent","length","hasClass","hide","document","off","tip_title","attr","tip_text","obj","after","empty","append","css","top","position","left","on","parents","spbc_scanner_button_file_view_event","self","data","action","file_id","params","spinner","siblings","callback","spbc_scannerButtonView_callback","errorOutput","msg","spbcModal","open","putError","spbc_sendAJAXRequest","spbc_scanner_analysis_log_delete_from_log","let","fileIds","push","selectedItems","closest","find","alert","each","index","element","elementId","val","children","file_ids","window","location","reload","spbc_scanner_button_page_view_event","page_url","wp_wrap","dialog_window","dialog","modal","title","my","at","of","width","show","effect","duration","draggable","resizable","closeText","classes","ui-dialog","event","ui","style","overflow","height","documentElement","beforeClose","body","size_multiplier","result","row","display","file","printf","content_height","Object","keys","visible_height","file_path","console","log","spbc_scanner_button_file_view_bad_event","spbc_scannerButtonViewBadFile_callback","spbc_scanner_button_page_view_bad_event","spbc_scannerButtonViewBad_callback","arguments","severity_keys_sorted","severity","severity_part","row_template","severity_parts","severity_parts_sorted","weak_spots","JSON","parse","key","sort","str_num","header_name","toLowerCase","header_html","header","Set","curr_row","last","remove","afterClose","success","str_nums","concat","bad_strings_map","Map","entries","CRITICAL","get","includes","is_bad_string","unformatted_row","highlited_row","content","close","spbc_scanner_button_file_compare_event","spbc_scannerButtonFileCompare_callback","file_original","difference","indexOf","spbc_scanner__reload_scan_info","text","spbcScaner","look_below_for_scan_res","getElementById","innerText","spbc_scanner_file_monitoring_show_current_snapshot","fileId","file_name","remodal","security","spbcSettings","ajax_nonce","ajax","type","async","url","ajaxurl","drawSnapshotList","drawCurrentSnapshot","id","list","item","created_at","html","snapshot_id","beforeSend","removeClass","addClass","querySelectorAll","forEach","hljs","highlightElement","el","spbc_scanner_button_cure_file_ajax_handler","file_fast_hash","put","addEventListener","spbc_scanner_button_restore_from_backup_ajax_handler","spbc_scanner_button_clear_scan_results","confirm","successCallback","complete","context","this","timeout","ready","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","progressbar","value","create","marginBottom","change","accordion","heightStyle","collapsible","active","activate","oldPanel","oldHeader","beforeActivate","spbc_scanner","spbcMalwareScanner","settings","states","button","next","progress_overall","progressbar_text","wrapper","getElementsByClassName","warnings","long_scan","outdated","actionControl","handles","containment","no_cache","Math","random","xhrFields","responseType","filename","blob","Blob","link","createElement","href","URL","createObjectURL","download","click","currentSnapshotId"],"mappings":"AAAA,SAASA,sBAAsBC,GAIP,SAAnBC,EAA4BC,GAGjB,KAAA,IAANA,IAEyD,GAA9DC,OAAOD,EAAEE,MAAM,EAAEC,OAAO,0BAA0B,EAAEC,QAAeH,CAAAA,OAAOD,EAAEE,MAAM,EAAEG,SAAS,+BAA+B,GAC5HJ,OAAOD,EAAEE,MAAM,EAAEG,SAAS,6BAA6B,KAGzDJ,OAAO,0BAA0B,EAAEK,KAAK,EACxCL,OAAOM,QAAQ,EAAEC,IAAI,QAAST,CAAgB,EAEhD,CAdA,IAAIU,EAAYX,EAAUY,KAAK,gBAAgB,GAAK,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,WACzE,IAAMyN,EAAoB5O,OAAOwL,IAAI,EAAEjK,KAAK,aAAa,EAGrDqN,IAFqB5O,OAAO,kDAAkD,EAAEuB,KAAK,aAAa,GAOtGwI,oBAAoB6E,EADJ5O,OAAO,8CAA8C,CACvB,CAC/C,CAAC,CACF,CAAC"}
  • security-malware-firewall/trunk/js/spbc-settings_tab--summary.min.js.map

    r3011278 r3022805  
    1 {"version":3,"file":"spbc-settings_tab--summary.min.js","sources":["spbc-settings_tab--summary.js"],"sourcesContent":["jQuery(document).ready(function(){\r\n\tconsole.log('TAB - SUMMARY');\r\n});"],"names":["jQuery","document","ready","console","log"],"mappings":"AAAAA,OAAOC,QAAQ,EAAEC,MAAM,WACtBC,QAAQC,IAAI,eAAe,CAC5B,CAAC"}
     1{"version":3,"file":"spbc-settings_tab--summary.min.js","sources":["spbc-settings_tab--summary.js"],"sourcesContent":["jQuery(document).ready(function(){\n\tconsole.log('TAB - SUMMARY');\n});\n"],"names":["jQuery","document","ready","console","log"],"mappings":"AAAAA,OAAOC,QAAQ,EAAEC,MAAM,WACtBC,QAAQC,IAAI,eAAe,CAC5B,CAAC"}
  • security-malware-firewall/trunk/js/spbc-table.min.js

    r2998673 r3022805  
    1 function spbc_reload_accordion(){spbc_sendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(t,e,n,a){jQuery(a).accordion("destroy"),jQuery(a).html(t),jQuery(a).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide()}},jQuery("#spbc_scan_accordion"))}function spbc_tbl__bulk_actions__listen(){jQuery(".tbl-bulk_actions-all--apply").off("click").on("click",function(){if(spbc_scanner.active)alert(spbcTableLocalize.scannerIsActive);else{var t=jQuery(this),n=t.siblings("select").children()[t.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(confirm(spbcTable.warning_bulk)){var e={action:"spbc_tbl-action--bulk",add_action:n,status:t.parents(".tbl-root").attr("type")};if("cure"===n){var a=t.closest("#spbc_tbl__scanner_cure_log").find(".cb-select");let n=[];a.each(function(t,e){e=jQuery(e).val();n.push(e)}),e.selectedIds=n}if("delete_from_analysis_log"===n){a=t.closest("#spbc_tbl__scanner_analysis_log").find(".cb-select");let n=[];a.each(function(t,e){e=jQuery(e).val();n.push(e)}),e.file_ids=n}a={button:this,spinner:t.children(".tbl-preloader--small"),callback:function(t){var e;spbc_reload_accordion(),"check_analysis_status"===n&&(e="<p> Analysis status updated. Total: "+t.counters.total+", updated: "+t.counters.updated+", skipped: "+t.counters.skipped+", failed: "+t.counters.failed+", queued: "+t.counters.queued+"</p>",spbcModal.open().put(e)),"send"===n&&(e="<p> Files have been sent: "+t.files_sent_counter+"</p>",spbcModal.open().put(e))},errorOutput:function(t,e){e&&(t=t+"<br>Additional information:<br>"+e),spbcModal.open().putError(t)},timeout:6e4};spbc_sendAJAXRequest(e,a)}}else alert("This action is not supported for all files yet =(")}}),jQuery(".tbl-bulk_actions--apply").off("click").on("click",function(t){if(spbc_bulk_action||confirm(spbcTable.warning_bulk)){var n=spbc_bulk_action||jQuery(this),a=(spbc_bulk_action=n).siblings("select").children()[n.siblings("select").first()[0].selectedIndex].value;if("cure"===a)spbc_scanner__cure_selected(jQuery(this));else if("delete_from_analysis_log"===a)spbc_scanner_analysis_log_delete_from_log(jQuery(this));else if("allow"===a||"ban"===a){let e="ban"===a?"deny":a;var s=n.parents(".tbl-root").find(".cb-select:checked"),s=(s&&(n.children(".tbl-preloader--small").show(),s.each(function(){var t=jQuery(this).parents("tr").find(".tbl-row_action--"+a).data("ip");spbc_sec_logs__filter_ip(t,e,!0),jQuery(this).prop("checked",!1)})),n.children(".tbl-preloader--small").hide(),"allow"===a?"Allowed":"Banned"),s="<p> Success. Selected IPs have been "+s+". Changes will be applied within 10 minutes.</p>";spbcModal.open().put(s),void setTimeout(spbc_reload_accordion,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(),spbc_bulk_action=null,"check_analysis_status"===a&&spbcModal.open().put("<p> All available files are updated.</p>"),"send"===a&&spbcModal.open().put("<p> All available files are sent.</p>"),setTimeout(spbc_reload_accordion,1900))}})}function spbc_scanner__cure_selected(e){var t=e.closest("#spbc_tbl__scanner_cure_log").find(".cb-select:checked");let n=[];0===t.length&&alert("Please, select elements."),t.each(function(t,e){e=jQuery(e).val();n.push(e)});t={action:"spbc_cure_selected",security:spbcSettings.ajax_nonce,selectedIds:n};jQuery.ajax({type:"POST",url:spbcSettings.ajaxurl,data:t,beforeSend:function(){e.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").show()},success:function(t){e.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").hide(),t.success?(spbcModal.open().put(t.data),document.addEventListener("spbcModalClosed",function(t){document.location.reload()})):spbcModal.open().putError(t.data)}})}function spbc_tbl__row_actions__listen(){jQuery(".tbl-row_action--ajax").off("click").on("click",function(){var t,e,n,a;console.log("spbc_tbl__row_actions__listen click"),spbc_scanner.active?alert(spbcTableLocalize.scannerIsActive):(e={action:"spbc_tbl-action--row",add_action:(t=jQuery(this)).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")},n={callback:spbc_tbl__row_actions__callback,errorOutput:function(t){spbcModal.open().putError(t)},spinner:t.parent().siblings(".tbl-preloader--tiny")},!spbc_bulk_action&&(a=spbcTable["warning_"+t.attr("row-action")]||spbcTable.warning_default,"copy_file_info"===e.add_action||"check_analysis_status"===e.add_action||confirm(a))&&spbc_sendAJAXRequest(e,n,t.parents("tr")),spbc_bulk_action&&spbc_sendAJAXRequest(e,n,t.parents("tr")))})}function spbc_tbl__row_actions__callback(t,e,n,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),spbc_bulk_action||setTimeout(spbc_reload_accordion,1900)),"copy_file_info"===e.add_action&&(!0===t.success&&t.data.file_info?window.prompt("Copy the file info below and send it to [email protected]: ",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){var s=a.html();if(a.html(t.temp_html),void 0!==t.updated_template){var c=t.updated_template_type,t=t.updated_template,l=jQuery(t).find(".wp-list-table tbody tr").length,i=jQuery('[aria-controls="spbc_scan_accordion_tab_'+c+'"]');if(0<i.length){var o=jQuery("#spbc_tbl__scanner_"+c);jQuery(".spbc_bad_type_count."+c+"_counter").text(l);let n=o.find(".wp-list-table tbody tr").length;o.remove(),jQuery("#spbc_scan_accordion_tab_"+c).append(t),jQuery(jQuery("#spbc_scan_accordion_tab_"+c).find(".wp-list-table tbody tr")).each(function(t,e){++t>n&&jQuery(e).css("outline","1px solid green")}),i.click()}else"analysis_log"===c&&(o='<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-2" aria-controls="spbc_scan_accordion_tab_analysis_log" aria-selected="false" aria-expanded="false" tabindex="-1"><span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-e"></span><a href="#">Analysis Log (<span class="spbc_bad_type_count analysis_log_counter">'+l+"</span>)</a></h3>",c='<div id="spbc_scan_accordion_tab_analysis_log" class="ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" aria-labelledby="ui-id-2" role="tabpanel" aria-hidden="true" style="display: none;"><p class="spbc_hint">Files sent for analysis.</p><div id="spbc_tbl__scanner_analysis_log" type="analysis_log" class="tbl-root">'+t+"</div>",jQuery("#spbc_scan_accordion_tab_critical").after(o+c),i.click())}setTimeout(function(){a.html(s).css({background:"inherit"}).find(".column-primary .row-actions .tbl-row_action--"+e.add_action).remove(),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbcStartShowHide()},5e3)}spbc_bulk_action&&spbc_bulk_action.click()}function spbc_tbl__pagination__listen(){var n={action:"spbc_tbl-pagination"},a={callback:spbc_tbl__pagination__callback,notJson:!0};jQuery(".tbl-pagination--button").on("click",function(){jQuery(this).parents(".tbl-root").find(".tbl-pagination--button").attr("disabled","disabled")}),jQuery(".tbl-pagination--go").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");n.page=t.siblings(".tbl-pagination--curr_page").val(),n.type=e.attr("type"),a.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(n,a,e)}),jQuery(".tbl-pagination--prev").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");n.page=t.parents(".tbl-pagination--wrapper").attr("prev_page"),n.type=e.attr("type"),a.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(n,a,e)}),jQuery(".tbl-pagination--next").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");n.page=t.parents(".tbl-pagination--wrapper").attr("next_page"),n.type=e.attr("type"),a.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(n,a,e)}),jQuery(".tbl-pagination--end").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");n.page=t.parents(".tbl-pagination--wrapper").attr("last_page"),n.type=e.attr("type"),a.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(n,a,e)}),jQuery(".tbl-pagination--start").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");n.page=1,n.type=e.attr("type"),a.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(n,a,e)})}function spbc_scanner__switch_table(t,e){t=jQuery(t),console.log(t.parents(".row-actions").attr("uid")),e={action:"spbc_tbl-switch",type:e,domain:t.parents(".row-actions").attr("uid")};spbc_sendAJAXRequest(e,{callback:spbc_tbl__pagination__callback,notJson:!0},t.parents(".tbl-root"))}function spbc_tbl__pagination__callback(t,e,n,a){jQuery(a).html(t).find(".tbl-pagination--button").removeAttr("disabled"),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide()}function spbc_tbl__sort__listen(){var n={callback:spbc_tbl__sort__callback,notJson:!0};jQuery(".tbl-column-sortable").on("click",function(t){var e;t.target.classList.contains("tbl-sorting_indicator")&&(e=(t=jQuery(this)).parents(".tbl-root"),t={action:"spbc_tbl-sort",order_by:t.attr("id"),order:t.attr("sort_direction"),type:e.attr("type")},spbc_sendAJAXRequest(t,n,e))})}function spbc_tbl__sort__callback(t,e,n,a){jQuery(a).html(t),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen()}spbc_bulk_action=null,jQuery(document).ready(function(){spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen()});
     1function spbc_reload_accordion(){spbc_sendAJAXRequest({action:"spbc_scanner_tab__reload_accordion"},{notJson:!0,callback:function(t,e,a,n){jQuery(n).accordion("destroy"),jQuery(n).html(t),jQuery(n).accordion({header:"h3",heightStyle:"content",collapsible:!0,active:!1}),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide()}},jQuery("#spbc_scan_accordion"))}function spbc_tbl__bulk_actions__listen(){jQuery(".tbl-bulk_actions-all--apply").off("click").on("click",function(){if(spbc_scanner.active)alert(spbcTableLocalize.scannerIsActive);else{var t=jQuery(this),a=t.siblings("select").children()[t.siblings("select").first()[0].selectedIndex].value;if(-1!==["approve","disapprove","send","check_analysis_status","approve_page","disapprove_page","cure","delete_from_analysis_log"].indexOf(a)){if(confirm(spbcTable.warning_bulk)){var e={action:"spbc_tbl-action--bulk",add_action:a,status:t.parents(".tbl-root").attr("type")};if("cure"===a){var n=t.closest("#spbc_tbl__scanner_cure_log").find(".cb-select");let a=[];n.each(function(t,e){e=jQuery(e).val();a.push(e)}),e.selectedIds=a}if("delete_from_analysis_log"===a){n=t.closest("#spbc_tbl__scanner_analysis_log").find(".cb-select");let a=[];n.each(function(t,e){e=jQuery(e).val();a.push(e)}),e.file_ids=a}n={button:this,spinner:t.children(".tbl-preloader--small"),callback:function(t){var e;spbc_reload_accordion(),"check_analysis_status"===a&&(e="<p> Analysis status updated. Total: "+t.counters.total+", updated: "+t.counters.updated+", skipped: "+t.counters.skipped+", failed: "+t.counters.failed+", queued: "+t.counters.queued+"</p>",spbcModal.open().put(e)),"send"===a&&(e="<p> Files have been sent: "+t.files_sent_counter+"</p>",spbcModal.open().put(e))},errorOutput:function(t,e){e&&(t=t+"<br>Additional information:<br>"+e),spbcModal.open().putError(t)},timeout:6e4};spbc_sendAJAXRequest(e,n)}}else alert("This action is not supported for all files yet =(")}}),jQuery(".tbl-bulk_actions--apply").off("click").on("click",function(t){if(spbc_bulk_action||confirm(spbcTable.warning_bulk)){var a=spbc_bulk_action||jQuery(this),n=(spbc_bulk_action=a).siblings("select").children()[a.siblings("select").first()[0].selectedIndex].value;if("cure"===n)spbc_scanner__cure_selected(jQuery(this));else if("delete_from_analysis_log"===n)spbc_scanner_analysis_log_delete_from_log(jQuery(this));else if("allow"===n||"ban"===n){let e="ban"===n?"deny":n;var s=a.parents(".tbl-root").find(".cb-select:checked"),s=(s&&(a.children(".tbl-preloader--small").show(),s.each(function(){var t=jQuery(this).parents("tr").find(".tbl-row_action--"+n).data("ip");spbc_sec_logs__filter_ip(t,e,!0),jQuery(this).prop("checked",!1)})),a.children(".tbl-preloader--small").hide(),"allow"===n?"Allowed":"Banned"),s="<p> Success. Selected IPs have been "+s+". Changes will be applied within 10 minutes.</p>";spbcModal.open().put(s),void setTimeout(spbc_reload_accordion,1900)}else"-1"!==n&&a.parents(".tbl-root").find(".cb-select").is(":checked")?(a.children(".tbl-preloader--small").show(),a.parents(".tbl-root").find(".cb-select:checked").first().parents("tr").find(".tbl-row_action--"+n)[0]?(a.parents(".tbl-root").find(".cb-select:checked").first().parents("tr").find(".tbl-row_action--"+n).click(),a.parents(".tbl-root").find(".cb-select:checked").first().prop("checked",!1)):(a.parents(".tbl-root").find(".cb-select:checked").first().prop("checked",!1),a.click())):(a.children(".tbl-preloader--small").hide(),spbc_bulk_action=null,"check_analysis_status"===n&&spbcModal.open().put("<p> All available files are updated.</p>"),"send"===n&&spbcModal.open().put("<p> All available files are sent.</p>"),setTimeout(spbc_reload_accordion,1900))}})}function spbc_scanner__cure_selected(e){var t=e.closest("#spbc_tbl__scanner_cure_log").find(".cb-select:checked");let a=[];0===t.length&&alert("Please, select elements."),t.each(function(t,e){e=jQuery(e).val();a.push(e)});t={action:"spbc_cure_selected",security:spbcSettings.ajax_nonce,selectedIds:a};jQuery.ajax({type:"POST",url:spbcSettings.ajaxurl,data:t,beforeSend:function(){e.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").show()},success:function(t){e.closest("#spbc_tbl__scanner_cure_log").find(".tbl-button---white_blue .tbl-preloader--in_button").hide(),t.success?(spbcModal.open().put(t.data),document.addEventListener("spbcModalClosed",function(t){document.location.reload()})):spbcModal.open().putError(t.data)}})}function spbc_tbl__row_actions__listen(){jQuery(".tbl-row_action--ajax").off("click").on("click",function(){var t,e,a,n;console.log("spbc_tbl__row_actions__listen click"),spbc_scanner.active?alert(spbcTableLocalize.scannerIsActive):(e={action:"spbc_tbl-action--row",add_action:(t=jQuery(this)).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:spbc_tbl__row_actions__callback,errorOutput:function(t){spbcModal.open().putError(t)},spinner:t.parent().siblings(".tbl-preloader--tiny")},!spbc_bulk_action&&(n=spbcTable["warning_"+t.attr("row-action")]||spbcTable.warning_default,"copy_file_info"===e.add_action||"check_analysis_status"===e.add_action||confirm(n))&&spbc_sendAJAXRequest(e,a,t.parents("tr")),spbc_bulk_action&&spbc_sendAJAXRequest(e,a,t.parents("tr")))})}function spbc_tbl__row_actions__callback(t,e,a,n){if(t.color&&n.css({background:t.background,color:t.color}),t.html&&(n.parent().parent().parent().prepend(t.html),setTimeout(function(){n.fadeOut(300)},1500),spbc_bulk_action||setTimeout(spbc_reload_accordion,1900)),"copy_file_info"===e.add_action&&(!0===t.success&&t.data.file_info?window.prompt("Copy the file info below and send it to [email protected]: ",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){var s=n.html();if(n.html(t.temp_html),void 0!==t.updated_template){var c=t.updated_template_type,t=t.updated_template,l=jQuery(t).find(".wp-list-table tbody tr").length,i=jQuery('[aria-controls="spbc_scan_accordion_tab_'+c+'"]');if(0<i.length){var o=jQuery("#spbc_tbl__scanner_"+c);jQuery(".spbc_bad_type_count."+c+"_counter").text(l);let a=o.find(".wp-list-table tbody tr").length;o.remove(),jQuery("#spbc_scan_accordion_tab_"+c).append(t),jQuery(jQuery("#spbc_scan_accordion_tab_"+c).find(".wp-list-table tbody tr")).each(function(t,e){++t>a&&jQuery(e).css("outline","1px solid green")}),i.click()}else"analysis_log"===c&&(o='<h3 class="ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all" role="tab" id="ui-id-2" aria-controls="spbc_scan_accordion_tab_analysis_log" aria-selected="false" aria-expanded="false" tabindex="-1"><span class="ui-accordion-header-icon ui-icon ui-icon-triangle-1-e"></span><a href="#">Analysis Log (<span class="spbc_bad_type_count analysis_log_counter">'+l+"</span>)</a></h3>",c='<div id="spbc_scan_accordion_tab_analysis_log" class="ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content" aria-labelledby="ui-id-2" role="tabpanel" aria-hidden="true" style="display: none;"><p class="spbc_hint">Files sent for analysis.</p><div id="spbc_tbl__scanner_analysis_log" type="analysis_log" class="tbl-root">'+t+"</div>",jQuery("#spbc_scan_accordion_tab_critical").after(o+c),i.click())}setTimeout(function(){n.html(s).css({background:"inherit"}).find(".column-primary .row-actions .tbl-row_action--"+e.add_action).remove(),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbcStartShowHide()},5e3)}spbc_bulk_action&&spbc_bulk_action.click()}function spbc_tbl__pagination__listen(){var a={action:"spbc_tbl-pagination"},n={callback:spbc_tbl__pagination__callback,notJson:!0};jQuery(".tbl-pagination--button").on("click",function(){jQuery(this).parents(".tbl-root").find(".tbl-pagination--button").attr("disabled","disabled")}),jQuery(".tbl-pagination--go").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");a.page=t.siblings(".tbl-pagination--curr_page").val(),a.type=e.attr("type"),n.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(a,n,e)}),jQuery(".tbl-pagination--prev").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");a.page=t.parents(".tbl-pagination--wrapper").attr("prev_page"),a.type=e.attr("type"),n.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(a,n,e)}),jQuery(".tbl-pagination--next").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");a.page=t.parents(".tbl-pagination--wrapper").attr("next_page"),a.type=e.attr("type"),n.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(a,n,e)}),jQuery(".tbl-pagination--end").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");a.page=t.parents(".tbl-pagination--wrapper").attr("last_page"),a.type=e.attr("type"),n.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(a,n,e)}),jQuery(".tbl-pagination--start").on("click",function(){var t=jQuery(this),e=t.parents(".tbl-root");a.page=1,a.type=e.attr("type"),n.spinner=t.siblings(".tbl-preloader--small"),spbc_sendAJAXRequest(a,n,e)})}function spbc_scanner__switch_table(t,e){t=jQuery(t),console.log(t.parents(".row-actions").attr("uid")),e={action:"spbc_tbl-switch",type:e,domain:t.parents(".row-actions").attr("uid")};spbc_sendAJAXRequest(e,{callback:spbc_tbl__pagination__callback,notJson:!0},t.parents(".tbl-root"))}function spbc_tbl__pagination__callback(t,e,a,n){jQuery(n).html(t).find(".tbl-pagination--button").removeAttr("disabled"),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen(),spbcStartShowHide()}function spbc_tbl__sort__listen(){var a={callback:spbc_tbl__sort__callback,notJson:!0};jQuery(".tbl-column-sortable").on("click",function(t){var e;t.target.classList.contains("tbl-sorting_indicator")&&(e=(t=jQuery(this)).parents(".tbl-root"),t={action:"spbc_tbl-sort",order_by:t.attr("id"),order:t.attr("sort_direction"),type:e.attr("type")},spbc_sendAJAXRequest(t,a,e))})}function spbc_tbl__sort__callback(t,e,a,n){jQuery(n).html(t),spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen()}function show_hide_rows(t,e){e=jQuery("."+e+"_block_"+t);e.hasClass("mob_table_active")?e.removeClass("mob_table_active"):e.addClass("mob_table_active")}spbc_bulk_action=null,jQuery(document).ready(function(){spbc_tbl__bulk_actions__listen(),spbc_tbl__row_actions__listen(),spbc_tbl__pagination__listen(),spbc_tbl__sort__listen()});
    22//# sourceMappingURL=spbc-table.min.js.map
  • security-malware-firewall/trunk/js/spbc-table.min.js.map

    r3011278 r3022805  
    1 {"version":3,"file":"spbc-table.min.js","sources":["spbc-table.js"],"sourcesContent":["spbc_bulk_action = null;\r\n\r\n/**\r\n * Reloads scanner accordion and set all the listeners\r\n */\r\nfunction spbc_reload_accordion(){\r\n\tspbc_sendAJAXRequest(\r\n\t\t{action: 'spbc_scanner_tab__reload_accordion'},\r\n\t\t{\r\n\t\t\tnotJson: true,\r\n\t\t\tcallback: function(result, data, params, obj){\r\n\t\t\t\tjQuery(obj).accordion('destroy');\r\n\t\t\t\tjQuery(obj).html(result);\r\n\t\t\t\tjQuery(obj).accordion({\r\n\t\t\t\t\theader: 'h3',\r\n\t\t\t\t\theightStyle: 'content',\r\n\t\t\t\t\tcollapsible: true,\r\n\t\t\t\t\tactive: false,\r\n\t\t\t\t});\r\n\t\t\t\tspbc_tbl__bulk_actions__listen();\r\n\t\t\t\tspbc_tbl__row_actions__listen();\r\n\t\t\t\tspbc_tbl__pagination__listen();\r\n\t\t\t\tspbc_tbl__sort__listen();\r\n\t\t\t\tspbcStartShowHide();\r\n\t\t\t},\r\n\t\t},\r\n\t\tjQuery('#spbc_scan_accordion')\r\n\t);\r\n}\r\n\r\n// TABLE BULK ACTIONS\r\nfunction spbc_tbl__bulk_actions__listen(){\r\n\r\n\tjQuery('.tbl-bulk_actions-all--apply')\r\n\t\t.off('click')\r\n\t\t.on('click', function(){\r\n\r\n\t\tif ( spbc_scanner.active ) {\r\n\t\t\talert(spbcTableLocalize.scannerIsActive);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tvar self = jQuery(this);\r\n\t\tvar allowed_bulk_actions = ['approve','disapprove','send','check_analysis_status','approve_page','disapprove_page','cure', 'delete_from_analysis_log'];\r\n\t\tvar action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\r\n\r\n\t\tif( allowed_bulk_actions.indexOf( action ) !== -1 ){\r\n\r\n\t\t\tif(!confirm(spbcTable.warning_bulk))\r\n\t\t\t\treturn;\r\n\r\n\t\t\tvar data = {\r\n\t\t\t\taction: 'spbc_tbl-action--bulk',\r\n\t\t\t\tadd_action: action,\r\n\t\t\t\tstatus: self.parents('.tbl-root').attr('type'),\r\n\t\t\t};\r\n\r\n\t\t\tif (action === 'cure') {\r\n\t\t\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_cure_log').find('.cb-select');\r\n\t\t\t\tlet selectedIds = [];\r\n\r\n\t\t\t\tselectedItems.each(function (index, element) {\r\n\t\t\t\t\tconst elementId = jQuery(element).val();\r\n\t\t\t\t\tselectedIds.push(elementId);\r\n\t\t\t\t});\r\n\t\t\t\tdata.selectedIds = selectedIds;\r\n\t\t\t}\r\n\r\n\t\t\tif (action === 'delete_from_analysis_log') {\r\n\t\t\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select');\r\n\t\t\t\tlet fileIds = [];\r\n\r\n\t\t\t\tselectedItems.each(function (index, element) {\r\n\t\t\t\t\tconst elementId = jQuery(element).val();\r\n\t\t\t\t\tfileIds.push(elementId);\r\n\t\t\t\t});\r\n\t\t\t\tdata.file_ids = fileIds;\r\n\t\t\t}\r\n\r\n\t\t\tvar params = {\r\n\t\t\t\tbutton: this,\r\n\t\t\t\tspinner: self.children('.tbl-preloader--small'),\r\n\t\t\t\tcallback: function(out) {\r\n\t\t\t\t\tspbc_reload_accordion();\r\n\t\t\t\t\tif ( action === 'check_analysis_status' && typeof out !== undefined){\r\n\t\t\t\t\t\tlet html = '<p> Analysis status updated.'\r\n\t\t\t\t\t\t\t+ ' Total: ' +  out.counters.total\r\n\t\t\t\t\t\t\t+ ', updated: ' +  out.counters.updated\r\n\t\t\t\t\t\t\t+ ', skipped: ' +  out.counters.skipped\r\n\t\t\t\t\t\t\t+ ', failed: ' + out.counters.failed\r\n\t\t\t\t\t\t\t+ ', queued: ' +  out.counters.queued\r\n\t\t\t\t\t\t\t+ '</p>';\r\n\t\t\t\t\t\tspbcModal.open().put( html );\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif ( action === 'send' && typeof out !== undefined){\r\n\t\t\t\t\t\tlet html = '<p> Files have been sent: '\r\n\t\t\t\t\t\t\t+ out.files_sent_counter\r\n\t\t\t\t\t\t\t+ '</p>';\r\n\t\t\t\t\t\tspbcModal.open().put( html );\r\n\t\t\t\t\t}\r\n\t\t\t\t},\r\n\t\t\t\terrorOutput: function( error_text, comment ){\r\n\t\t\t\t\tif( comment ){\r\n\t\t\t\t\t\terror_text = error_text + '<br>Additional information:<br>' + comment;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tspbcModal.open().putError( error_text );\r\n\t\t\t\t},\r\n\t\t\t\ttimeout: 60000,\r\n\t\t\t};\r\n\r\n\t\t\tspbc_sendAJAXRequest(data, params);\r\n\r\n\t\t}else{\r\n\t\t\talert('This action is not supported for all files yet =(')\r\n\t\t}\r\n\t});\r\n\r\n\tjQuery('.tbl-bulk_actions--apply')\r\n\t\t.off('click')\r\n\t\t.on('click', function(e){\r\n\r\n\t\tif(!spbc_bulk_action && !confirm(spbcTable.warning_bulk))\r\n\t\t\treturn;\r\n\r\n\t\tvar self = spbc_bulk_action || jQuery(this);\r\n\t\tspbc_bulk_action = self;\r\n\t\tvar action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\r\n\r\n\t\tif (action === 'cure') {\r\n\t\t\tspbc_scanner__cure_selected(jQuery(this));\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (action === 'delete_from_analysis_log') {\r\n\t\t\tspbc_scanner_analysis_log_delete_from_log(jQuery(this));\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif (action === 'allow' || action === 'ban') {\r\n\t\t\tlet send_action = action === 'ban' ? 'deny' : action;\r\n\t\t\tlet items = self.parents('.tbl-root').find('.cb-select:checked');\r\n\t\t\tif (items) {\r\n\t\t\t\tself.children('.tbl-preloader--small').show();\r\n\t\t\t\titems.each(function() {\r\n\t\t\t\t\tlet ip = jQuery(this).parents('tr').find('.tbl-row_action--'+action).data('ip');\r\n\t\t\t\t\tspbc_sec_logs__filter_ip(ip, send_action, true);\r\n\t\t\t\t\tjQuery(this).prop('checked', false);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tself.children('.tbl-preloader--small').hide();\r\n\t\t\tlet msg = action === 'allow' ? 'Allowed' : 'Banned';\r\n\t\t\tlet html = '<p> Success. Selected IPs have been ' + msg + '. Changes will be applied within 10 minutes.' + '</p>';\r\n\t\t\tspbcModal.open().put( html );\r\n\t\t\tsetTimeout(spbc_reload_accordion, 1900);\r\n\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\tif( action !== '-1' && self.parents('.tbl-root').find('.cb-select').is(':checked') ){\r\n\t\t\tself.children('.tbl-preloader--small').show();\r\n\t\t\tif(self.parents('.tbl-root').find('.cb-select:checked').first().parents('tr').find('.tbl-row_action--'+action)[0]){\r\n\t\t\t\tself.parents('.tbl-root').find('.cb-select:checked').first().parents('tr').find('.tbl-row_action--'+action).click();\r\n\t\t\t\tself.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\r\n\t\t\t}else{\r\n\t\t\t\tself.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\r\n\t\t\t\tself.click();\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\tself.children('.tbl-preloader--small').hide();\r\n\t\t\tspbc_bulk_action = null;\r\n\t\t\tif ( action === 'check_analysis_status' && typeof out !== undefined){\r\n\t\t\t\tlet html = '<p> All available files are updated.' + '</p>';\r\n\t\t\t\tspbcModal.open().put( html );\r\n\t\t\t}\r\n\t\t\tif ( action === 'send' && typeof out !== undefined){\r\n\t\t\t\tlet html = '<p> All available files are sent.' + '</p>';\r\n\t\t\t\tspbcModal.open().put( html );\r\n\t\t\t}\r\n\t\t\tsetTimeout(spbc_reload_accordion, 1900);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n/**\r\n * Cure selected files\r\n * @param current\r\n */\r\nfunction spbc_scanner__cure_selected(current)\r\n{\r\n\tconst selectedItems = current.closest('#spbc_tbl__scanner_cure_log').find('.cb-select:checked');\r\n\tlet selectedIds = [];\r\n\r\n\tif (selectedItems.length === 0) {\r\n\t\talert('Please, select elements.');\r\n\t}\r\n\r\n\tselectedItems.each(function (index, element) {\r\n\t\tconst elementId = jQuery(element).val();\r\n\t\tselectedIds.push(elementId);\r\n\t});\r\n\r\n\tconst data = {\r\n\t\taction: 'spbc_cure_selected',\r\n\t\tsecurity: spbcSettings.ajax_nonce,\r\n\t\tselectedIds: selectedIds,\r\n\t};\r\n\tjQuery.ajax({\r\n\t\ttype: \"POST\",\r\n\t\turl: spbcSettings.ajaxurl,\r\n\t\tdata: data,\r\n\t\tbeforeSend: function () {\r\n\t\t\tcurrent.closest('#spbc_tbl__scanner_cure_log').find('.tbl-button---white_blue .tbl-preloader--in_button').show();\r\n\t\t},\r\n\t\tsuccess: function(result) {\r\n\t\t\tcurrent.closest('#spbc_tbl__scanner_cure_log').find('.tbl-button---white_blue .tbl-preloader--in_button').hide();\r\n\t\t\tif (result.success) {\r\n\t\t\t\tspbcModal.open().put(result.data);\r\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\r\n\t\t\t\t\tdocument.location.reload();\r\n\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tspbcModal.open().putError(result.data);\r\n\t\t\t}\r\n\t\t},\r\n\t});\r\n}\r\n\r\n// TABLE ROW ACTIONS\r\nfunction spbc_tbl__row_actions__listen(){\r\n\tjQuery('.tbl-row_action--ajax')\r\n\t\t.off('click')\r\n\t\t.on('click', function(){\r\n\t\tconsole.log('spbc_tbl__row_actions__listen click');\r\n\t\tif ( spbc_scanner.active ) {\r\n\t\t\talert(spbcTableLocalize.scannerIsActive);\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tvar self = jQuery(this);\r\n\t\tvar data = {\r\n\t\t\taction: 'spbc_tbl-action--row',\r\n\t\t\tadd_action: self.attr('row-action'),\r\n\t\t\tid: self.parents('.row-actions').attr('uid'),\r\n\t\t\tcols: self.parents('.row-actions').attr('cols_amount'),\r\n\t\t\tpage_url: self.parent().attr('uid'),\r\n\t\t\tpage_id: self.parent().attr('page_id'),\r\n\t\t};\r\n\t\tvar params = {\r\n\t\t\tcallback: spbc_tbl__row_actions__callback,\r\n\t\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\r\n\t\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\r\n\t\t};\r\n\t\tif(!spbc_bulk_action){\r\n\t\t\tvar confirmation = spbcTable['warning_'+self.attr('row-action')] || spbcTable.warning_default;\r\n\t\t\tif ( data.add_action === 'copy_file_info' || data.add_action === 'check_analysis_status' || confirm(confirmation) ) {\r\n\t\t\t\tspbc_sendAJAXRequest(data, params, self.parents('tr'));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(spbc_bulk_action){\r\n\t\t\tspbc_sendAJAXRequest(data, params, self.parents('tr'));\r\n\t\t}\r\n\t});\r\n}\r\n\r\n\t// Callback for TABLE ROW ACTIONS\r\nfunction spbc_tbl__row_actions__callback(result, data, params, obj){\r\n\tif(result.color)    {obj.css({background: result.background, color: result.color});}\r\n\tif(result.html)     {\r\n\t\tobj.parent().parent().parent().prepend(result.html)\r\n\t\tsetTimeout(function(){obj.fadeOut(300);}, 1500);\r\n\t\tif( ! spbc_bulk_action) {\r\n\t\t\tsetTimeout(spbc_reload_accordion, 1900);\r\n\t\t}\r\n\t}\r\n\r\n\tif (\r\n\t\tdata.add_action === 'copy_file_info'\r\n\t) {\r\n\t\tif (result.success === true && result.data.file_info){\r\n\t\t\twindow.prompt(\"Copy the file info below and send it to [email protected]: \", result.data.file_info);\r\n\t\t} else {\r\n\t\t\tlet error_text = (typeof result.data.error !== 'undefined') ? result.data.error : 'Unknown copy_file_info error'\r\n\t\t\tspbcModal.open().putError( error_text );\r\n\t\t}\r\n\t}\r\n\r\n\tif(result.temp_html){\r\n\t\tvar tmp=obj.html(); \r\n\t\tobj.html(result.temp_html);\r\n\t\tif (result.updated_template !== undefined) {\r\n\t\t\tlet updatedType = result.updated_template_type;\r\n\t\t\tlet template = result.updated_template;\r\n\t\t\tlet rowsInTemplate = jQuery(template).find('.wp-list-table tbody tr');\r\n\t\t\tlet countRowInTemplate = rowsInTemplate.length;\r\n\t\t\tlet targetTab = jQuery('[aria-controls=\"spbc_scan_accordion_tab_' + updatedType + '\"]');\r\n\r\n\t\t\tif (targetTab.length > 0) {\r\n\t\t\t\tlet table = jQuery('#spbc_tbl__scanner_' + updatedType);\r\n\t\t\t\t// Count files in header\r\n\t\t\t\tjQuery('.spbc_bad_type_count.' + updatedType + '_counter').text(countRowInTemplate);\r\n\t\t\t\t// Count rows in table\r\n\t\t\t\tlet countExistingRows = table.find('.wp-list-table tbody tr').length;\r\n\t\t\t\ttable.remove();\r\n\t\t\t\tjQuery('#spbc_scan_accordion_tab_' + updatedType).append(template);\r\n\t\t\t\t// Marked new rows\r\n\t\t\t\tjQuery(jQuery('#spbc_scan_accordion_tab_' + updatedType).find('.wp-list-table tbody tr')).each(function (index, element) {\r\n\t\t\t\t\tif (++index > countExistingRows) {\r\n\t\t\t\t\t\tjQuery(element).css('outline', '1px solid green');\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\ttargetTab.click();\r\n\t\t\t} else {\r\n\t\t\t\tif (updatedType === 'analysis_log') {\r\n\t\t\t\t\tlet tabHeaderTemplate = '<h3 class=\"ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all\" role=\"tab\" id=\"ui-id-2\" aria-controls=\"spbc_scan_accordion_tab_analysis_log\" aria-selected=\"false\" aria-expanded=\"false\" tabindex=\"-1\"><span class=\"ui-accordion-header-icon ui-icon ui-icon-triangle-1-e\"></span><a href=\"#\">Analysis Log (<span class=\"spbc_bad_type_count analysis_log_counter\">' + countRowInTemplate + '</span>)</a></h3>';\r\n\t\t\t\t\tlet tabBodyTemplate = '<div id=\"spbc_scan_accordion_tab_analysis_log\" class=\"ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content\" aria-labelledby=\"ui-id-2\" role=\"tabpanel\" aria-hidden=\"true\" style=\"display: none;\"><p class=\"spbc_hint\">Files sent for analysis.</p><div id=\"spbc_tbl__scanner_analysis_log\" type=\"analysis_log\" class=\"tbl-root\">' +\r\n\t\t\t\t\t\ttemplate +\r\n\t\t\t\t\t\t'</div>';\r\n\t\t\t\t\tjQuery('#spbc_scan_accordion_tab_critical').after(tabHeaderTemplate + tabBodyTemplate);\r\n\t\t\t\t\ttargetTab.click();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tsetTimeout(function(){\r\n\t\t\tobj.html(tmp).css({background: 'inherit'}).find('.column-primary .row-actions .tbl-row_action--'+data.add_action).remove();\r\n\t\t\tspbc_tbl__bulk_actions__listen();\r\n\t\t\tspbc_tbl__row_actions__listen();\r\n\t\t\tspbcStartShowHide();\r\n\t\t},5000);\r\n\t}\r\n\tif(spbc_bulk_action)\r\n\t\tspbc_bulk_action.click();\r\n}\r\n\r\n// TABLE PAGINATION ACTIONS\r\nfunction spbc_tbl__pagination__listen(){\r\n\tvar data = {action: 'spbc_tbl-pagination',};\r\n\tvar params = {callback: spbc_tbl__pagination__callback, notJson: true,};\r\n\tjQuery('.tbl-pagination--button').on('click', function(){\r\n\t\tjQuery(this).parents('.tbl-root').find('.tbl-pagination--button').attr('disabled', 'disabled');\r\n\t});\r\n\tjQuery('.tbl-pagination--go').on('click', function(){\r\n\t\tvar self = jQuery(this);\r\n\t\tvar obj = self.parents('.tbl-root');\r\n\t\tdata.page = self.siblings('.tbl-pagination--curr_page').val();\r\n\t\tdata.type = obj.attr('type');\r\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\r\n\t\tspbc_sendAJAXRequest(data, params, obj);\r\n\t});\r\n\tjQuery('.tbl-pagination--prev').on('click', function(){\r\n\t\tvar self = jQuery(this);\r\n\t\tvar obj = self.parents('.tbl-root');\r\n\t\tdata.page = self.parents('.tbl-pagination--wrapper').attr('prev_page');\r\n\t\tdata.type = obj.attr('type');\r\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\r\n\t\tspbc_sendAJAXRequest(data, params, obj);\r\n\t});\r\n\tjQuery('.tbl-pagination--next').on('click', function(){\r\n\t\tvar self = jQuery(this);\r\n\t\tvar obj = self.parents('.tbl-root');\r\n\t\tdata.page = self.parents('.tbl-pagination--wrapper').attr('next_page');\r\n\t\tdata.type = obj.attr('type');\r\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\r\n\t\tspbc_sendAJAXRequest(data, params, obj);\r\n\t});\r\n\tjQuery('.tbl-pagination--end').on('click', function(){\r\n\t\tvar self = jQuery(this);\r\n\t\tvar obj = self.parents('.tbl-root');\r\n\t\tdata.page = self.parents('.tbl-pagination--wrapper').attr('last_page');\r\n\t\tdata.type = obj.attr('type');\r\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\r\n\t\tspbc_sendAJAXRequest(data, params, obj);\r\n\t});\r\n\tjQuery('.tbl-pagination--start').on('click', function(){\r\n\t\tvar self = jQuery(this);\r\n\t\tvar obj = self.parents('.tbl-root');\r\n\t\tdata.page = 1;\r\n\t\tdata.type = obj.attr('type');\r\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\r\n\t\tspbc_sendAJAXRequest(data, params, obj);\r\n\t});\r\n}\r\n\r\nfunction spbc_scanner__switch_table(obj, table){\r\n\tvar obj = jQuery(obj);\r\n\tconsole.log(obj.parents('.row-actions').attr('uid'));\r\n\tvar data = {action: 'spbc_tbl-switch', type: table, domain: obj.parents('.row-actions').attr('uid'),};\r\n\tvar params = {callback: spbc_tbl__pagination__callback, notJson: true,};\r\n\tspbc_sendAJAXRequest(data, params, obj.parents('.tbl-root'));\r\n}\r\n\r\n\t// Callback for TABLE PAGINATION ACTIONS\r\nfunction spbc_tbl__pagination__callback(result, data, params, obj){\r\n\t\r\n\tjQuery(obj)\r\n\t\t.html(result)\r\n\t\t.find('.tbl-pagination--button').removeAttr('disabled');\r\n\tspbc_tbl__bulk_actions__listen();\r\n\tspbc_tbl__row_actions__listen();\r\n\tspbc_tbl__pagination__listen();\r\n\tspbc_tbl__sort__listen();\r\n\tspbcStartShowHide();\r\n}\r\n\r\n// TABLE SORT ACTIONS\r\nfunction spbc_tbl__sort__listen(){\r\n\t\r\n\tvar params = {callback: spbc_tbl__sort__callback, notJson: true,};\r\n\tjQuery('.tbl-column-sortable').on('click', function(e){\r\n\t\tif (e.target.classList.contains('tbl-sorting_indicator')) {\r\n\t\t\tvar self = jQuery(this);\r\n\t\t\tvar obj = self.parents('.tbl-root');\r\n\t\t\tvar data = {\r\n\t\t\t\taction:   'spbc_tbl-sort',\r\n\t\t\t\torder_by: self.attr('id'),\r\n\t\t\t\torder:    self.attr('sort_direction'),\r\n\t\t\t\ttype:     obj.attr('type'),\r\n\t\t\t};\r\n\t\t\tspbc_sendAJAXRequest(data, params, obj);\r\n\t\t}\r\n\t});\r\n}\r\n\r\n\t// Callback for TABLE SORT ACTIONS\r\nfunction spbc_tbl__sort__callback(result, data, params, obj){\r\n\tjQuery(obj).html(result);\r\n\tspbc_tbl__bulk_actions__listen();\r\n\tspbc_tbl__row_actions__listen();\r\n\tspbc_tbl__pagination__listen();\r\n\tspbc_tbl__sort__listen();\r\n}\r\n\r\njQuery(document).ready(function(){\r\n\t\r\n\t// Table. Row actions handler\r\n\tspbc_tbl__bulk_actions__listen();\r\n\tspbc_tbl__row_actions__listen();\r\n\tspbc_tbl__pagination__listen();\r\n\tspbc_tbl__sort__listen();\r\n});"],"names":["spbc_reload_accordion","spbc_sendAJAXRequest","action","notJson","callback","result","data","params","obj","jQuery","accordion","html","header","heightStyle","collapsible","active","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","off","on","spbc_scanner","alert","spbcTableLocalize","scannerIsActive","self","this","siblings","children","first","selectedIndex","value","indexOf","confirm","spbcTable","warning_bulk","add_action","status","parents","attr","selectedItems","closest","find","let","selectedIds","each","index","element","elementId","val","push","fileIds","file_ids","button","spinner","out","counters","total","updated","skipped","failed","queued","spbcModal","open","put","files_sent_counter","errorOutput","error_text","comment","putError","timeout","e","spbc_bulk_action","spbc_scanner__cure_selected","spbc_scanner_analysis_log_delete_from_log","send_action","items","msg","show","ip","spbc_sec_logs__filter_ip","prop","hide","setTimeout","is","click","current","length","security","spbcSettings","ajax_nonce","ajax","type","url","ajaxurl","beforeSend","success","document","addEventListener","location","reload","confirmation","console","log","id","cols","page_url","parent","page_id","spbc_tbl__row_actions__callback","warning_default","color","css","background","prepend","fadeOut","file_info","window","prompt","error","temp_html","tmp","undefined","updated_template","updatedType","updated_template_type","template","countRowInTemplate","targetTab","table","text","countExistingRows","remove","append","tabHeaderTemplate","tabBodyTemplate","after","spbc_tbl__pagination__callback","page","spbc_scanner__switch_table","domain","removeAttr","spbc_tbl__sort__callback","target","classList","contains","order_by","order","ready"],"mappings":"AAKA,SAASA,wBACRC,qBACC,CAACC,OAAQ,oCAAoC,EAC7C,CACCC,QAAS,CAAA,EACTC,SAAU,SAASC,EAAQC,EAAMC,EAAQC,GACxCC,OAAOD,CAAG,EAAEE,UAAU,SAAS,EAC/BD,OAAOD,CAAG,EAAEG,KAAKN,CAAM,EACvBI,OAAOD,CAAG,EAAEE,UAAU,CACrBE,OAAQ,KACRC,YAAa,UACbC,YAAa,CAAA,EACbC,OAAQ,CAAA,CACT,CAAC,EACDC,+BAA+B,EAC/BC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,kBAAkB,CACnB,CACD,EACAX,OAAO,sBAAsB,CAC9B,CACD,CAGA,SAASO,iCAERP,OAAO,8BAA8B,EACnCY,IAAI,OAAO,EACXC,GAAG,QAAS,WAEb,GAAKC,aAAaR,OACjBS,MAAMC,kBAAkBC,eAAe,MADxC,CAKA,IAAIC,EAAOlB,OAAOmB,IAAI,EAElB1B,EAASyB,EAAKE,SAAS,QAAQ,EAAEC,SAAS,EAAEH,EAAKE,SAAS,QAAQ,EAAEE,MAAM,EAAE,GAAGC,eAAeC,MAElG,GAA+C,CAAC,IAHrB,CA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A6B,EAC7BC,uBAAuB,CACxB,CA5aAuD,iBAAmB,KA8anBjE,OAAO0F,QAAQ,EAAEmD,MAAM,WAGtBtI,+BAA+B,EAC/BC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,uBAAuB,CACxB,CAAC"}
     1{"version":3,"file":"spbc-table.min.js","sources":["spbc-table.js"],"sourcesContent":["spbc_bulk_action = null;\n\n/**\n * Reloads scanner accordion and set all the listeners\n */\nfunction spbc_reload_accordion(){\n\tspbc_sendAJAXRequest(\n\t\t{action: 'spbc_scanner_tab__reload_accordion'},\n\t\t{\n\t\t\tnotJson: true,\n\t\t\tcallback: function(result, data, params, obj){\n\t\t\t\tjQuery(obj).accordion('destroy');\n\t\t\t\tjQuery(obj).html(result);\n\t\t\t\tjQuery(obj).accordion({\n\t\t\t\t\theader: 'h3',\n\t\t\t\t\theightStyle: 'content',\n\t\t\t\t\tcollapsible: true,\n\t\t\t\t\tactive: false,\n\t\t\t\t});\n\t\t\t\tspbc_tbl__bulk_actions__listen();\n\t\t\t\tspbc_tbl__row_actions__listen();\n\t\t\t\tspbc_tbl__pagination__listen();\n\t\t\t\tspbc_tbl__sort__listen();\n\t\t\t\tspbcStartShowHide();\n\t\t\t},\n\t\t},\n\t\tjQuery('#spbc_scan_accordion')\n\t);\n}\n\n// TABLE BULK ACTIONS\nfunction spbc_tbl__bulk_actions__listen(){\n\n\tjQuery('.tbl-bulk_actions-all--apply')\n\t\t.off('click')\n\t\t.on('click', function(){\n\n\t\tif ( spbc_scanner.active ) {\n\t\t\talert(spbcTableLocalize.scannerIsActive);\n\t\t\treturn;\n\t\t}\n\n\t\tvar self = jQuery(this);\n\t\tvar allowed_bulk_actions = ['approve','disapprove','send','check_analysis_status','approve_page','disapprove_page','cure', 'delete_from_analysis_log'];\n\t\tvar action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\n\n\t\tif( allowed_bulk_actions.indexOf( action ) !== -1 ){\n\n\t\t\tif(!confirm(spbcTable.warning_bulk))\n\t\t\t\treturn;\n\n\t\t\tvar data = {\n\t\t\t\taction: 'spbc_tbl-action--bulk',\n\t\t\t\tadd_action: action,\n\t\t\t\tstatus: self.parents('.tbl-root').attr('type'),\n\t\t\t};\n\n\t\t\tif (action === 'cure') {\n\t\t\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_cure_log').find('.cb-select');\n\t\t\t\tlet selectedIds = [];\n\n\t\t\t\tselectedItems.each(function (index, element) {\n\t\t\t\t\tconst elementId = jQuery(element).val();\n\t\t\t\t\tselectedIds.push(elementId);\n\t\t\t\t});\n\t\t\t\tdata.selectedIds = selectedIds;\n\t\t\t}\n\n\t\t\tif (action === 'delete_from_analysis_log') {\n\t\t\t\tconst selectedItems = self.closest('#spbc_tbl__scanner_analysis_log').find('.cb-select');\n\t\t\t\tlet fileIds = [];\n\n\t\t\t\tselectedItems.each(function (index, element) {\n\t\t\t\t\tconst elementId = jQuery(element).val();\n\t\t\t\t\tfileIds.push(elementId);\n\t\t\t\t});\n\t\t\t\tdata.file_ids = fileIds;\n\t\t\t}\n\n\t\t\tvar params = {\n\t\t\t\tbutton: this,\n\t\t\t\tspinner: self.children('.tbl-preloader--small'),\n\t\t\t\tcallback: function(out) {\n\t\t\t\t\tspbc_reload_accordion();\n\t\t\t\t\tif ( action === 'check_analysis_status' && typeof out !== undefined){\n\t\t\t\t\t\tlet html = '<p> Analysis status updated.'\n\t\t\t\t\t\t\t+ ' Total: ' +  out.counters.total\n\t\t\t\t\t\t\t+ ', updated: ' +  out.counters.updated\n\t\t\t\t\t\t\t+ ', skipped: ' +  out.counters.skipped\n\t\t\t\t\t\t\t+ ', failed: ' + out.counters.failed\n\t\t\t\t\t\t\t+ ', queued: ' +  out.counters.queued\n\t\t\t\t\t\t\t+ '</p>';\n\t\t\t\t\t\tspbcModal.open().put( html );\n\t\t\t\t\t}\n\t\t\t\t\tif ( action === 'send' && typeof out !== undefined){\n\t\t\t\t\t\tlet html = '<p> Files have been sent: '\n\t\t\t\t\t\t\t+ out.files_sent_counter\n\t\t\t\t\t\t\t+ '</p>';\n\t\t\t\t\t\tspbcModal.open().put( html );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\terrorOutput: function( error_text, comment ){\n\t\t\t\t\tif( comment ){\n\t\t\t\t\t\terror_text = error_text + '<br>Additional information:<br>' + comment;\n\t\t\t\t\t}\n\t\t\t\t\tspbcModal.open().putError( error_text );\n\t\t\t\t},\n\t\t\t\ttimeout: 60000,\n\t\t\t};\n\n\t\t\tspbc_sendAJAXRequest(data, params);\n\n\t\t}else{\n\t\t\talert('This action is not supported for all files yet =(')\n\t\t}\n\t});\n\n\tjQuery('.tbl-bulk_actions--apply')\n\t\t.off('click')\n\t\t.on('click', function(e){\n\n\t\tif(!spbc_bulk_action && !confirm(spbcTable.warning_bulk))\n\t\t\treturn;\n\n\t\tvar self = spbc_bulk_action || jQuery(this);\n\t\tspbc_bulk_action = self;\n\t\tvar action = self.siblings('select').children()[self.siblings('select').first()[0].selectedIndex].value;\n\n\t\tif (action === 'cure') {\n\t\t\tspbc_scanner__cure_selected(jQuery(this));\n\t\t\treturn;\n\t\t}\n\n\t\tif (action === 'delete_from_analysis_log') {\n\t\t\tspbc_scanner_analysis_log_delete_from_log(jQuery(this));\n\t\t\treturn;\n\t\t}\n\n\t\tif (action === 'allow' || action === 'ban') {\n\t\t\tlet send_action = action === 'ban' ? 'deny' : action;\n\t\t\tlet items = self.parents('.tbl-root').find('.cb-select:checked');\n\t\t\tif (items) {\n\t\t\t\tself.children('.tbl-preloader--small').show();\n\t\t\t\titems.each(function() {\n\t\t\t\t\tlet ip = jQuery(this).parents('tr').find('.tbl-row_action--'+action).data('ip');\n\t\t\t\t\tspbc_sec_logs__filter_ip(ip, send_action, true);\n\t\t\t\t\tjQuery(this).prop('checked', false);\n\t\t\t\t});\n\t\t\t}\n\t\t\tself.children('.tbl-preloader--small').hide();\n\t\t\tlet msg = action === 'allow' ? 'Allowed' : 'Banned';\n\t\t\tlet html = '<p> Success. Selected IPs have been ' + msg + '. Changes will be applied within 10 minutes.' + '</p>';\n\t\t\tspbcModal.open().put( html );\n\t\t\tsetTimeout(spbc_reload_accordion, 1900);\n\n\t\t\treturn;\n\t\t}\n\n\t\tif( action !== '-1' && self.parents('.tbl-root').find('.cb-select').is(':checked') ){\n\t\t\tself.children('.tbl-preloader--small').show();\n\t\t\tif(self.parents('.tbl-root').find('.cb-select:checked').first().parents('tr').find('.tbl-row_action--'+action)[0]){\n\t\t\t\tself.parents('.tbl-root').find('.cb-select:checked').first().parents('tr').find('.tbl-row_action--'+action).click();\n\t\t\t\tself.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\n\t\t\t}else{\n\t\t\t\tself.parents('.tbl-root').find('.cb-select:checked').first().prop('checked', false);\n\t\t\t\tself.click();\n\t\t\t}\n\t\t}else{\n\t\t\tself.children('.tbl-preloader--small').hide();\n\t\t\tspbc_bulk_action = null;\n\t\t\tif ( action === 'check_analysis_status' && typeof out !== undefined){\n\t\t\t\tlet html = '<p> All available files are updated.' + '</p>';\n\t\t\t\tspbcModal.open().put( html );\n\t\t\t}\n\t\t\tif ( action === 'send' && typeof out !== undefined){\n\t\t\t\tlet html = '<p> All available files are sent.' + '</p>';\n\t\t\t\tspbcModal.open().put( html );\n\t\t\t}\n\t\t\tsetTimeout(spbc_reload_accordion, 1900);\n\t\t}\n\t});\n}\n\n/**\n * Cure selected files\n * @param current\n */\nfunction spbc_scanner__cure_selected(current)\n{\n\tconst selectedItems = current.closest('#spbc_tbl__scanner_cure_log').find('.cb-select:checked');\n\tlet selectedIds = [];\n\n\tif (selectedItems.length === 0) {\n\t\talert('Please, select elements.');\n\t}\n\n\tselectedItems.each(function (index, element) {\n\t\tconst elementId = jQuery(element).val();\n\t\tselectedIds.push(elementId);\n\t});\n\n\tconst data = {\n\t\taction: 'spbc_cure_selected',\n\t\tsecurity: spbcSettings.ajax_nonce,\n\t\tselectedIds: selectedIds,\n\t};\n\tjQuery.ajax({\n\t\ttype: \"POST\",\n\t\turl: spbcSettings.ajaxurl,\n\t\tdata: data,\n\t\tbeforeSend: function () {\n\t\t\tcurrent.closest('#spbc_tbl__scanner_cure_log').find('.tbl-button---white_blue .tbl-preloader--in_button').show();\n\t\t},\n\t\tsuccess: function(result) {\n\t\t\tcurrent.closest('#spbc_tbl__scanner_cure_log').find('.tbl-button---white_blue .tbl-preloader--in_button').hide();\n\t\t\tif (result.success) {\n\t\t\t\tspbcModal.open().put(result.data);\n\t\t\t\tdocument.addEventListener(\"spbcModalClosed\", function( e ) {\n\t\t\t\t\tdocument.location.reload();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tspbcModal.open().putError(result.data);\n\t\t\t}\n\t\t},\n\t});\n}\n\n// TABLE ROW ACTIONS\nfunction spbc_tbl__row_actions__listen(){\n\tjQuery('.tbl-row_action--ajax')\n\t\t.off('click')\n\t\t.on('click', function(){\n\t\tconsole.log('spbc_tbl__row_actions__listen click');\n\t\tif ( spbc_scanner.active ) {\n\t\t\talert(spbcTableLocalize.scannerIsActive);\n\t\t\treturn;\n\t\t}\n\t\tvar self = jQuery(this);\n\t\tvar data = {\n\t\t\taction: 'spbc_tbl-action--row',\n\t\t\tadd_action: self.attr('row-action'),\n\t\t\tid: self.parents('.row-actions').attr('uid'),\n\t\t\tcols: self.parents('.row-actions').attr('cols_amount'),\n\t\t\tpage_url: self.parent().attr('uid'),\n\t\t\tpage_id: self.parent().attr('page_id'),\n\t\t};\n\t\tvar params = {\n\t\t\tcallback: spbc_tbl__row_actions__callback,\n\t\t\terrorOutput: function(msg){ spbcModal.open().putError( msg ); },\n\t\t\tspinner: self.parent().siblings('.tbl-preloader--tiny'),\n\t\t};\n\t\tif(!spbc_bulk_action){\n\t\t\tvar confirmation = spbcTable['warning_'+self.attr('row-action')] || spbcTable.warning_default;\n\t\t\tif ( data.add_action === 'copy_file_info' || data.add_action === 'check_analysis_status' || confirm(confirmation) ) {\n\t\t\t\tspbc_sendAJAXRequest(data, params, self.parents('tr'));\n\t\t\t}\n\t\t}\n\t\tif(spbc_bulk_action){\n\t\t\tspbc_sendAJAXRequest(data, params, self.parents('tr'));\n\t\t}\n\t});\n}\n\n\t// Callback for TABLE ROW ACTIONS\nfunction spbc_tbl__row_actions__callback(result, data, params, obj){\n\tif(result.color)    {obj.css({background: result.background, color: result.color});}\n\tif(result.html)     {\n\t\tobj.parent().parent().parent().prepend(result.html)\n\t\tsetTimeout(function(){obj.fadeOut(300);}, 1500);\n\t\tif( ! spbc_bulk_action) {\n\t\t\tsetTimeout(spbc_reload_accordion, 1900);\n\t\t}\n\t}\n\n\tif (\n\t\tdata.add_action === 'copy_file_info'\n\t) {\n\t\tif (result.success === true && result.data.file_info){\n\t\t\twindow.prompt(\"Copy the file info below and send it to [email protected]: \", result.data.file_info);\n\t\t} else {\n\t\t\tlet error_text = (typeof result.data.error !== 'undefined') ? result.data.error : 'Unknown copy_file_info error'\n\t\t\tspbcModal.open().putError( error_text );\n\t\t}\n\t}\n\n\tif(result.temp_html){\n\t\tvar tmp=obj.html(); \n\t\tobj.html(result.temp_html);\n\t\tif (result.updated_template !== undefined) {\n\t\t\tlet updatedType = result.updated_template_type;\n\t\t\tlet template = result.updated_template;\n\t\t\tlet rowsInTemplate = jQuery(template).find('.wp-list-table tbody tr');\n\t\t\tlet countRowInTemplate = rowsInTemplate.length;\n\t\t\tlet targetTab = jQuery('[aria-controls=\"spbc_scan_accordion_tab_' + updatedType + '\"]');\n\n\t\t\tif (targetTab.length > 0) {\n\t\t\t\tlet table = jQuery('#spbc_tbl__scanner_' + updatedType);\n\t\t\t\t// Count files in header\n\t\t\t\tjQuery('.spbc_bad_type_count.' + updatedType + '_counter').text(countRowInTemplate);\n\t\t\t\t// Count rows in table\n\t\t\t\tlet countExistingRows = table.find('.wp-list-table tbody tr').length;\n\t\t\t\ttable.remove();\n\t\t\t\tjQuery('#spbc_scan_accordion_tab_' + updatedType).append(template);\n\t\t\t\t// Marked new rows\n\t\t\t\tjQuery(jQuery('#spbc_scan_accordion_tab_' + updatedType).find('.wp-list-table tbody tr')).each(function (index, element) {\n\t\t\t\t\tif (++index > countExistingRows) {\n\t\t\t\t\t\tjQuery(element).css('outline', '1px solid green');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\ttargetTab.click();\n\t\t\t} else {\n\t\t\t\tif (updatedType === 'analysis_log') {\n\t\t\t\t\tlet tabHeaderTemplate = '<h3 class=\"ui-accordion-header ui-corner-top ui-state-default ui-accordion-icons ui-accordion-header-collapsed ui-corner-all\" role=\"tab\" id=\"ui-id-2\" aria-controls=\"spbc_scan_accordion_tab_analysis_log\" aria-selected=\"false\" aria-expanded=\"false\" tabindex=\"-1\"><span class=\"ui-accordion-header-icon ui-icon ui-icon-triangle-1-e\"></span><a href=\"#\">Analysis Log (<span class=\"spbc_bad_type_count analysis_log_counter\">' + countRowInTemplate + '</span>)</a></h3>';\n\t\t\t\t\tlet tabBodyTemplate = '<div id=\"spbc_scan_accordion_tab_analysis_log\" class=\"ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content\" aria-labelledby=\"ui-id-2\" role=\"tabpanel\" aria-hidden=\"true\" style=\"display: none;\"><p class=\"spbc_hint\">Files sent for analysis.</p><div id=\"spbc_tbl__scanner_analysis_log\" type=\"analysis_log\" class=\"tbl-root\">' +\n\t\t\t\t\t\ttemplate +\n\t\t\t\t\t\t'</div>';\n\t\t\t\t\tjQuery('#spbc_scan_accordion_tab_critical').after(tabHeaderTemplate + tabBodyTemplate);\n\t\t\t\t\ttargetTab.click();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tsetTimeout(function(){\n\t\t\tobj.html(tmp).css({background: 'inherit'}).find('.column-primary .row-actions .tbl-row_action--'+data.add_action).remove();\n\t\t\tspbc_tbl__bulk_actions__listen();\n\t\t\tspbc_tbl__row_actions__listen();\n\t\t\tspbcStartShowHide();\n\t\t},5000);\n\t}\n\tif(spbc_bulk_action)\n\t\tspbc_bulk_action.click();\n}\n\n// TABLE PAGINATION ACTIONS\nfunction spbc_tbl__pagination__listen(){\n\tvar data = {action: 'spbc_tbl-pagination',};\n\tvar params = {callback: spbc_tbl__pagination__callback, notJson: true,};\n\tjQuery('.tbl-pagination--button').on('click', function(){\n\t\tjQuery(this).parents('.tbl-root').find('.tbl-pagination--button').attr('disabled', 'disabled');\n\t});\n\tjQuery('.tbl-pagination--go').on('click', function(){\n\t\tvar self = jQuery(this);\n\t\tvar obj = self.parents('.tbl-root');\n\t\tdata.page = self.siblings('.tbl-pagination--curr_page').val();\n\t\tdata.type = obj.attr('type');\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\n\t\tspbc_sendAJAXRequest(data, params, obj);\n\t});\n\tjQuery('.tbl-pagination--prev').on('click', function(){\n\t\tvar self = jQuery(this);\n\t\tvar obj = self.parents('.tbl-root');\n\t\tdata.page = self.parents('.tbl-pagination--wrapper').attr('prev_page');\n\t\tdata.type = obj.attr('type');\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\n\t\tspbc_sendAJAXRequest(data, params, obj);\n\t});\n\tjQuery('.tbl-pagination--next').on('click', function(){\n\t\tvar self = jQuery(this);\n\t\tvar obj = self.parents('.tbl-root');\n\t\tdata.page = self.parents('.tbl-pagination--wrapper').attr('next_page');\n\t\tdata.type = obj.attr('type');\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\n\t\tspbc_sendAJAXRequest(data, params, obj);\n\t});\n\tjQuery('.tbl-pagination--end').on('click', function(){\n\t\tvar self = jQuery(this);\n\t\tvar obj = self.parents('.tbl-root');\n\t\tdata.page = self.parents('.tbl-pagination--wrapper').attr('last_page');\n\t\tdata.type = obj.attr('type');\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\n\t\tspbc_sendAJAXRequest(data, params, obj);\n\t});\n\tjQuery('.tbl-pagination--start').on('click', function(){\n\t\tvar self = jQuery(this);\n\t\tvar obj = self.parents('.tbl-root');\n\t\tdata.page = 1;\n\t\tdata.type = obj.attr('type');\n\t\tparams.spinner = self.siblings('.tbl-preloader--small');\n\t\tspbc_sendAJAXRequest(data, params, obj);\n\t});\n}\n\nfunction spbc_scanner__switch_table(obj, table){\n\tvar obj = jQuery(obj);\n\tconsole.log(obj.parents('.row-actions').attr('uid'));\n\tvar data = {action: 'spbc_tbl-switch', type: table, domain: obj.parents('.row-actions').attr('uid'),};\n\tvar params = {callback: spbc_tbl__pagination__callback, notJson: true,};\n\tspbc_sendAJAXRequest(data, params, obj.parents('.tbl-root'));\n}\n\n\t// Callback for TABLE PAGINATION ACTIONS\nfunction spbc_tbl__pagination__callback(result, data, params, obj){\n\t\n\tjQuery(obj)\n\t\t.html(result)\n\t\t.find('.tbl-pagination--button').removeAttr('disabled');\n\tspbc_tbl__bulk_actions__listen();\n\tspbc_tbl__row_actions__listen();\n\tspbc_tbl__pagination__listen();\n\tspbc_tbl__sort__listen();\n\tspbcStartShowHide();\n}\n\n// TABLE SORT ACTIONS\nfunction spbc_tbl__sort__listen(){\n\t\n\tvar params = {callback: spbc_tbl__sort__callback, notJson: true,};\n\tjQuery('.tbl-column-sortable').on('click', function(e){\n\t\tif (e.target.classList.contains('tbl-sorting_indicator')) {\n\t\t\tvar self = jQuery(this);\n\t\t\tvar obj = self.parents('.tbl-root');\n\t\t\tvar data = {\n\t\t\t\taction:   'spbc_tbl-sort',\n\t\t\t\torder_by: self.attr('id'),\n\t\t\t\torder:    self.attr('sort_direction'),\n\t\t\t\ttype:     obj.attr('type'),\n\t\t\t};\n\t\t\tspbc_sendAJAXRequest(data, params, obj);\n\t\t}\n\t});\n}\n\n\t// Callback for TABLE SORT ACTIONS\nfunction spbc_tbl__sort__callback(result, data, params, obj){\n\tjQuery(obj).html(result);\n\tspbc_tbl__bulk_actions__listen();\n\tspbc_tbl__row_actions__listen();\n\tspbc_tbl__pagination__listen();\n\tspbc_tbl__sort__listen();\n}\n\njQuery(document).ready(function(){\n\t\n\t// Table. Row actions handler\n\tspbc_tbl__bulk_actions__listen();\n\tspbc_tbl__row_actions__listen();\n\tspbc_tbl__pagination__listen();\n\tspbc_tbl__sort__listen();\n});\n\nfunction show_hide_rows(block_id, column_key) {\n\tlet className = '.' + column_key + '_block_' + block_id;\n\tlet block = jQuery(className);\n\tif (block.hasClass(\"mob_table_active\")){\n\t\tblock.removeClass(\"mob_table_active\")\n\t} else {\n\t\tblock.addClass(\"mob_table_active\");\n\t}\n}\n"],"names":["spbc_reload_accordion","spbc_sendAJAXRequest","action","notJson","callback","result","data","params","obj","jQuery","accordion","html","header","heightStyle","collapsible","active","spbc_tbl__bulk_actions__listen","spbc_tbl__row_actions__listen","spbc_tbl__pagination__listen","spbc_tbl__sort__listen","spbcStartShowHide","off","on","spbc_scanner","alert","spbcTableLocalize","scannerIsActive","self","this","siblings","children","first","selectedIndex","value","indexOf","confirm","spbcTable","warning_bulk","add_action","status","parents","attr","selectedItems","closest","find","let","selectedIds","each","index","element","elementId","val","push","fileIds","file_ids","button","spinner","out","counters","total","updated","skipped","failed","queued","spbcModal","open","put","files_sent_counter","errorOutput","error_text","comment","putError","timeout","e","spbc_bulk_action","spbc_scanner__cure_selected","spbc_scanner_analysis_log_delete_from_log","send_action","items","msg","show","ip","spbc_sec_logs__filter_ip","prop","hide","setTimeout","is","click","current","length","security","spbcSettings","ajax_nonce","ajax","type","url","ajaxurl","beforeSend","success","document","addEventListener","location","reload","confirmation","console","log","id","cols","page_url","parent","page_id","spbc_tbl__row_actions__callback","warning_default","color","css","background","prepend","fadeOut","file_info","window","prompt","error","temp_html","tmp","undefined","updated_template","updatedType","updated_template_type","template","countRowInTemplate","targetTab","table","text","countExistingRows","remove","append","tabHeaderTemplate","tabBodyTemplate","after","spbc_tbl__pagination__callback","page","spbc_scanner__switch_table","domain","removeAttr","spbc_tbl__sort__callback","target","classList","contains","order_by","order","show_hide_rows","block_id","column_key","block","hasClass","removeClass","addClass","ready"],"mappings":"AAKA,SAASA,wBACRC,qBACC,CAACC,OAAQ,oCAAoC,EAC7C,CACCC,QAAS,CAAA,EACTC,SAAU,SAASC,EAAQC,EA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C9BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,kBAAkB,CACnB,CAGA,SAASD,yBAER,IAAIZ,EAAS,CAACH,SAAU4I,yBAA0B7I,QAAS,CAAA,CAAK,EAChEM,OAAO,sBAAsB,EAAEa,GAAG,QAAS,SAASmD,GACnD,IAEKjE,EAFDiE,EAAEwE,OAAOC,UAAUC,SAAS,uBAAuB,IAElD3I,GADAmB,EAAOlB,OAAOmB,IAAI,GACPY,QAAQ,WAAW,EAC9BlC,EAAO,CACVJ,OAAU,gBACVkJ,SAAUzH,EAAKc,KAAK,IAAI,EACxB4G,MAAU1H,EAAKc,KAAK,gBAAgB,EACpCqD,KAAUtF,EAAIiC,KAAK,MAAM,CAC1B,EACAxC,qBAAqBK,EAAMC,EAAQC,CAAG,EAExC,CAAC,CACF,CAGA,SAASwI,yBAAyB3I,EAAQC,EAAMC,EAAQC,GACvDC,OAAOD,CAAG,EAAEG,KAAKN,CAAM,EACvBW,+BAA+B,EAC/BC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,uBAAuB,CACxB,CAWA,SAASmI,eAAeC,EAAUC,GAE7BC,EAAQhJ,OADI,IAAM+I,EAAa,UAAYD,CACnB,EACxBE,EAAMC,SAAS,kBAAkB,EACpCD,EAAME,YAAY,kBAAkB,EAEpCF,EAAMG,SAAS,kBAAkB,CAEnC,CA/bAlF,iBAAmB,KA8anBjE,OAAO0F,QAAQ,EAAE0D,MAAM,WAGtB7I,+BAA+B,EAC/BC,8BAA8B,EAC9BC,6BAA6B,EAC7BC,uBAAuB,CACxB,CAAC"}
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/API.php

    r2976352 r3022805  
    565565     * @param string $scan_result "passed"|"warning"
    566566     * @param int $scanned_total
    567      * @param array $modified List of modified files with details
    568      * @param array $unknown List of modified files with details
     567     * @param array $critical_files_found List of modified files with details
     568     * @param array $unknown_files_found List of modified files with details
    569569     *
    570570     * @return array|bool|mixed
     
    578578        $total_core_files,
    579579        $total_site_files,
    580         $modified,
    581         $unknown,
     580        $critical_files_found,
     581        $suspicious_files_found,
     582        $unknown_files_found,
    582583        $scan_type,
    583584        $checksums_count_ct,
     
    608609        );
    609610
    610         if ( ! empty($modified)) {
    611             $request['failed_files']      = json_encode($modified);
    612             $request['failed_files_rows'] = count($modified);
    613         }
    614         if ( ! empty($unknown)) {
    615             $request['unknown_files']      = json_encode($unknown);
    616             $request['unknown_files_rows'] = count($unknown);
     611        if ( ! empty($critical_files_found)) {
     612            $request['failed_files']      = json_encode($critical_files_found);
     613            $request['failed_files_rows'] = count($critical_files_found);
     614        }
     615        if ( ! empty($suspicious_files_found)) {
     616            $request['suspicious_files']      = json_encode($suspicious_files_found);
     617            $request['suspicious_files_rows'] = count($suspicious_files_found);
     618        }
     619        if ( ! empty($unknown_files_found)) {
     620            $request['unknown_files']      = json_encode($unknown_files_found);
     621            $request['unknown_files_rows'] = count($unknown_files_found);
    617622        }
    618623
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/Cron.php

    r2770536 r3022805  
    119119
    120120            if (function_exists($this->handler)) {
    121                 $result = call_user_func_array($this->handler, isset($this->params) ? $this->params : array());
     121                $result = call_user_func($this->handler, isset($this->params) ? $this->params : array());
    122122
    123123                if (empty($result['error'])) {
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/HTTP/Request.php

    r2825041 r3022805  
    447447                    $this->options[CURLOPT_MAXREDIRS]      = 0;
    448448                    break;
    449                 // Get headers only
    450449                case 'get_code':
    451450                    $this->options[CURLOPT_HEADER] = true;
     
    460459                    );
    461460                    break;
    462                 // Get headers only
    463461                case 'split_to_array':
    464462                    $this->addCallback(
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/Helpers/Arr.php

    r2770536 r3022805  
    7777                // Scalar | array => array
    7878            } elseif (isset($arr1[$key]) && ! is_array($arr1[$key]) && is_array($val)) {
    79                 $tmp            = $arr1[$key] =
     79                $tmp = $arr1[$key];
    8080                $arr1[$key] = $val;
    8181                $arr1[$key][] = $tmp;
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/Controller.php

    r2976352 r3022805  
    7171        if ( !empty($verdict) ) {
    7272            $output->weak_spots = $verdict;
    73             $output->severity = (
    74                 array_key_exists('CRITICAL', $verdict) ||
    75                 array_key_exists('SIGNATURES', $verdict)
    76             )
     73            $output->severity = array_key_exists('SIGNATURES', $verdict)
    7774                ? 'CRITICAL'
    78                 : (
    79                 array_key_exists('DANGER', $verdict)
    80                     ? 'DANGER'
    81                     : 'SUSPICIOUS'
    82                 );
     75                : 'SUSPICIOUS';
    8376            $output->status = (
    8477                array_key_exists('CRITICAL', $verdict) ||
    8578                array_key_exists('SIGNATURES', $verdict) ||
    86                 array_key_exists('SUSPICIOUS', $verdict) ||
    87                 array_key_exists('DANGER', $verdict)
     79                array_key_exists('SUSPICIOUS', $verdict)
    8880            )
    8981                ? 'INFECTED'
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/HeuristicAnalyser.php

    r3011278 r3022805  
    8686
    8787    private $bad_constructs = array(
    88         'CRITICAL'   => array(
     88        'SUSPICIOUS' => array(
     89            'str_rot13',
     90            'syslog',
    8991            'eval',
    9092            'assert',
    9193            'create_function',
    9294            'shell_exec',
    93             // 'unserialize',
    94         ),
    95         'DANGER'     => array(
    9695            'system',
    9796            'passthru',
     
    101100            'popen',
    102101            '`',
    103         ),
    104         'SUSPICIOUS' => array(
    105             'str_rot13',
    106             'syslog',
     102            // 'unserialize',
    107103        ),
    108104    );
     
    448444                        // If common bad structures found, then check containment for superglobals
    449445                        if ($found_malware_key !== false && $this->checkingSuperGlobalsInTheSystemCommands($this->tokens->current)) {
    450                             $this->verdict['CRITICAL'][$this->tokens->current->line][] = 'global variables in a sys command';
     446                            $this->verdict['SUSPICIOUS'][$this->tokens->current->line][] = 'global variables in a sys command';
    451447                            break;
    452448                        }
     
    455451                        if ( $current_token_value === '`' ) {
    456452                            if ( $this->checkingShellCommand($this->tokens->current) ) {
    457                                 $this->verdict['CRITICAL'][$this->tokens->current->line][] = 'shell command inside the backticks';
     453                                $this->verdict['SUSPICIOUS'][$this->tokens->current->line][] = 'shell command inside the backticks';
    458454                            }
    459455                            break;
     
    472468                    true
    473469                );
    474                 $this->verdict['CRITICAL'][$this->tokens->current->line][] = $this->dangerous_decoded_values[$found_malware_key];
     470                $this->verdict['SUSPICIOUS'][$this->tokens->current->line][] = $this->dangerous_decoded_values[$found_malware_key];
    475471            } elseif ($this->checkingGluedToken($this->tokens->current)) {
    476472                $this->verdict['SUSPICIOUS'][$this->tokens->current->line][] = 'obfuscation tag script';
    477473            } elseif ($this->checkingDecryptedToken($this->tokens->current)) {
    478                 $this->verdict['CRITICAL'][$this->tokens->current->line][] = 'the function contains suspicious arguments';
     474                $this->verdict['SUSPICIOUS'][$this->tokens->current->line][] = 'the function contains suspicious arguments';
    479475            }
    480476        }
     
    484480            if ( $include['status'] === false ) {
    485481                if ( $include['not_url'] === false && $include['ext_good'] === false ) {
    486                     $this->verdict['CRITICAL'][$include['string']][] = substr(
     482                    $this->verdict['SUSPICIOUS'][$include['string']][] = substr(
    487483                        $this->tokens->glueTokens(ExtendedSplFixedArray::createFromArray($include['include'])),
    488484                        0,
  • security-malware-firewall/trunk/lib/CleantalkSP/Common/Scanner/HeuristicAnalyser/Modules/Tokens.php

    r3011278 r3022805  
    2121{
    2222    /**
    23      * @var Token|null
    24      */
    25     public $prev4;
    26     /**
    27      * @var Token|null
    28      */
    29     public $prev3;
    30     /**
    31      * @var Token|null
    32      */
    33     public $prev2;
    34         /**
    35      * @var Token|null
    36      */
    37     public $prev1;
    38         /**
    39      * @var Token|null
    40      */
    41     public $current;
    42         /**
    43      * @var Token|null
    44      */
    45     public $next1;
    46         /**
    47      * @var Token|null
    48      */
    49     public $next2;
    50         /**
    51      * @var Token|null
    52      */
    53     public $next3;
    54         /**
    55      * @var Token|null
    56      */
    57     public $next4;
    58 
    59     /**
    6023     * @var int Shows the current position in the set of tokens
    6124     */
     
    684647     * @return Token|null
    685648     * @psalm-suppress PossiblyUnusedReturnValue
    686      * @psalm-suppress PossiblyUnusedMethod
    687649     */
    688650    public function __get($name)
     
    718680     * @param $name
    719681     * @param $value
    720      * @psalm-suppress PossiblyUnusedMethod
    721682     */
    722683    public function __set($name, $value)
  • security-malware-firewall/trunk/lib/CleantalkSP/Fpdf/Pdf.php

    r2922067 r3022805  
    6868            'signature_results' => esc_html__('Signature analysis', 'security-malware-firewall'),
    6969            'critical_files' => esc_html__('Critical files list', 'security-malware-firewall'),
     70            'suspicious_files' => esc_html__('Suspicious files list', 'security-malware-firewall'),
    7071            'main_title' => esc_html__('Malware Scanner logs', 'security-malware-firewall'),
    7172            'brand_title' => $spbc->data["wl_brandname"],
     
    144145                break;
    145146
     147            case 'suspicious_files':
     148                $query_result = DB::getInstance()->fetchAll(
     149                    "SELECT `path` FROM " . SPBC_TBL_SCAN_FILES
     150                    . " WHERE severity = 'SUSPICIOUS'"
     151                );
     152                $data = !empty($query_result) ? $query_result : array();
     153                break;
     154
    146155            case 'cure_log':
    147156                $cure_log = new CureLog();
     
    238247                switch ($type) {
    239248                    case 'critical_files':
     249                    case 'suspicious_files':
    240250                        foreach ( array_values($data) as $value ) {
    241251                            $this->MultiCell(195, 7, '../' . $value['path']);
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Activator.php

    r3011278 r3022805  
    44
    55use CleantalkSP\SpbctWP\Cron as SpbcCron;
     6use CleantalkSP\SpbctWP\HTTP\CDNHeadersChecker;
    67
    78class Activator
     
    1718    {
    1819        global $wpdb, $spbc;
     20
     21        CDNHeadersChecker::sendCDNCheckerRequest();
    1922
    2023        if ( current_action() !== 'wp_insert_site' ) {
     
    8689            SpbcCron::addTask('security_log_clear', 'spbc_security_log_clear', 86400, time() + 43200);
    8790            SpbcCron::addTask('get_brief_data', 'spbc_set_brief_data', 86400, time() + 1800);
     91            SpbcCron::addTask('cdn_check', 'spbc_cdn_checker__send_request', 86400, time() + 86400);
    8892
    8993            if ( empty($spbc->errors['configuration']) ) {
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/DB/SQLSchema.php

    r3005428 r3022805  
    1717     */
    1818    protected static $schemas__common = array(
    19         'firewall_data' => array(
    20             'columns' => array(
    21                 array('field' => 'id', 'type' => 'char(32)', 'null' => 'no',),
     19        'firewall_data_v4' => array(
     20            'columns' => array(
     21                array('field' => 'id', 'type'  => 'int unsigned', 'null'  => 'no', 'extra' => 'AUTO_INCREMENT'),
     22                array('field' => 'network', 'type' => 'int unsigned', 'null' => 'no', 'default' => '0',),
     23                array('field' => 'mask', 'type' => 'int unsigned', 'null' => 'no', 'default' => '0',),
     24                array('field' => 'country_code', 'type' => 'char(2)', 'null' => 'yes', 'default' => 'NULL',),
     25                array('field' => 'status', 'type' => 'tinyint', 'null' => 'yes',),
     26            ),
     27            'indexes' => array(
     28                array('type' => 'PRIMARY', 'name' => 'KEY', 'body' => '(`id`)'),
     29                array(
     30                    'type' => 'INDEX',
     31                    'name' => 'network',
     32                    'body' => '(`network`, `mask`)'
     33                ),
     34            ),
     35        ),
     36        'firewall_data_v6' => array(
     37            'columns' => array(
     38                array('field' => 'id', 'type'  => 'int unsigned', 'null'  => 'no', 'extra' => 'AUTO_INCREMENT'),
    2239                array('field' => 'network1', 'type' => 'int unsigned', 'null' => 'no', 'default' => '0',),
    2340                array('field' => 'network2', 'type' => 'int unsigned', 'null' => 'no', 'default' => '0',),
     
    6279                ),
    6380                array('field' => 'version', 'type' => 'varchar(20)', 'null' => 'yes', 'default' => 'NULL',),
    64                 array(
    65                     'field'   => 'checked',
    66                     'type'    => 'enum("NO", "YES", "YES_SIGNATURE", "YES_HEURISTIC")',
    67                     'null'    => 'no',
    68                     'default' => '"NO"',
    69                 ),
    7081                array('field' => 'checked_heuristic', 'type' => 'int', 'null' => 'no', 'default' => '0',),
    7182                array('field' => 'checked_signatures', 'type' => 'int', 'null' => 'no', 'default' => '0',),
    7283                array(
    7384                    'field'   => 'status',
    74                     'type'    => 'enum("UNKNOWN","OK","APROVED","APPROVED_BY_CT","DENIED_BY_CT","MODIFIED","INFECTED","QUARANTINED", "DENIED_BY_CLOUD", "APPROVED_BY_CLOUD")',
     85                    'type'    => 'enum("UNKNOWN","OK","APPROVED_BY_USER","APPROVED_BY_CT","DENIED_BY_CT","MODIFIED","INFECTED","QUARANTINED", "DENIED_BY_CLOUD", "APPROVED_BY_CLOUD")',
    7586                    'null'    => 'no',
    7687                    'default' => '"UNKNOWN"',
     
    7889                array(
    7990                    'field'   => 'severity',
    80                     'type'    => 'enum("CRITICAL", "DANGER", "SUSPICIOUS", "NONE")',
     91                    'type'    => 'enum("CRITICAL", "SUSPICIOUS", "NONE")',
    8192                    'null'    => 'yes',
    8293                    'default' => 'NULL',
     
    344355        ),
    345356
    346         'firewall__personal_ips' => array(
     357        'firewall__personal_ips_v4' => array(
     358            'columns' => array(
     359                array('field' => 'id', 'type' => 'int', 'null' => 'no', 'extra' => 'AUTO_INCREMENT'),
     360                array('field' => 'network', 'type' => 'int unsigned', 'null' => 'no', 'default' => '0',),
     361                array('field' => 'mask', 'type' => 'int unsigned', 'null' => 'no', 'default' => '0',),
     362                array('field' => 'status', 'type' => 'tinyint', 'null' => 'no', 'default' => '0',),
     363            ),
     364            'indexes' => array(
     365                array('type' => 'PRIMARY', 'name' => 'KEY', 'body' => '(`id`)'),
     366                array(
     367                    'type' => 'INDEX',
     368                    'name' => 'network',
     369                    'body' => '(`network`, `mask`)'
     370                ),
     371            ),
     372        ),
     373
     374        'firewall__personal_ips_v6' => array(
    347375            'columns' => array(
    348376                array('field' => 'id', 'type' => 'int', 'null' => 'no', 'extra' => 'AUTO_INCREMENT'),
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/DTO/MScanFilesDTO.php

    r2976352 r3022805  
    3636
    3737        // make weak_spots values unique
    38         if (empty($this->dangerous_code) || $this->dangerous_code[0] === 'NULL') {
    39             $this->dangerous_code = array();
     38        if ( empty($this->dangerous_code) ||
     39            (isset($this->dangerous_code[0]) && $this->dangerous_code[0] === 'NULL')
     40        ) {
     41            $this->dangerous_code = '{}';
    4042        } else if ( is_array($this->dangerous_code) ) {
    4143            foreach ($this->dangerous_code as $_type => &$ws_strings_arr) {
     
    4850            }
    4951            unset($ws_strings_arr);
     52            $this->dangerous_code = json_encode($this->dangerous_code);
    5053        }
    5154    }
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Deactivator.php

    r3011278 r3022805  
    256256        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_auth_logs');
    257257        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_monitoring_users');
    258         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall__personal_ips');
     258        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall__personal_ips_v4');
     259        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall__personal_ips_v6');
    259260        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall__personal_countries');
    260261        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall_logs');
     
    273274        global $wpdb;
    274275        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_scan_results');
    275         $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_firewall_data');
     276        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_firewall_data_v4');
     277        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_firewall_data_v6');
    276278        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_scan_links_logs');
    277279        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_scan_signatures');
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Escape.php

    r2976352 r3022805  
    101101                ),
    102102            ),
     103            'spbc_cdn_checker_table' => array(
     104                'a' => array(
     105                    'style' => true,
     106                    'href' => true,
     107                    'onclick' => true,
     108                ),
     109                'p' => array(),
     110                'b' => array(),
     111                'table' => array(
     112                    'id' => true,
     113                    'style' => true,
     114                ),
     115                'tr' => array(
     116                    'class' => true,
     117                    'style' => true,
     118                ),
     119                'th' => array(
     120                    'style' => true,
     121                    'class' => true,
     122                ),
     123                'td' => array(
     124                    'colspan' => true,
     125                    'style' => true,
     126                    'class' => true,
     127                ),
     128                'tbody' => true,
     129                'div' => array()
     130            ),
    103131            'spbc_settings__notice_autosend' => array(
    104132                'div' => array(
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Firewall/FW.php

    r2998673 r3022805  
    1616    public $module_name = 'FW';
    1717
    18     public $data_table__common = '';
    19     public $data_table__personal = '';
    2018    public $data_table__personal_countries = '';
    2119
     
    119117                            'is_personal'  => $entry['is_personal'],
    120118                            'country_code' => $entry['country_code'],
    121                             'network'      => $entry['network4'],
    122                             'mask'         => $entry['mask4'],
     119                            'network'      => $version === 'v4' ? $entry['network'] : $entry['network4'],
     120                            'mask'         => $version === 'v4' ? $entry['mask'] : $entry['mask4'],
    123121                            'status'       => $text_status,
    124122                        )
     
    149147    protected function ipv4GetResultsFromDb($ip)
    150148    {
    151         $current_ipv4s = IP::getFourIPv4FromIP($ip);
    152         $needles = IP::getNetworkNeedles($current_ipv4s);
     149        $current_ipv4 = sprintf('%u', ip2long($ip));
     150        $needles = IP::getNetworkNeedles([$current_ipv4]);
     151        $data_table__common_v4 = SPBC_TBL_FIREWALL_DATA_V4;
     152        $data_table__personal_v4 = SPBC_TBL_FIREWALL_DATA__IPS_V4;
    153153
    154154        $query_ipv4 = '(
    155                 SELECT 0 AS is_personal, 1 AS is_ip, status, country_code, network1, network2, network3, network4, mask1, mask2, mask3, mask4
    156                 FROM ' . $this->data_table__common . '
    157                 WHERE
    158                         network1 IN (' . $needles[0] . ')
    159                     AND network2 IN (' . $needles[1] . ')
    160                     AND network3 IN (' . $needles[2] . ')
    161                     AND network4 IN (' . $needles[3] . ')
    162                     AND network1 = ' . $current_ipv4s[0] . ' & mask1
    163                     AND network2 = ' . $current_ipv4s[1] . ' & mask2
    164                     AND network3 = ' . $current_ipv4s[2] . ' & mask3
    165                     AND network4 = ' . $current_ipv4s[3] . ' & mask4
     155                SELECT 0 AS is_personal, 1 AS is_ip, status, country_code, network, mask
     156                FROM ' . $data_table__common_v4 . '
     157                WHERE network IN (' . current($needles) . ')
     158                    AND network = ' . $current_ipv4 . ' & mask
    166159                    AND country_code = "0"
    167160            ) UNION (
    168                 SELECT 1 AS is_personal, 1 AS is_ip, status, 0 AS country_code, network1, network2, network3, network4, mask1, mask2, mask3, mask4
    169                 FROM ' . $this->data_table__personal . '
    170                 WHERE
    171                         network1 IN (' . $needles[0] . ')
    172                     AND network2 IN (' . $needles[1] . ')
    173                     AND network3 IN (' . $needles[2] . ')
    174                     AND network4 IN (' . $needles[3] . ')
    175                     AND network1 = ' . $current_ipv4s[0] . ' & mask1
    176                     AND network2 = ' . $current_ipv4s[1] . ' & mask2
    177                     AND network3 = ' . $current_ipv4s[2] . ' & mask3
    178                     AND network4 = ' . $current_ipv4s[3] . ' & mask4
     161                SELECT 1 AS is_personal, 1 AS is_ip, status, 0 AS country_code, network, mask
     162                FROM ' . $data_table__personal_v4 . '
     163                WHERE network IN (' . current($needles) . ')
     164                    AND network = ' . $current_ipv4 . ' & mask
    179165            ) UNION (
    180                 SELECT 1 AS is_personal, 0 AS is_ip, tbl_private.status, country_code, network1, network2, network3, network4, mask1, mask2, mask3, mask4
     166                SELECT 1 AS is_personal, 0 AS is_ip, tbl_private.status, country_code, network, mask
    181167                FROM ' . $this->data_table__personal_countries . ' AS tbl_private
    182                 RIGHT JOIN ' . $this->data_table__common . ' AS tbl_common USING(country_code)
    183                 WHERE
    184                         network1 IN (' . $needles[0] . ')
    185                     AND network2 IN (' . $needles[1] . ')
    186                     AND network3 IN (' . $needles[2] . ')
    187                     AND network4 IN (' . $needles[3] . ')
    188                     AND network1 = ' . $current_ipv4s[0] . ' & mask1
    189                     AND network2 = ' . $current_ipv4s[1] . ' & mask2
    190                     AND network3 = ' . $current_ipv4s[2] . ' & mask3
    191                     AND network4 = ' . $current_ipv4s[3] . ' & mask4
     168                RIGHT JOIN ' . $data_table__common_v4 . ' AS tbl_common USING(country_code)
     169                WHERE network IN (' . current($needles) . ')
     170                    AND network = ' . $current_ipv4 . ' & mask
    192171                    AND tbl_private.status IS NOT NULL
    193172                    AND ' . mt_rand(1, 100000) . ' <> 0
     
    208187    {
    209188        $needles = IP::getNetworkNeedles(IP::getFourIPv4FromIP($ip));
     189        $data_table__common_v6 = SPBC_TBL_FIREWALL_DATA_V6;
     190        $data_table__personal_v6 = SPBC_TBL_FIREWALL_DATA__IPS_V6;
    210191
    211192        $query_ipv6 = '(
    212193                SELECT 0 AS is_personal, 1 AS is_ip, status, country_code, network1, network2, network3, network4, mask1, mask2, mask3, mask4
    213                 FROM ' . $this->data_table__common . '
     194                FROM ' . $data_table__common_v6 . '
    214195                WHERE
    215196                        network1 IN (0,' . $needles[0] . ')
     
    220201            ) UNION (
    221202                SELECT 1 AS is_personal, 1 AS is_ip, status, 0 AS country_code, network1, network2, network3, network4, mask1, mask2, mask3, mask4
    222                 FROM ' . $this->data_table__personal . '
     203                FROM ' . $data_table__personal_v6 . '
    223204                WHERE
    224205                        network1 IN (0,' . $needles[0] . ')
     
    229210                SELECT 1 AS is_personal, 0 AS is_ip, tbl_private.status, country_code, network1, network2, network3, network4, mask1, mask2, mask3, mask4
    230211                FROM ' . $this->data_table__personal_countries . ' AS tbl_private
    231                 RIGHT JOIN ' . $this->data_table__common . ' AS tbl_common USING(country_code)
     212                RIGHT JOIN ' . $data_table__common_v6 . ' AS tbl_common USING(country_code)
    232213                WHERE
    233214                        network1 IN (0,' . $needles[0] . ')
     
    533514        if ( empty($data['error']) ) {
    534515            $inserted = 0;
     516            $data_table__common_v4 = str_replace('_temp', '_v4_temp', $data_table__common);
     517            $data_table__common_v6 = str_replace('_temp', '_v6_temp', $data_table__common);
     518            $data_table__personal_v4 = str_replace('_temp', '_v4_temp', $data_table__personal);
     519            $data_table__personal_v6 = str_replace('_temp', '_v6_temp', $data_table__personal);
     520
    535521            while ( $data !== '' ) {
    536522                for (
    537                     $i = 0, $sql__common = array(), $sql__personal_ip = array();
     523                    $i = 0, $sql__common_v4 = $sql__common_v6 = $sql__personal_ip_v4 = $sql__personal_ip_v6 = $sql__personal_country = [];
    538524                    $i < SPBC_WRITE_LIMIT && $data !== '';
    539525                    $i++
     
    547533
    548534                    // IP processing
     535                    $network_v4 = '';
     536                    $network_v6 = [];
     537
    549538                    // IPv4
    550539                    if ( is_numeric($entry[0]) ) {
    551                         $networks = array(0, 0, 0, $entry[0]);
     540                        $network_v4 = $entry[0];
    552541                        //IPv6
    553542                    } else {
    554                         $networks = IP::convertIPv6ToFourIPv4(
     543                        $network_v6 = IP::convertIPv6ToFourIPv4(
    555544                            IP::extendIPv6(
    556545                                IP::normalizeIPv6(
     
    561550                    }
    562551
    563                     /**
    564                      * Versatility for mask for v6 and v4
    565                      * @psalm-suppress LoopInvalidation
    566                      */
    567                     for ( $masks = array(), $mask = $entry[1], $k = 4; $k >= 1; $k-- ) {
    568                         $masks[$k] = (2 ** 32) - (2 ** (32 - ($mask > 32 ? 32 : $mask)));
    569                         $mask      -= 32;
    570                         $mask      = $mask > 0 ? $mask : 0;
    571                     }
    572 
    573                     // $comment = $entry[2]; // Comment from user
     552                    $mask        = $entry[1];
    574553                    $status      = isset($entry[3]) ? $entry[3] : 0;
    575554                    $is_personal = isset($entry[4]) ? (int)$entry[4] : 0;
     
    577556
    578557                    // IPv4
    579                     if (
    580                         is_numeric($networks[0]) &&
    581                         is_numeric($networks[1]) &&
    582                         is_numeric($networks[2]) &&
    583                         is_numeric($networks[3])
    584                     ) {
     558                    if ( $network_v4 !== '' ) {
    585559                        $mask = sprintf(
    586560                            '%u',
     
    589563
    590564                        if ( $country || ! $is_personal ) {
    591                             $unique        = md5(implode('', $networks) . $mask . $country . $status);
    592                             $sql__common[] = "('$unique', $networks[0], $networks[1], $networks[2], $networks[3], $masks[1], $masks[2], $masks[3], $masks[4], $status, '$country')";
     565                            $sql__common_v4[] = "($network_v4, $mask, $status, '$country')";
    593566                        }
    594567                        if ( $is_personal && $country ) {
     
    597570
    598571                        if ( $is_personal && ! $country ) {
    599                             $sql__personal_ip[] = "($networks[0], $networks[1], $networks[2], $networks[3], $masks[1], $masks[2], $masks[3], $masks[4], $status)";
     572                            $sql__personal_ip_v4[] = "($network_v4, $mask, $status)";
     573                        }
     574                    }
     575
     576                    // IPv6
     577                    if ( count($network_v6) ) {
     578                        for ( $masks = array(), $k = 4; $k >= 1; $k-- ) {
     579                            $masks[$k] = (2 ** 32) - (2 ** (32 - ($mask > 32 ? 32 : $mask)));
     580                            $mask      -= 32;
     581                            $mask      = $mask > 0 ? $mask : 0;
     582                        }
     583                        if ( $country || ! $is_personal ) {
     584                            $sql__common_v6[] = "($network_v6[0], $network_v6[1], $network_v6[2], $network_v6[3], $masks[1], $masks[2], $masks[3], $masks[4], $status, '$country')";
     585                        }
     586                        if ( $is_personal && $country ) {
     587                            $sql__personal_country[] = "('$country',$status)";
     588                        }
     589
     590                        if ( $is_personal && ! $country ) {
     591                            $sql__personal_ip_v6[] = "($network_v6[0], $network_v6[1], $network_v6[2], $network_v6[3], $masks[1], $masks[2], $masks[3], $masks[4], $status)";
    600592                        }
    601593                    }
    602594                }
    603595
    604                 // Insertion to common table
    605                 $sql_result__common___result = $db->execute(
    606                     'INSERT INTO ' . $data_table__common
    607                     . ' (id, network1, network2, network3, network4, mask1, mask2, mask3, mask4, status, country_code) '
    608                     . ' VALUES '
    609                     . implode(',', $sql__common)
    610                     . ' ON DUPLICATE KEY UPDATE'
    611                     . ' network1=network1'
    612                     . ';'
    613                 );
    614 
    615                 if ( $sql_result__common___result === false ) {
    616                     return array('error' => 'COULD_NOT_WRITE_TO_DB 1: ' . $db->getLastError());
    617                 }
    618                 // Replacing result counter because SQL result won't count all contained entries
    619                 $sql_result__common___result = count($sql__common);
    620 
    621                 $sql_result__personal___result = 0;
    622                 // Insertion to personal IPs table
    623                 if ( ! empty($sql__personal_ip) ) {
    624                     $sql_result__personal___result = $db->execute(
    625                         'INSERT INTO ' . $data_table__personal . ' (network1,network2,network3,network4,mask1,mask2,mask3,mask4,status) VALUES '
    626                         . implode(',', $sql__personal_ip) . ';'
     596                // Insertion to common table v4
     597                if ( count($sql__common_v4) ) {
     598                    $sql_result__common_v4___result = $db->execute(
     599                        'INSERT INTO ' . $data_table__common_v4
     600                        . ' (network, mask, status, country_code) '
     601                        . ' VALUES '
     602                        . implode(',', $sql__common_v4)
     603                        . ' ON DUPLICATE KEY UPDATE'
     604                        . ' network=network'
     605                        . ';'
    627606                    );
    628                     unset($sql__personal_ip);
    629                     if ( $sql_result__personal___result === false ) {
    630                         return array('error' => 'COULD_NOT_WRITE_TO_DB 2: ' . $db->getLastError());
     607
     608                    if ( $sql_result__common_v4___result === false ) {
     609                        return array('error' => 'COULD_NOT_WRITE_TO_DB_COMMON_V4: ' . $db->getLastError());
    631610                    }
    632611                }
    633612
     613
     614                // Insertion to common table v6
     615                if ( count($sql__common_v6) ) {
     616                    $sql_result__common_v6___result = $db->execute(
     617                        'INSERT INTO ' . $data_table__common_v6
     618                        . ' (network1, network2, network3, network4, mask1, mask2, mask3, mask4, status, country_code) '
     619                        . ' VALUES '
     620                        . implode(',', $sql__common_v6)
     621                        . ' ON DUPLICATE KEY UPDATE'
     622                        . ' network1=network1'
     623                        . ';'
     624                    );
     625
     626                    if (  $sql_result__common_v6___result === false ) {
     627                        return array('error' => 'COULD_NOT_WRITE_TO_DB_COMMON_V6: ' . $db->getLastError());
     628                    }
     629                }
     630
     631                // Replacing result counter because SQL result won't count all contained entries
     632                $sql_result__common___result = count($sql__common_v4) + count($sql__common_v6);
     633
     634                $sql_result__personal___result = 0;
     635                // Insertion v4 to personal IPs table
     636                if ( count($sql__personal_ip_v4) ) {
     637                    $sql_result__personal_v4___result = $db->execute(
     638                        'INSERT INTO ' . $data_table__personal_v4 . ' (network,mask,status) VALUES '
     639                        . implode(',', $sql__personal_ip_v4) . ';'
     640                    );
     641                    unset($sql__personal_ip_v4);
     642                    if ( $sql_result__personal_v4___result === false ) {
     643                        return array('error' => 'COULD_NOT_WRITE_TO_DB_PERSONAL_V4: ' . $db->getLastError());
     644                    }
     645                    $sql_result__personal___result += $sql_result__personal_v4___result;
     646                }
     647
     648                // Insertion v6 to personal IPs table
     649                if ( count($sql__personal_ip_v6) ) {
     650                    $sql_result__personal_v6___result = $db->execute(
     651                        'INSERT INTO ' . $data_table__personal_v6 . ' (network1,network2,network3,network4,mask1,mask2,mask3,mask4,status) VALUES '
     652                        . implode(',', $sql__personal_ip_v6) . ';'
     653                    );
     654                    unset($sql__personal_ip_v6);
     655                    if ( $sql_result__personal_v6___result === false ) {
     656                        return array('error' => 'COULD_NOT_WRITE_TO_DB_PERSONAL_V6: ' . $db->getLastError());
     657                    }
     658                    $sql_result__personal___result += $sql_result__personal_v6___result;
     659                }
     660
    634661                // Insertion to personal countries table
    635                 if ( ! empty($sql__personal_country) ) {
     662                if ( count($sql__personal_country) ) {
    636663                    $sql__personal_country        = array_unique($sql__personal_country); // Filtering duplicate entries
    637664                    $sql_result__country___result = $db->execute(
     
    641668                    unset($sql__personal_country);
    642669                    if ( $sql_result__country___result === false ) {
    643                         return array('error' => 'COULD_NOT_WRITE_TO_DB 3: ' . $db->getLastError());
     670                        return array('error' => 'COULD_NOT_WRITE_TO_DB_COUNTRIES: ' . $db->getLastError());
    644671                    }
    645672                }
     
    674701        $exclusions = array()
    675702    ) {
    676         $query = 'INSERT INTO `' . $db__table__data__personal . '`  (network1,network2,network3,network4,mask1,mask2,mask3,mask4,status) VALUES ';
     703        $data_table__personal_v4 = str_replace('_temp', '_v4_temp', $db__table__data__personal);
     704        $data_table__common_v4 = str_replace('_temp', '_v4_temp', $db__table__data__common);
     705        $query = 'INSERT INTO `' . $data_table__personal_v4 . '`  (network,mask,status) VALUES ';
    677706
    678707        //Exclusion for servers IP (SERVER_ADDR)
     
    687716            } else {
    688717                $db->execute(
    689                     'DELETE FROM ' . $db__table__data__personal . ' WHERE network4 = ' . ip2long('127.0.0.1') . ';'
     718                    'DELETE FROM ' . $data_table__personal_v4 . ' WHERE network = ' . ip2long('127.0.0.1') . ';'
    690719                );
    691720                $db->execute(
    692                     'DELETE FROM ' . $db__table__data__common . ' WHERE network4 = ' . ip2long('127.0.0.1') . ';'
     721                    'DELETE FROM ' . $data_table__common_v4 . ' WHERE network = ' . ip2long('127.0.0.1') . ';'
    693722                );
    694723            }
     
    696725
    697726        foreach ( $exclusions as $exclusion ) {
    698             if ( IP::validate($exclusion) && sprintf('%u', ip2long($exclusion)) ) {
    699                 $networks = IP::convertIPv6ToFourIPv4(IP::extendIPv6(IP::normalizeIPv6($exclusion)));
    700 
    701                 /**
    702                  * @psalm-suppress LoopInvalidation
    703                  */
    704                 for ( $masks = array(), $mask = 128, $k = 4; $k >= 1; $k-- ) {
    705                     $masks[$k] = (2 ** 32) - (2 ** (32 - ($mask > 32 ? 32 : $mask)));
    706                     $mask      -= 32;
    707                     $mask      = $mask > 0 ? $mask : 0;
    708                 }
    709 
    710                 $query .= "( $networks[0], $networks[1], $networks[2], $networks[3], $masks[1], $masks[2], $masks[3], $masks[4] , 2),";
     727            if ( IP::validate($exclusion) ) {
     728                $network = sprintf('%u', ip2long($exclusion));
     729                $mask = 4294967295;
     730                $query .= "( $network, $mask, 2),";
    711731            }
    712732        }
     
    716736
    717737            return $sql_result === false
    718                 ? array('error' => 'COULD_NOT_WRITE_TO_DB 4: ' . $db->getLastError())
     738                ? array('error' => 'COULD_NOT_WRITE_TO_DB_EXCLUSIONS: ' . $db->getLastError())
    719739                : count($exclusions);
    720740        }
     
    892912        }
    893913
    894         if (
    895             $db->execute('DELETE FROM ' . SPBC_TBL_FIREWALL_DATA . ' WHERE country_code NOT IN (' . implode(',', $in) . ')') === false
    896         ) {
     914        $delete_sql_v4 = "DELETE FROM "
     915                      . SPBC_TBL_FIREWALL_DATA_V4 . "
     916                      WHERE country_code NOT IN (" . implode(',', $in) . ")";
     917        $delete_sql_v6 = "DELETE FROM "
     918                      . SPBC_TBL_FIREWALL_DATA_V6 . "
     919                      WHERE country_code NOT IN (" . implode(',', $in) . ")";
     920        if ( $db->execute($delete_sql_v4) === false || $db->execute($delete_sql_v6) === false ) {
    897921            return array('error' => 'CLEAR TABLE: CLEAR FAILS');
    898922        }
     
    901925    }
    902926
    903     public static function privateRecordsAdd(DB $db, $db__table__data, $metadata)
     927    public static function privateRecordsAdd(DB $db, $metadata)
    904928    {
    905929        $added_count = 0;
     
    909933
    910934
    911         foreach ( $metadata as $_key => $row ) {
    912             /**
    913              * Set queries
    914              */
    915             $query_duplicate_search = "SELECT id,status FROM " . $db__table__data . " WHERE
     935        foreach ( $metadata as $row ) {
     936            //find duplicate to use it on updating
     937            $has_duplicate = false;
     938
     939            $duplicated_row = self::checkDuplicateItem($db, $row);
     940
     941            //if the record is same - pass
     942            if ( isset($duplicated_row['status']) && $duplicated_row['status'] == $row['status'] ) {
     943                $ignored_count++;
     944                continue;
     945            }
     946
     947            //if duplicate found create a chunk
     948            if ( isset($duplicated_row['status']) && isset($duplicated_row['id']) ) {
     949                $id_chunk = "id ='" . $duplicated_row['id'] . "',";
     950                $has_duplicate = true;
     951            }
     952
     953            $insert_result = self::privateRecordAddDb($db, $row, $id_chunk);
     954
     955            if ( $insert_result === false ) {
     956                throw new \RuntimeException($db->getLastError());
     957            }
     958
     959            $added_count = $has_duplicate ? $added_count : $added_count + 1;
     960            $updated_count = $has_duplicate ? $updated_count + 1 : $updated_count;
     961        }
     962
     963        return array(
     964            'total' => $added_count + $updated_count + $ignored_count,
     965            'added' => $added_count,
     966            'updated' => $updated_count,
     967            'ignored' => $ignored_count
     968        );
     969    }
     970
     971    public static function privateRecordsDelete(DB $db, $metadata)
     972    {
     973        $success_count = 0;
     974        $ignored_count = 0;
     975
     976        foreach ( $metadata as $row ) {
     977            if ( is_array($row['network']) ) {
     978                // v6
     979                $query = "DELETE FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V6 . " WHERE
     980                    network1 = '" . $row['network'][0] . "' AND
     981                    network2 = '" . $row['network'][1] . "' AND
     982                    network3 = '" . $row['network'][2] . "' AND
     983                    network4 = '" . $row['network'][3] . "' AND
     984                    mask1 = '" . $row['mask'][1] . "' AND
     985                    mask2 = '" . $row['mask'][2] . "' AND
     986                    mask3 = '" . $row['mask'][3] . "' AND
     987                    mask4 = '" . $row['mask'][4] . "';";
     988            } else {
     989                // v4
     990                $query = "DELETE FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V4 . " WHERE
     991                    network = '" . $row['network'] . "' AND
     992                    mask = '" . $row['mask'] . "';";
     993            }
     994
     995            $db_result = $db->execute($query);
     996            if ( $db_result === false ) {
     997                throw new \Exception($db->getLastError());
     998            }
     999
     1000            $success_count = $db_result === 1 ? $success_count + 1 : $success_count;
     1001            $ignored_count = $db_result === 0 ? $ignored_count + 1 : $ignored_count;
     1002        }
     1003
     1004        return array(
     1005            'total' => $success_count + $ignored_count,
     1006            'deleted' => $success_count,
     1007            'ignored' => $ignored_count
     1008        );
     1009    }
     1010
     1011    /**
     1012     * @param $row array Network item to check
     1013     *
     1014     * @return array
     1015     */
     1016    private static function checkDuplicateItem($db, $row)
     1017    {
     1018        $output = [];
     1019
     1020        if ( is_array($row['network']) ) {
     1021            // v6
     1022            $query = "SELECT id,status FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V6 . " WHERE
    9161023                                network1 = '" . $row['network'][0] . "' AND
    9171024                                network2 = '" . $row['network'][1] . "' AND
     
    9221029                                mask3 = '" . $row['mask'][3] . "' AND
    9231030                                mask4 = '" . $row['mask'][4] . "';";
    924 
    925             //find duplicate to use it on updating
    926             $has_duplicate = false;
    927 
    928             $db_result = $db->fetch($query_duplicate_search);
    929             if ( $db_result === false ) {
    930                 throw new \RuntimeException($db->getLastError());
    931             }
    932 
    933             //if the record is same - pass
    934             if ( isset($db_result->status) && $db_result->status == $row['status'] ) {
    935                 $ignored_count++;
    936                 continue;
    937             }
    938 
    939             //if duplicate found create a chunk
    940             if ( isset($db_result->status) ) {
    941                 $id_chunk = "id ='" . $db_result->id . "',";
    942                 $has_duplicate = true;
    943             }
    944 
    945             $query_insertion = "INSERT INTO " . $db__table__data . " SET
     1031        } else {
     1032            // v4
     1033            $query = "SELECT id,status FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V4 . " WHERE
     1034                                network = '" . $row['network'] . "' AND
     1035                                mask = '" . $row['mask'] . "';";
     1036        }
     1037
     1038        $db_result = $db->fetch($query);
     1039        if ( $db_result === false ) {
     1040            throw new \RuntimeException($db->getLastError());
     1041        }
     1042
     1043        if ( isset($db_result->status) ) {
     1044            $output['status'] = $db_result->status;
     1045        }
     1046        if ( isset($db_result->id) ) {
     1047            $output['id'] = $db_result->id;
     1048        }
     1049        return $output;
     1050    }
     1051
     1052    /**
     1053     * @param $row array Network item to insert
     1054     * @param $id_chunk string|int id for duplicated row if it provided
     1055     *
     1056     * @return int
     1057     */
     1058    private static function privateRecordAddDb($db, $row, $id_chunk)
     1059    {
     1060        if ( is_array($row['network']) ) {
     1061            // v6
     1062            $query = "INSERT INTO " . SPBC_TBL_FIREWALL_DATA__IPS_V6 . " SET
    9461063                                " . $id_chunk . "
    9471064                                network1 = '" . $row['network'][0] . "',
     
    9651082                                mask4 = mask4,
    9661083                                status = '" . $row['status'] . "';";
    967 
    968             //insertion
    969             $db_result = $db->execute($query_insertion);
    970             if ( $db_result === false ) {
    971                 throw new \RuntimeException($db->getLastError());
    972             }
    973 
    974             $added_count = $has_duplicate ? $added_count : $added_count + 1;
    975             $updated_count = $has_duplicate ? $updated_count + 1 : $updated_count;
    976         }
    977 
    978         return array(
    979             'total' => $added_count + $updated_count + $ignored_count,
    980             'added' => $added_count,
    981             'updated' => $updated_count,
    982             'ignored' => $ignored_count
    983         );
    984     }
    985 
    986     public static function privateRecordsDelete(DB $db, $db__table__data, $metadata)
    987     {
    988         $success_count = 0;
    989         $ignored_count = 0;
    990 
    991         foreach ( $metadata as $_key => $row ) {
    992             $query = "DELETE FROM " . $db__table__data . " WHERE
    993             network1 = '" . $row['network'][0] . "' AND
    994             network2 = '" . $row['network'][1] . "' AND
    995             network3 = '" . $row['network'][2] . "' AND
    996             network4 = '" . $row['network'][3] . "' AND
    997             mask1 = '" . $row['mask'][1] . "' AND
    998             mask2 = '" . $row['mask'][2] . "' AND
    999             mask3 = '" . $row['mask'][3] . "' AND
    1000             mask4 = '" . $row['mask'][4] . "';";
    1001             $db_result = $db->execute($query);
    1002             if ( $db_result === false ) {
    1003                 throw new \Exception($db->getLastError());
    1004             }
    1005 
    1006             $success_count = $db_result === 1 ? $success_count + 1 : $success_count;
    1007             $ignored_count = $db_result === 0 ? $ignored_count + 1 : $ignored_count;
    1008         }
    1009 
    1010         return array(
    1011             'total' => $success_count + $ignored_count,
    1012             'deleted' => $success_count,
    1013             'ignored' => $ignored_count
    1014         );
     1084        } else {
     1085            // v4
     1086            $query = "INSERT INTO " . SPBC_TBL_FIREWALL_DATA__IPS_V4 . " SET
     1087                                " . $id_chunk . "
     1088                                network = '" . $row['network'] . "',
     1089                                mask = '" . $row['mask'] . "',
     1090                                status = '" . $row['status'] . "'
     1091                                ON DUPLICATE KEY UPDATE
     1092                                id = id,
     1093                                network = network,
     1094                                mask = mask,
     1095                                status = '" . $row['status'] . "';";
     1096        }
     1097
     1098        //insertion
     1099        return $db->execute($query);
    10151100    }
    10161101}
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Firewall/FirewallModule.php

    r2998673 r3022805  
    7777            case 'DENY_BY_WAF_FILE':
    7878                $reason = __(
    79                     'Blocked by Web Application Firewall: Malicious files upload: ',
     79                    'Blocked by Upload Checker module: Malicious files upload: ',
    8080                    'security-malware-firewall'
    8181                );
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Firewall/WAF.php

    r2991545 r3022805  
    55use CleantalkSP\Common\Helpers\HTTP;
    66use CleantalkSP\SpbctWP\Helpers\Helper;
    7 use CleantalkSP\Variables\Post;
    87use CleantalkSP\Variables\Server;
    9 use CleantalkSP\SpbctWP\Scanner;
    108use CleantalkSP\Security\Firewall\Result;
    11 use CleantalkSP\SpbctWP\Helpers\Data;
    129
    1310class WAF extends FirewallModule
     
    1815    protected $waf__xss_check = false;
    1916    protected $waf__sql_check = false;
    20     protected $waf__file_check = false;
    21     protected $waf__file_check__uploaded_plugins = false;
    2217    protected $waf__exploit_check = false;
    2318
     
    3328
    3429    /**
    35      * List there all the severity levels that WAF should react to during upload
    36      * @var string[]
    37      */
    38     private static $waf_uploads_severity_warning_levels = array('CRITICAL');
    39 
    40     /**
    4130     * @psalm-suppress PossiblyUnusedProperty
    4231     */
    4332    protected $api_key = false;
    44 
    45     public $waf_file_mime_check = array(
    46         'text/x-php',
    47         'text/plain',
    48         'image/x-icon',
    49         'application/zip',
    50         'application/x-zip-compressed',
    51     );
    5233
    5334    /**
     
    9980        $results[] = $this->waf__xss_check ? $this->wafXssCheck(array($_POST, $_GET, $_COOKIE)) : false;
    10081        $results[] = $this->waf__sql_check ? $this->wafSqlCheck(array($_POST, $_GET)) : false;
    101         $results[] = $this->waf__file_check ? $this->wafFileCheck() : false;
    10282        $results[] = $this->waf__exploit_check ? $this->wafExploitCheck(urldecode(Server::get('QUERY_STRING'))) : false;
    10383
     
    279259    }
    280260
    281     /**
    282      * Checks uploaded files for malicious code
    283      *
    284      * @return false|Result Does the file contain malicious code
    285      *
    286      * @psalm-suppress InvalidArrayOffset
    287      */
    288     private function wafFileCheck()
    289     {
    290         foreach ( $_FILES as $files ) {
    291             if ( (empty($files['error']) || $files['error'] === UPLOAD_ERR_OK) ) {
    292                 $files['tmp_name'] = is_array($files['tmp_name']) ? $files['tmp_name'] : array($files['tmp_name']);
    293                 foreach ( $files['tmp_name'] as $file ) {
    294                     if (
    295                         is_string($file) &&
    296                         is_uploaded_file($file) &&
    297                         is_readable($file) &&
    298                         in_array(Data::getMIMEType($file), $this->waf_file_mime_check)
    299                     ) {
    300                         // Uploaded plugins and themes check
    301                         if ( $this->waf__file_check__uploaded_plugins ) {
    302                             add_filter(
    303                                 'upgrader_source_selection',
    304                                 '\CleantalkSP\SpbctWP\Firewall\WAF::wafFileCheckModulesCheck',
    305                                 2,
    306                                 4
    307                             );
    308                         }
    309 
    310                         $file_content = file_get_contents($file);
    311 
    312                         if (
    313                             in_array(Data::getMIMEType($file), array('text/x-php', 'text/plain', 'image/x-icon', 'text/javascript'))
    314                         ) {
    315                             $signatures = $this->db->fetchAll('SELECT * FROM ' . SPBC_TBL_SCAN_SIGNATURES);
    316                             if ( !empty($signatures) ) {
    317                                 $signatures_scanner = new \CleantalkSP\Common\Scanner\SignaturesAnalyser\Controller();
    318                                 $file_to_check = new \CleantalkSP\Common\Scanner\SignaturesAnalyser\Structures\FileInfo(
    319                                     $file,
    320                                     md5($file_content)
    321                                 );
    322                                 $signature_result = $signatures_scanner->scanFile($file_to_check, '', $signatures);
    323                             }
    324                         }
    325 
    326                         //check signatures first
    327                         if ( isset($signature_result->severity) && $signature_result->severity === 'CRITICAL' ) {
    328                             return new Result(
    329                                 array(
    330                                     'module'        => 'WAF',
    331                                     'ip'            => end($this->ip_array),
    332                                     'status'        => 'DENY_BY_WAF_FILE',
    333                                     'pattern'       => array('CRITICAL' => 'malware signatures'),
    334                                     'triggered_for' => 'uploaded_module',
    335                                     'waf_action'    => 'DENY',
    336                                 )
    337                             );
    338                         }
    339 
    340                         //then heuristics
    341                         $heuristic_scanner = new \CleantalkSP\Common\Scanner\HeuristicAnalyser\Controller();
    342                         $file_to_check = new \CleantalkSP\Common\Scanner\HeuristicAnalyser\Structures\FileInfo($file);
    343                         $heuristic_result = $heuristic_scanner->scanFile($file_to_check, '');
    344 
    345                         if ( ! empty($heuristic_result->weak_spots) ) {
    346                             $patterns = array();
    347                             foreach ( $heuristic_result->weak_spots as $severity => $result ) {
    348                                 // critical files only should be collected on WAF upload check
    349                                 if ( static::doUploadStopOnSeverity($severity) ) {
    350                                     $patterns[$severity] = reset($result);
    351                                     $patterns['file_path'] = $file_to_check->path;
    352                                 }
    353                             }
    354 
    355                             if ( !empty($patterns) ) {
    356                                 return new Result(
    357                                     array(
    358                                         'module'        => 'WAF',
    359                                         'ip'            => end($this->ip_array),
    360                                         'status'        => 'DENY_BY_WAF_FILE',
    361                                         'pattern'       => $patterns,
    362                                         'triggered_for' => 'uploaded_module',
    363                                         'waf_action'    => 'DENY',
    364                                     )
    365                                 );
    366                             }
    367                         }
    368                     }
    369                 }
    370             }
    371         }
    372 
    373         return false;
    374     }
    375 
    376     public static function wafFileCheckModulesCheck(
    377         $source,
    378         $remote_source,
    379         \WP_Upgrader $upgrader,
    380         $args_hook_extra
    381     ) {
    382         global $spbc;
    383 
    384         // Show initial check message
    385         show_message($spbc->data["wl_brandname"] . sprintf(' is checking the uploaded %s&#8230;', $args_hook_extra['type']));
    386 
    387         // Prepare and run scan
    388         $dir_scan = new \CleantalkSP\SpbctWP\Scanner\DirectoryScan(
    389             $source,
    390             Scanner\Controller::getRootPath(),
    391             array(
    392                 'output_file_details' => array('path', 'full_hash'),
    393             )
    394         );
    395 
    396         // Output the result
    397         $details = '<div id="spbct-upload-checker-details">';
    398         $details .= '<ul>';
    399 
    400         $overall_result = true;
    401         $total_files_checked_count = 0;
    402 
    403         try {
    404             $dir_scan->setElements();
    405             $results = $dir_scan->scan(true);
    406             $total_files_checked_count = count($results);
    407             foreach ($results as $result) {
    408                 // if http error collected or result array invalid
    409                 if ( !empty($result['error']) || in_array(array('path','status','severity'), array_keys($result))) {
    410                     $details .= '<li>&nbsp;&nbsp;<b>'
    411                     . __('Error occurred while checking file', 'security_malware_firewall')
    412                     . '</b>'
    413                     . ' '
    414                     . (!empty($result['path']) ? $result['path'] : '')
    415                     . ':'
    416                     . ' '
    417                     . !empty($result['error']) ? $result['error'] : __('internal directory scan error', 'security_malware_firewall')
    418                         . "</li>";
    419                 } else {
    420                     $file_is_ok = !static::doUploadStopOnStatus($result['status']) && !static::doUploadStopOnSeverity($result['severity']);
    421                     if ( !$file_is_ok ) {
    422                         // Cutting useless path prefix
    423                         $title = json_encode($result['weak_spots']);
    424                         $title = $title ? esc_html($title) : 'Unknown weak spots';
    425                         $display_path = preg_replace('#^.wp-content.upgrade[\\\\].+?[\\\\]#', '', $result['path']);
    426                         $details .= "<li><a title='Weak spots JSON: $title'>&nbsp;&nbsp;&nbsp;&nbsp;$display_path: <b>{$result['status']}</b></a></li>";
    427                         $overall_result = false;
    428                     }
    429                 }
    430             }
    431         } catch (\Exception $e) {
    432             $details = '<li>&nbsp;&nbsp;<b>'
    433                 . __('internal directory scan error', 'security_malware_firewall')
    434                 . ':'
    435                 . ' '
    436                 . $e;
    437             $overall_result = true;
    438         }
    439 
    440         $details .= '</ul>';
    441         $details .= '</div>';
    442 
    443         show_message('&nbsp;&nbsp;' . __('Checked files count: ', 'security-malware-firewall') . $total_files_checked_count);
    444 
    445         // Output result message
    446         if ( $overall_result ) {
    447             show_message('&nbsp;&nbsp;<b>No malware has been found. Installation continues.</b>');
    448         } else {
    449             show_message('&nbsp;&nbsp;' . __('List of infected files:', 'security-malware-firewall'));
    450             show_message($details);
    451             // Remove the directory with bad plugin
    452             Data::removeDirectoryRecursively($source);
    453 
    454             return new \WP_Error(
    455                 'spbct.plugin_check.malware_found',
    456                 '<b>Malware has been found. Installation interrupted.</b>'
    457             );
    458         }
    459 
    460         return $source;
    461     }
    462 
    463261    public function middleAction(Result $waf_result)
    464262    {
     
    468266    }
    469267
    470     private function log(Result $waf_result)
     268    public function log(Result $waf_result)
    471269    {
    472270        //single quote escaping
     
    546344
    547345    /**
    548      * AJAX callback for details about latest blocked file
    549      */
    550     public static function wafFileGetLastBlockedInfo()
    551     {
    552         spbc_check_ajax_referer('spbc_secret_nonce', 'security');
    553 
    554         global $wpdb, $spbc;
    555 
    556         $timestamp = intval(Post::get('timestamp'));
    557 
    558         // Select only latest ones.
    559         $result = $wpdb->get_results(
    560             'SELECT *'
    561             . ' FROM ' . SPBC_TBL_FIREWALL_LOG
    562             . ' WHERE status = "DENY_BY_WAF_FILE" AND entry_timestamp > ' . ($timestamp - 2)
    563             . ' ORDER BY entry_timestamp DESC LIMIT 1;',
    564             OBJECT
    565         );
    566 
    567         if ( $result ) {
    568             $result = $result[0];
    569             $result->pattern = str_replace('\\', '\\\\', $result->pattern);
    570             $out    = array(
    571                 'blocked'       => true,
    572                 'warning'       => $spbc->data["wl_brandname"] . __(
    573                     ': File was blocked by Web Application FireWall.',
    574                     'security-malware-firewall'
    575                 ),
    576                 'pattern_title' => __('Detected pattern: ', 'security-malware-firewall'),
    577                 'pattern'       => json_decode($result->pattern, true),
    578             );
    579         } else {
    580             $out = array('blocked' => false);
    581         }
    582 
    583         wp_send_json($out);
    584     }
    585 
    586     /**
    587346     * The method checks for the presence of a signature in data
    588347     */
     
    716475        return 'nothing';
    717476    }
    718 
    719     /**
    720      * Check if needs to stop upload process on severity level. For theme/plugin upload uses self::$waf_uploads_severity_warning_levels
    721      * @param string $severity file severity
    722      * @return bool
    723      */
    724     private static function doUploadStopOnSeverity($severity)
    725     {
    726         if (
    727             empty($severity) ||
    728             !is_string($severity) ||
    729             !in_array($severity, array('CRITICAL', 'SUSPICIOUS', 'DANGER'))
    730         ) {
    731             return false;
    732         }
    733 
    734         $uri = parse_url(Server::get('REQUEST_URI'));
    735 
    736         //check only plugin/theme upload
    737         if (!empty($uri['query']) &&
    738             (
    739             strpos($uri['query'], 'action=upload-plugin') !== false ||
    740             strpos($uri['query'], 'action=upload-theme') !== false
    741             )
    742         ) {
    743             return in_array($severity, self::$waf_uploads_severity_warning_levels);
    744         }
    745 
    746         //do block on any severity
    747         return true;
    748     }
    749 
    750     private static function doUploadStopOnStatus($status)
    751     {
    752         return is_string($status) && !in_array($status, array('OK', 'APROVED', 'APPROVED_BY_CT', 'MODIFIED', 'UNKNOWN'));
    753     }
    754477}
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Helpers/IP.php

    r2984157 r3022805  
    55class IP extends \CleantalkSP\Common\Helpers\IP
    66{
     7    /**
     8     * Known headers collection array( (id=>(slug,name), id=>(slug,name), ...).
     9     * @var array[]
     10     */
     11    public static $known_headers_collection = array(
     12        2 => array('slug' => 'remote_addr', 'name' => 'Remote Addr'),
     13        3 => array('slug' => 'x_forwarded_for', 'name' => 'X-Forwarded-For'),
     14        4 => array('slug' => 'x_real_ip', 'name' => 'X-Real-Ip'),
     15        5 => array('slug' => 'incapsula', 'name' => 'Incap-Client-Ip'),
     16        6 => array('slug' => 'ico_x_forwarded_for', 'name' => 'Ico-X-Forwarded-For'),
     17        7 => array('slug' => 'stackpath', 'name' => 'X-Sp-Forwarded-Ip'),
     18        8 => array('slug' => 'x_forwarded_by', 'name' => 'X-Client-Ip'),
     19        9 => array('slug' => 'sucury', 'name' => 'X-Sucuri-Clientip'),
     20        10 => array('slug' => 'ezoic', 'name' => 'X-Middleton-Ip'),
     21        11 => array('slug' => 'gtranslate', 'name' => 'X-Gt-Viewer-Ip'),
     22        12 => array('slug' => 'cloud_flare', 'name' => 'Cf-Connecting-Ip'),
     23        13 => array('slug' => 'ovh', 'name' => 'Remote-Ip'),
     24    );
     25
    726    public static function get($ip_type_to_get = 'real', $headers = array(), $recursion = false)
    827    {
    928        global $spbc;
    1029
    11         switch ((int) $spbc->settings['secfw__get_ip']) {
    12             case 2:
    13                 $ip_type_to_get = 'remote_addr';
    14                 break;
    15             case 3:
    16                 $ip_type_to_get = 'x_forwarded_for';
    17                 break;
    18             case 4:
    19                 $ip_type_to_get = 'x_real_ip';
    20                 break;
    21             case 5:
    22                 $ip_type_to_get = 'incapsula';
    23                 break;
    24             case 6:
    25                 $ip_type_to_get = 'ico_x_forwarded_for';
    26                 break;
    27             case 7:
    28                 $ip_type_to_get = 'stackpath';
    29                 break;
    30             case 8:
    31                 $ip_type_to_get = 'x_forwarded_by';
    32                 break;
    33             case 9:
    34                 $ip_type_to_get = 'sucury';
    35                 break;
    36             case 10:
    37                 $ip_type_to_get = 'ezoic';
    38                 break;
    39             case 11:
    40                 $ip_type_to_get = 'gtranslate';
    41                 break;
    42             case 12:
    43                 $ip_type_to_get = 'cloud_flare';
    44                 break;
    45             case 13:
    46                 $ip_type_to_get = 'ovh';
    47                 break;
     30        $current_setting = (int)$spbc->settings['secfw__get_ip'];
     31
     32        if ( $current_setting !== 1 && $current_setting !== 0) {
     33            $ip_type_to_get = self::$known_headers_collection[$current_setting]['slug'];
    4834        }
    4935
    50         return parent::get($ip_type_to_get, $headers, $recursion);
     36        $ip_found = parent::get($ip_type_to_get, $headers, $recursion);
     37
     38        //if not ip found in selected headers, return automatic search result ('real' state)
     39        if ( empty($ip_found) ) {
     40            $ip_found = parent::get('real', $headers, $recursion);
     41        }
     42
     43        return $ip_found;
     44    }
     45
     46    /**
     47     * Returns list of known CDN headers names.
     48     * @return string[]
     49     */
     50    public static function getKnownCDNHeadersNames()
     51    {
     52        $result = array_map(function ($cdn_record_data) {
     53            return $cdn_record_data['name'];
     54        }, self::$known_headers_collection);
     55        return $result;
     56    }
     57
     58    /**
     59     * Returns header ID by slug.
     60     * @param string $slug
     61     * @return string|null
     62     */
     63    public static function getHeaderIDbySlug($slug = '')
     64    {
     65        foreach (self::$known_headers_collection as $header_id => $header_data) {
     66            if ( $header_data['slug'] === $slug ) {
     67                return (string)$header_id;
     68            }
     69        }
     70        return null;
     71    }
     72
     73    public static function getHeaderSlugByName($name = '')
     74    {
     75        foreach (self::$known_headers_collection as $_header_id => $header_data) {
     76            if ( strtolower($header_data['name']) === strtolower($name) ) {
     77                return (string)($header_data['slug']);
     78            }
     79        }
     80        return '';
     81    }
     82
     83    /**
     84     * Returns array of localized strings for long option description.
     85     * @return array
     86     */
     87    public static function getOptionLongDescriptionArray()
     88    {
     89        return array(
     90            'title' => __('Get IP from additional headers', 'security-malware-firewall'),
     91            'desc' => __('If the source header is selected, the plugin will search IP address in this header. If nothing found there, the plugin will run automatic search for every known possible IP sources.', 'security-malware-firewall'),
     92        );
    5193    }
    5294}
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/ListTable.php

    r2998673 r3022805  
    253253            <tbody>
    254254            <?php
    255             $this->displayRows(); ?>
     255            $this->displayRows($this->id); ?>
    256256            </tbody>
    257257
     
    304304            <tbody>
    305305            <?php
    306             $this->displayRows(); ?>
     306            $this->displayRows($this->id); ?>
    307307            </tbody>
    308308
     
    418418    }
    419419
    420     public function displayRows($return = false)
     420    public function displayRows($id, $return = false)
    421421    {
    422422        $out = '';
     423        $blocks_count = 0;
    423424
    424425        foreach ( $this->items as $item ) {
     
    429430            $gray_start = $scheduled ? '<span style="color: darkgray">' : '';
    430431            $gray_end = $scheduled ? '</span>' : '';
     432
     433            $hide_show_mob_class_name = '';
     434            $hide_mob_class_name = '';
     435            $blocks_count += 1;
     436            $rows_count = 0;
    431437
    432438            foreach ( $this->columns as $column_key => $column ) {
     
    446452                    );
    447453                } else {
    448                     $out .= "<td class='$classes'>";
    449 
     454                    $class_key = "'" .  $id . "'";
     455                    $rows_count += 1;
     456                    if ($rows_count != 1) {
     457                        $hide_show_mob_class_name = $id . '_block_' . $blocks_count;
     458                        $hide_mob_class_name = 'mob_entries';
     459                    }
     460                    $mob_class_block = 'mob_block_' . $blocks_count;
     461                    $out .= "<td class='$classes $hide_mob_class_name $mob_class_block $hide_show_mob_class_name'" . "data-before=" . $column['heading'] . ">";
    450462                    $out .= isset($item[$column_key]) ? $gray_start . $item[$column_key] . $gray_end : '-';
    451463                    $out .= isset($column['primary'])
    452                         ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __(
     464                        ? '<button type="button" onclick="show_hide_rows(' . $blocks_count . ',' . $class_key . ')" class="toggle-row"><span class="screen-reader-text">' . __(
    453465                            'Show more details'
    454466                        ) . '</span></button>'
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/RemoteCalls.php

    r2939541 r3022805  
    536536        }
    537537    }
     538
     539    /**
     540     * Remote call spbc_cdn_check handler.
     541     * @psalm-suppress PossiblyUnusedMethod
     542     */
     543    public static function action__cdn_check() // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
     544    {
     545        $result_cdn_check = spbc_cdn_checker__parse_request();
     546
     547        die(
     548            empty($result_cdn_check['error'])
     549            ? 'OK ' . json_encode($result_cdn_check)
     550            : 'FAIL ' . json_encode($result_cdn_check['error'])
     551        );
     552    }
    538553}
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Scanner/Controller.php

    r2928433 r3022805  
    1313        'INFECTED',
    1414        'QUARANTINED',
    15         'APROVED',
     15        'APPROVED_BY_USER',
    1616    );
    1717
     
    1919        'NONE',
    2020        'SUSPICIOUS',
    21         'DANGER',
    2221        'CRITICAL',
    2322    );
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Scanner/ScanResultsRepository.php

    r2770536 r3022805  
    2929            'SELECT real_full_hash
    3030            FROM ' . SPBC_TBL_SCAN_FILES . '
    31             WHERE status="APROVED"'
     31            WHERE status="APPROVED_BY_USER"'
    3232        );
    3333
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Scanner/ScannerQueue.php

    r3011278 r3022805  
    608608                if ( empty($result_hashes['error']) ) {
    609609                    $this->db->execute(
    610                         'DELETE FROM ' . SPBC_TBL_SCAN_FILES . ' WHERE path LIKE "%' . $module_slug . '%" AND status <> "APROVED";'
     610                        'DELETE FROM ' . SPBC_TBL_SCAN_FILES . ' WHERE path LIKE "%' . $module_slug . '%" AND status <> "APPROVED_BY_USER";'
    611611                    );
    612612                    $sql_hat    = 'INSERT INTO ' . SPBC_TBL_SCAN_FILES . ' (`fast_hash`, `path`, `real_full_hash`, `source_type`, `source`, `source_status`, `version`, `checked_heuristic`, `checked_signatures`, `status`) VALUES ';
     
    15791579            . ' AND checked_heuristic = 1 '
    15801580            . ' AND weak_spots NOT LIKE "%SIGNATURES%" '
    1581             . ' AND status NOT IN ("APROVED", "APPROVED_BY_CT", "APPROVED_BY_CLOUD")'
     1581            . ' AND status NOT IN ("APPROVED_BY_USER", "APPROVED_BY_CT", "APPROVED_BY_CLOUD")'
    15821582            . ' AND (pscan_pending_queue IS NULL OR pscan_pending_queue = 0); '
    15831583        );
     
    21222122            . ' severity = "CRITICAL" AND'
    21232123            . ' status <> "QUARANTINED" AND'
    2124             . ' status <> "APROVED" AND'
     2124            . ' status <> "APPROVED_BY_USER" AND'
     2125            . ' status <> "APPROVED_BY_CLOUD" AND'
    21252126            . ' status <> "APPROVED_BY_CT"'
    21262127        );
    21272128
     2129        $sql_result__suspicious = $this->db->fetchAll(
     2130            'SELECT full_hash, mtime, size, source_type, source, source_status, path, status, severity'
     2131            . ' FROM ' . SPBC_TBL_SCAN_FILES
     2132            . ' WHERE'
     2133            . ' severity = "SUSPICIOUS" AND'
     2134            . ' status <> "QUARANTINED" AND'
     2135            . ' status <> "APPROVED_BY_USER" AND'
     2136            . ' status <> "APPROVED_BY_CLOUD" AND'
     2137            . ' status <> "APPROVED_BY_CT"'
     2138        );
     2139
    21282140        // Getting modified files
    2129         $modified = array();
     2141        $critical_files_found = array();
    21302142        if ( count($sql_result__critical) ) {
    21312143            foreach ( $sql_result__critical as $row ) {
     
    21332145                unset($row['path'], $row['status'], $row['severity']);
    21342146                $row['mtime'] = $row['mtime'] + $spbc->data['site_utc_offset_in_seconds'];
    2135                 $modified[$path] = array_values($row);
     2147                $critical_files_found[$path] = array_values($row);
     2148            }
     2149        }
     2150
     2151        // Getting modified files
     2152        $suspicious_files_found = array();
     2153        if ( count($sql_result__suspicious) ) {
     2154            foreach ( $sql_result__suspicious as $row ) {
     2155                $path = $spbc->is_windows ? str_replace('\\', '/', $row['path']) : $row['path'];
     2156                unset($row['path'], $row['status'], $row['severity']);
     2157                $row['mtime'] = $row['mtime'] + $spbc->data['site_utc_offset_in_seconds'];
     2158                $suspicious_files_found[$path] = array_values($row);
    21362159            }
    21372160        }
    21382161
    21392162        // Getting unknown files
    2140         $unknown = array();
     2163        $unknown_files_found = array();
    21412164        if ( $spbc->settings['scanner__list_unknown'] ) {
    21422165            // Getting unknown files (without source)
     
    21452168                . ' FROM ' . SPBC_TBL_SCAN_FILES
    21462169                . ' WHERE source IS NULL AND'
    2147                 . ' status <> "APROVED" AND'
     2170                . ' status <> "APPROVED_BY_USER" AND'
    21482171                . ' status <> "APPROVED_BY_CT" AND'
    21492172                . ' status <> "APPROVED_BY_CLOUD" AND'
     
    21522175                . ' path NOT LIKE "%wp-content%plugins%" AND'
    21532176                . ' path NOT LIKE "%wp-content%cache%" AND'
    2154                 . ' (severity <> "CRITICAL" OR severity IS NULL)'
     2177                . ' (severity NOT IN ("CRITICAL","SUSPICIOUS") OR severity IS NULL)'
    21552178            );
    21562179
     
    21592182                unset($row['path'], $row['severity'], $row['source'], $row['detected_at ']);
    21602183                $row['mtime'] = $row['mtime'] + $spbc->data['site_utc_offset_in_seconds'];
    2161                 $unknown[$path] = array_values($row);
     2184                $unknown_files_found[$path] = array_values($row);
    21622185            }
    21632186        }
     
    21742197            ? $spbc->data['scanner']['scanner_start_local_date']
    21752198            : current_time('Y-m-d H:i:s');
    2176         $scan_result          = $modified ? 'warning' : 'passed';
     2199        $scan_result          = !empty($critical_files_found) || !empty($suspicious_files_found) ? 'warning' : 'passed';
    21772200        $total_site_files     = $spbc->data['scanner']['files_total'] = $this->countFileSystem()['total'];
    2178         $failed_files         = $modified;
    2179         $unknown_files        = $unknown;
    21802201        $scan_type            = RemoteCalls::check() ? 'auto' : 'manual';
    21812202        $checksums_count_ct   = isset($spbc->data['scanner']['checksums_count_ct']) ? $spbc->data['scanner']['checksums_count_ct'] : null;
    21822203        $checksums_count_user = (int)$wpdb->get_var(
    2183             'SELECT COUNT(*) from ' . SPBC_TBL_SCAN_FILES . ' WHERE status = "APROVED"'
     2204            'SELECT COUNT(*) from ' . SPBC_TBL_SCAN_FILES . ' WHERE status = "APPROVED_BY_USER"'
    21842205        );
    21852206        $signatures_count     = isset($spbc->data['scanner']['signature_count']) ? $spbc->data['scanner']['signature_count'] : null;
     
    22072228            $total_core_files,
    22082229            $total_site_files,
    2209             $failed_files,
    2210             $unknown_files,
     2230            $critical_files_found,
     2231            $suspicious_files_found,
     2232            $unknown_files_found,
    22112233            $scan_type,
    22122234            $checksums_count_ct,
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/Scanner/ScanningStagesModule/ScannerFileStatuses.php

    r2848900 r3022805  
    1212    private $ok;
    1313    /** @psalm-suppress UnusedProperty */
    14     private $aproved;
     14    private $approved_by_user;
    1515    /** @psalm-suppress UnusedProperty */
    1616    private $approved_by_ct;
     
    2626        $this->unknown = 0;
    2727        $this->ok = 0;
    28         $this->aproved = 0;
     28        $this->approved_by_user = 0;
    2929        $this->approved_by_ct = 0;
    3030        $this->modified = 0;
     
    3434            'unknown'        => $this->unknown,
    3535            'ok'             => $this->ok,
    36             'aproved'        => $this->aproved,
     36            'approved_by_user'        => $this->approved_by_user,
    3737            'approved_by_ct' => $this->approved_by_ct,
    3838            'modified'       => $this->modified,
  • security-malware-firewall/trunk/lib/CleantalkSP/SpbctWP/State.php

    r3011278 r3022805  
    8686        'waf__xss_check'                    => 1,
    8787        'waf__sql_check'                    => 1,
    88         'waf__file_check'                   => 1,
    89         'waf__file_check__uploaded_plugins' => 0,
    9088        'waf__exploit_check'                => 1,
    9189        'waf_blocker__enabled'              => 0,
     90        'upload_checker__file_check'        => 1,
     91        'upload_checker__do_check_wordpress_modules' => 0,
    9292        'secfw__get_ip'                     => 1,
     93        'secfw__get_ip__enable_cdn_auto_self_check'     => 1,
    9394
    9495        // Data processing
     
    255256        // Insert api key (RC without token)
    256257        'post_api_key' => array('last_call' => 0,),
     258        // CDN check
     259        'cdn_check' => array('last_call' => 0,),
    257260
    258261    );
     
    272275
    273276        'is_on_maintenance' => false,
     277        'last_update_log' => null,
    274278    );
    275279
  • security-malware-firewall/trunk/lib/CleantalkSP/Updater/Updater.php

    r2856893 r3022805  
    7171        }
    7272
    73         if ( ! DB::getInstance()->execute('SELECT COUNT(*) FROM ' . SPBC_TBL_FIREWALL_DATA . ';')) {
     73        $sql_count_networks = "SELECT SUM(cnt) FROM (
     74                    SELECT COUNT(*) as cnt FROM " . SPBC_TBL_FIREWALL_DATA_V4 . "
     75                    UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA_V6 . "
     76                    UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V4 . "
     77                    UNION SELECT COUNT(*) FROM " . SPBC_TBL_FIREWALL_DATA__IPS_V6 . ") cnt";
     78        if ( ! DB::getInstance()->execute($sql_count_networks)) {
    7479            spbc_security_firewall_update__init();
    7580        }
  • security-malware-firewall/trunk/lib/CleantalkSP/Updater/UpdaterScripts.php

    r3011278 r3022805  
    11841184        }
    11851185    }
     1186
     1187    public static function updateTo_2_125_1()  //phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
     1188    {
     1189        /*
     1190         * Rename APROVED status to APPROVED_BY_USER
     1191         */
     1192
     1193        //change temp format of status
     1194        $sql_add_new_temp_status =
     1195            'ALTER TABLE ' . SPBC_TBL_SCAN_FILES
     1196            . ' MODIFY status enum (\'UNKNOWN\',\'OK\', \'APROVED\', \'APPROVED_BY_USER\',\'APPROVED_BY_CT\',
     1197            \'DENIED_BY_CT\',\'MODIFIED\',\'INFECTED\',\'QUARANTINED\',\'DENIED_BY_CLOUD\',\'APPROVED_BY_CLOUD\')
     1198            DEFAULT \'UNKNOWN\' NOT NULL';
     1199        DB::getInstance()->execute($sql_add_new_temp_status);
     1200
     1201        //set new status for old records
     1202        $sql_rename_status = 'UPDATE ' . SPBC_TBL_SCAN_FILES . ' SET STATUS = \'APPROVED_BY_USER\' WHERE STATUS = \'APROVED\';';
     1203        DB::getInstance()->execute($sql_rename_status);
     1204
     1205        //set new format of status
     1206        $sql_set_new_format =
     1207            'ALTER TABLE ' . SPBC_TBL_SCAN_FILES
     1208            . ' MODIFY status enum (\'UNKNOWN\',\'OK\', \'APPROVED_BY_USER\',\'APPROVED_BY_CT\',
     1209            \'DENIED_BY_CT\',\'MODIFIED\',\'INFECTED\',\'QUARANTINED\',\'DENIED_BY_CLOUD\',\'APPROVED_BY_CLOUD\')
     1210            DEFAULT \'UNKNOWN\' NOT NULL';
     1211        DB::getInstance()->execute($sql_set_new_format);
     1212
     1213        /*
     1214         * Refactor all the heuristic CRITICAL statuses to SUSPICIOUS if there is:
     1215         *  - no cloud decision
     1216         *  - no signatures threatments
     1217         */
     1218        $sql_get_heuristics_files = 'SELECT fast_hash, weak_spots
     1219            FROM ' . SPBC_TBL_SCAN_FILES . '
     1220            WHERE
     1221            STATUS = "INFECTED" AND
     1222            severity IN (\'CRITICAL\', \'DANGER\')
     1223            AND weak_spots NOT LIKE "%SIGNATURES%"
     1224            AND pscan_status IS NULL';
     1225        $heuristic_files_to_reformat = DB::getInstance()->fetchAll($sql_get_heuristics_files, ARRAY_A);
     1226
     1227
     1228        if ( !empty($heuristic_files_to_reformat) ) {
     1229            foreach ($heuristic_files_to_reformat as $_file => &$data) {
     1230                if (!empty($data['weak_spots']) && strpos($data['weak_spots'], 'CRITICAL') !== false) {
     1231                    $new_weakspots = str_replace(array('CRITICAL','DANGER'), 'SUSPICIOUS', $data['weak_spots']);
     1232                    $sql_update_heuristic_file = 'UPDATE ' . SPBC_TBL_SCAN_FILES
     1233                        . ' SET severity = \'SUSPICIOUS\', weak_spots = \'' . $new_weakspots . '\''
     1234                        . ' WHERE fast_hash = \'' . $data['fast_hash'] . '\';';
     1235                    DB::getInstance()->execute($sql_update_heuristic_file);
     1236                }
     1237            }
     1238        }
     1239    }
     1240
     1241    public static function updateTo_2_126_0() //phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps
     1242    {
     1243        global $wpdb;
     1244
     1245        if ( is_multisite() ) {
     1246            $initial_blog = get_current_blog_id();
     1247            $blogs = array_keys($wpdb->get_results('SELECT blog_id FROM ' . $wpdb->blogs, OBJECT_K));
     1248            // Deleting data from each blog
     1249            foreach ( $blogs as $blog ) {
     1250                switch_to_blog($blog);
     1251                $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall__personal_ips');
     1252            }
     1253            switch_to_blog($initial_blog);
     1254        } else {
     1255            $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'spbc_firewall__personal_ips');
     1256        }
     1257        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->base_prefix . 'spbc_firewall_data');
     1258    }
    11861259}
  • security-malware-firewall/trunk/readme.txt

    r3011278 r3022805  
    55Tested up to: 6.4
    66Requires PHP: 5.6
    7 Stable tag: 2.125
     7Stable tag: 2.126
    88License: GPLv2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    329329
    330330== Changelog ==
     331
     332= 2.126 Jan 16 2024 =
     333* New. Firewall update. All queue stages is logged now.
     334* New. Scanner results. Now all the heuristic fired files being suspicious instead of critical.
     335* New. Scanner. Sends suspicious files to cloud report.
     336* New. Feature. CDN headers self check implemented.
     337* New. UploadChecker. Checking archive in media uploader.
     338* Mod. Code. UploadChecker.php extracted from WAF module.
     339* Mod. Settings. Remove button "Delete" from Approved files accordion.
     340* Mod. SQL. IP networks separated to v4/v6 tables to reduce database size.
     341* Fix. Settings. Changed the period in the message.
     342* Fix. Accordions. Red dot status fixed.
     343* Fix. Code. mergeWithSavingNumericKeysRecursive() fixed.
     344* Fix. Code. File sending. Fix DTO and results merging.
     345* Fix. Code. SQL request for pages selector.
     346* Fix. Lib. Localization global style.
     347* Fix. Lib. Change headers logic for adaptive tales.
    331348
    332349= 2.125 Dec 18 2023 =
  • security-malware-firewall/trunk/security-malware-firewall.php

    r3011278 r3022805  
    66Description: Security & Malware scan by CleanTalk to protect your website from online threats and viruses. IP/Country FireWall, Web application FireWall. Detailed stats and logs to have full control.
    77Author: CleanTalk Security
    8 Version: 2.125
     8Version: 2.126
    99Author URI: https://cleantalk.org
    1010Text Domain: security-malware-firewall
     
    2121use CleantalkSP\SpbctWP\Cron as SpbcCron;
    2222use CleantalkSP\SpbctWP\Firewall\WafBlocker;
     23use CleantalkSP\SpbctWP\HTTP\CDNHeadersChecker;
    2324use CleantalkSP\SpbctWP\RemoteCalls as SpbcRemoteCalls;
    2425use CleantalkSP\SpbctWP\RenameLoginPage;
     
    9091global $wpdb;
    9192
    92 define('SPBC_TBL_FIREWALL_DATA', $wpdb->base_prefix . 'spbc_firewall_data'); // Legacy
    93 define('SPBC_TBL_FIREWALL_DATA__IPS', $wpdb->prefix . 'spbc_firewall__personal_ips'); // Table with firewall IPS
     93define('SPBC_TBL_FIREWALL_DATA', $wpdb->base_prefix . 'spbc_firewall_data');
     94define('SPBC_TBL_FIREWALL_DATA_V4', SPBC_TBL_FIREWALL_DATA . '_v4');
     95define('SPBC_TBL_FIREWALL_DATA_V6', SPBC_TBL_FIREWALL_DATA . '_v6');
     96define('SPBC_TBL_FIREWALL_DATA__IPS', $wpdb->prefix . 'spbc_firewall__personal_ips');
     97define('SPBC_TBL_FIREWALL_DATA__IPS_V4', SPBC_TBL_FIREWALL_DATA__IPS . '_v4'); // Table with firewall IPS v4
     98define('SPBC_TBL_FIREWALL_DATA__IPS_V6', SPBC_TBL_FIREWALL_DATA__IPS . '_v6'); // Table with firewall IPS v6
    9499define('SPBC_TBL_FIREWALL_DATA__COUNTRIES', $wpdb->prefix . 'spbc_firewall__personal_countries'); // Table with firewall countries.
    95100define('SPBC_TBL_FIREWALL_LOG', $wpdb->prefix . 'spbc_firewall_logs'); // Table with firewall logs.
     
    195200        )
    196201    ) {
     202        spbc_upload_checker__check();
    197203        spbc_firewall__check();
    198204    }
     
    419425}
    420426
     427/**
     428 * Wrapper to call UploadChecker logic.
     429 * @return void
     430 */
     431function spbc_upload_checker__check()
     432{
     433    global $spbc;
     434    if ($spbc->settings['upload_checker__file_check']) {
     435        $upload_checker = new Firewall\UploadChecker(array(
     436            'upload_checker__do_check_wordpress_modules' => $spbc->settings['upload_checker__do_check_wordpress_modules'],
     437            'api_key'                    => $spbc->api_key,
     438        ));
     439        $firewall = new Firewall();
     440        $firewall->loadFwModule($upload_checker);
     441        $firewall->run();
     442    }
     443}
     444
    421445function spbc_firewall__check()
    422446{
     
    455479            new FW(
    456480                array(
    457                     'data_table__common'             => SPBC_TBL_FIREWALL_DATA,
    458                     'data_table__personal'           => SPBC_TBL_FIREWALL_DATA__IPS,
    459481                    'data_table__personal_countries' => SPBC_TBL_FIREWALL_DATA__COUNTRIES,
    460482                    'log_table'                      => SPBC_TBL_FIREWALL_LOG,
     
    491513            'waf__xss_check'                    => $spbc->settings['waf__xss_check'],
    492514            'waf__sql_check'                    => $spbc->settings['waf__sql_check'],
    493             'waf__file_check'                   => $spbc->settings['waf__file_check'],
    494             'waf__file_check__uploaded_plugins' => $spbc->settings['waf__file_check__uploaded_plugins'],
    495515            'waf__exploit_check'                => $spbc->settings['waf__exploit_check']
    496516        ];
     
    896916                }
    897917                $metadata_assoc_array['mask'] = $masks;
    898             } else {
    899                 $metadata_assoc_array['network'] = array(0, 0, 0, $metadata_assoc_array['network']);
    900                 $metadata_assoc_array['mask'] = array(null, 0, 0, 0, $metadata_assoc_array['mask']);
    901918            }
    902919
     
    914931            $handler_output = FW::privateRecordsAdd(
    915932                DB::getInstance(),
    916                 SPBC_TBL_FIREWALL_DATA__IPS,
    917933                $metadata
    918934            );
     
    920936            $handler_output = FW::privateRecordsDelete(
    921937                DB::getInstance(),
    922                 SPBC_TBL_FIREWALL_DATA__IPS,
    923938                $metadata
    924939            );
     
    20072022    return false;
    20082023}
     2024
     2025/**
     2026 * Parse CDN checker self-request to find CDN headers.
     2027 * @return array|null[]|string[]
     2028 */
     2029function spbc_cdn_checker__parse_request()
     2030{
     2031    global $spbc;
     2032    if ($spbc->settings['secfw__get_ip__enable_cdn_auto_self_check']) {
     2033        return CDNHeadersChecker::check();
     2034    }
     2035    return array('error' => 'CDN checker disabled');
     2036}
     2037
     2038/**
     2039 * Send test request to host. Then it should be parsed to find CDN headers.
     2040 * @return void
     2041 * @psalm-suppress
     2042 */
     2043function spbc_cdn_checker__send_request()
     2044{
     2045    global $spbc;
     2046    if ($spbc->settings['secfw__get_ip__enable_cdn_auto_self_check']) {
     2047        CDNHeadersChecker::sendCDNCheckerRequest();
     2048    }
     2049}
Note: See TracChangeset for help on using the changeset viewer.