Plugin Directory

Changeset 2615297


Ignore:
Timestamp:
10/17/2021 08:44:25 AM (4 years ago)
Author:
code9fair
Message:

Update anti brute force login

Location:
code9/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code9/trunk/code9.php

    r2612798 r2615297  
    44Plugin URI: https://wordpress.org/plugins/code9/
    55Description: Utility tool for wordpress. 2-step verificatoin code user login.
    6 Version:     1.0.0
     6Version:     1.0.1
    77Author:      Code9Fair
    88Author URI: https://paypal.me/code9fair/
     
    3131  $GLOBALS['CODE9_PLUGIN_DIR'] = plugin_dir_path( __FILE__ );
    3232  $GLOBALS['CODE9_PLUGIN_URL'] = plugin_dir_url( __FILE__ );
     33 
     34  require($GLOBALS['CODE9_PLUGIN_DIR'] . 'function/code9_anti_brute_foce.php');
    3335
    3436  if(wp_get_current_user()->ID !== 0) {
     
    3941    require($GLOBALS['CODE9_PLUGIN_DIR'] . 'function/code9_security.php');
    4042    require($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/spa.php');
    41     require($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_2_step_get.php');
    4243    require($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_2_step_key_iv_reset.php');
    4344    require($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_2_step_update.php');
     45    require($GLOBALS['CODE9_PLUGIN_DIR'] . 'plugin/security/api/security_anti_brute_force_update.php');
     46
     47   
    4448  }
    4549
  • code9/trunk/function/code9_security.php

    r2613018 r2615297  
    9292                if ($error->getMessage() === '2step-code9') {
    9393
    94                     if (isset($_SESSION['code9_security_auth_' . $admin_id . '_block_time']) === true && $_SESSION['code9_security_auth_' . $admin_id . '_block_time'] > time()) {
     94                    if (isset($_SESSION['code9_security_auth_' . $admin_id . '_block_time']) === true && $_SESSION['code9_security_auth_' . $admin_id . '_block_time'] !== null  && $_SESSION['code9_security_auth_' . $admin_id . '_block_time'] > time()) {
    9595
    9696                        wp_die('<h1>' . __('Account locked', 'c9') . '</h1><p><span id="c9-countdown-container">Wait</span> until account unlock.</p><script type="text/javascript">
     
    108108                    })();
    109109
    110                     </script><p><a href="' . wp_logout_url('') . '">' . __('Sign out', 'c9') . '</a></p>', "Account has been block - Code9");
     110                    </script><p><a href="' . wp_logout_url('') . '">' . __('Sign out', 'c9') . '</a></p>', __("Account has been block", "c9") . " - Code9");
    111111
    112112                    }
     
    136136                                            $_SESSION['code9_security_auth_' . $admin_id] = $_COOKIE['code9_security_public'];
    137137
    138                                             $_SESSION['code9_security_auth_' . $admin_id . '_attemp'] = 0;
     138                                            $_SESSION['code9_security_auth_' . $admin_id . '_attemp'] = null;
     139                                            $_SESSION['code9_security_auth_' . $admin_id . '_block_time'] = null;
    139140                                        } else {
    140                                             if (isset($_SESSION['code9_security_auth_' . $admin_id . '_attemp']) !== true) {
     141                                            if (isset($_SESSION['code9_security_auth_' . $admin_id . '_attemp']) !== true || $_SESSION['code9_security_auth_' . $admin_id . '_attemp'] === null) {
    141142                                                $_SESSION['code9_security_auth_' . $admin_id . '_attemp'] = 0;
    142143                                            }
     
    518519    add_action('edit_user_profile_update', 'code9_security_2_step_code_edit_update');
    519520}
     521
  • code9/trunk/plugin/security/spa/security.js

    r2612798 r2615297  
    11(async function () {
    2   var _response = await C9_API("security_2_step_get");
    32
    4   jQuery("#c9-security_2_step-checkbox").prop('checked', _response.data === '1' ? true: false);
    53 
    64  jQuery("#c9-security_2_step-checkbox").on("change", function () {
     
    1210
    1311  jQuery('#c9-security_2_step-logout-all-user-button').unbind('click').bind('click', async function() {
    14     var _button_html = C9_BUTTON_LOADING(jQuery(this)[0]);
     12    var _button_html = C9_DOM_LOADING(jQuery(this)[0]);
    1513
    1614    var _response = await C9_API("security_2_step_key_iv_reset");
    1715
    18     C9_BUTTON_LOADING(jQuery(this)[0], _button_html);
     16    C9_DOM_LOADING(jQuery(this)[0], _button_html);
    1917   
    2018    if(_response.result === true) {
     
    2321      C9_NOTI(_response.response_text);
    2422    }
    25   });
     23  });
     24 
     25  jQuery("#c9-security_security_anti_brute_force-checkbox").on("change", function () {
     26    console.log(jQuery("#c9-security_security_anti_brute_force-checkbox").prop("checked"))
     27    C9_API("security_anti_brute_force_update", {
     28      security_anti_brute_force:
     29      jQuery("#c9-security_security_anti_brute_force-checkbox").prop("checked") === true ? "1" : "0",
     30    });
     31  });
     32
    2633})();
  • code9/trunk/plugin/security/spa/security.php

    r2612798 r2615297  
    99    </label>
    1010  </div>
    11   <div>
     11  <div class="c9-margin-bottom-small">
    1212    <button class="button" id="c9-security_2_step-logout-all-user-button"><?php echo __('log out 2 step sign in for all user'); ?></button>
    1313  </div>
     14  <div class="c9-margin-bottom-small">
     15    <label>
     16      <input type="checkbox" value="1" id="c9-security_security_anti_brute_force-checkbox" <?php echo get_option('code9_security_anti_brute_force', '0') === '1' ? 'checked="checked"' : '' ?> />
     17      <?php echo __('Use anti brute force attack', 'c9'); ?>
     18    </label>
     19  </div>
    1420</div>
  • code9/trunk/readme.txt

    r2612798 r2615297  
    22Contributors: Code9fair
    33Donate link: https://paypal.me/code9fair
    4 Tags: 2-step login, verification password, anti brute force login
     4Tags: 2-step login, verification password, anti brute force login, xmlrpc.php
    55Requires at least: 5.8
    66Tested up to: 5.8
     
    1414== Description ==
    1515
     16== 2-Step Verification Code ==
     17
    1618Code9 2-step verification code will add more protection to site admin area.
    1719
     
    2325* Admin can active and deactive 2-step verification code anytime.
    2426
     27== Anti Brute Force ==
     28
     29Prevent attacker from continuous login. (Including xmlrpc.php)
     30* If plugin detects that there is a continuous login. Plugin will redirect user to Recapcha page before allow user to continue login.
    2531
    2632== Installation ==
     
    42488. User can try 2-step verification again when locked time is up.
    43499. Install and activate Code9 plugin.
     5010. Prevent user to continuous login if user has repeatedly entering wrong username or password.
     51
     52== Changelog ==
     53
     54= 1.0.1 =
     55 * Add function anti brute force attack.
Note: See TracChangeset for help on using the changeset viewer.