Changeset 2324310
- Timestamp:
- 06/15/2020 11:52:37 AM (6 years ago)
- Location:
- bad-ip-wp
- Files:
-
- 1 deleted
- 6 edited
- 16 copied
-
tags/1.1.0 (copied) (copied from bad-ip-wp/trunk)
-
tags/1.1.0/README.txt (copied) (copied from bad-ip-wp/trunk/README.txt) (2 diffs)
-
tags/1.1.0/admin/class-bad_ip_wp-admin.php (copied) (copied from bad-ip-wp/trunk/admin/class-bad_ip_wp-admin.php)
-
tags/1.1.0/admin/js/bad_ip_wp-admin.js (copied) (copied from bad-ip-wp/trunk/admin/js/bad_ip_wp-admin.js)
-
tags/1.1.0/admin/partials/bad_ip_404_hook.php (copied) (copied from bad-ip-wp/trunk/admin/partials/bad_ip_404_hook.php) (2 diffs)
-
tags/1.1.0/admin/partials/bad_ip_admin_dashboard_page.php (copied) (copied from bad-ip-wp/trunk/admin/partials/bad_ip_admin_dashboard_page.php)
-
tags/1.1.0/admin/partials/bad_ip_admin_menu_actions.php (copied) (copied from bad-ip-wp/trunk/admin/partials/bad_ip_admin_menu_actions.php)
-
tags/1.1.0/admin/partials/bad_ip_admin_settings_page.php (copied) (copied from bad-ip-wp/trunk/admin/partials/bad_ip_admin_settings_page.php)
-
tags/1.1.0/admin/partials/bad_ip_head_hook.php (copied) (copied from bad-ip-wp/trunk/admin/partials/bad_ip_head_hook.php) (2 diffs)
-
tags/1.1.0/admin/partials/bad_ip_login_hook.php (copied) (copied from bad-ip-wp/trunk/admin/partials/bad_ip_login_hook.php) (1 diff)
-
tags/1.1.0/admin/partials/class-bad_ip_actions.php (copied) (copied from bad-ip-wp/trunk/admin/partials/class-bad_ip_actions.php) (1 diff)
-
tags/1.1.0/admin/partials/views (copied) (copied from bad-ip-wp/trunk/admin/partials/views)
-
tags/1.1.0/admin/partials/views/page-dashboard.twig (copied) (copied from bad-ip-wp/trunk/admin/partials/views/page-dashboard.twig)
-
tags/1.1.0/admin/partials/views/page-settings.twig (copied) (copied from bad-ip-wp/trunk/admin/partials/views/page-settings.twig)
-
tags/1.1.0/admin/views (deleted)
-
tags/1.1.0/bad_ip_wp.php (copied) (copied from bad-ip-wp/trunk/bad_ip_wp.php) (2 diffs)
-
tags/1.1.0/screenshot-1.png (copied) (copied from bad-ip-wp/trunk/screenshot-1.png)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/partials/bad_ip_404_hook.php (modified) (2 diffs)
-
trunk/admin/partials/bad_ip_head_hook.php (modified) (2 diffs)
-
trunk/admin/partials/bad_ip_login_hook.php (modified) (1 diff)
-
trunk/admin/partials/class-bad_ip_actions.php (modified) (1 diff)
-
trunk/bad_ip_wp.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bad-ip-wp/tags/1.1.0/README.txt
r2313427 r2324310 4 4 Requires at least: 3.0.1 5 5 Tested up to: 5.4.1 6 Stable tag: 1. 0.26 Stable tag: 1.1.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 54 54 == Changelog == 55 55 56 = 1.0.2 = 56 = 1.1.0 = 57 * Regular refactoring and optimisation 58 59 = 1.0.20 = 57 60 * Regular refactoring and optimisation 58 61 -
bad-ip-wp/tags/1.1.0/admin/partials/bad_ip_404_hook.php
r2247105 r2324310 26 26 $bad_ipSettings->login_incidents == '1' ? $origin = get_site_url() : $origin = 'anonymous'; 27 27 $reporter = get_site_url(); 28 $_action = $_SERVER['REQUEST_URI'];28 isset($_SERVER['REQUEST_URI']) ? $_action = $_SERVER['REQUEST_URI'] : $_action = null; 29 29 30 30 // echo 'QUERY_STRING ', $_SERVER['QUERY_STRING'], PHP_EOL; 31 $QS = $_SERVER['QUERY_STRING'];31 isset($_SERVER['QUERY_STRING']) ? $QS = $_SERVER['QUERY_STRING'] : $QS = null; 32 32 // echo var_dump($wp_query->query_vars); 33 33 // echo $_SERVER['QUERY_STRING']; … … 40 40 if ($QS != '' && !self::checkIPInWhiteList($user_ip)) { 41 41 // $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 42 $actual_link = $_SERVER['REQUEST_URI'];42 isset($_SERVER['REQUEST_URI']) ? $actual_link = $_SERVER['REQUEST_URI'] : $actual_link = null; 43 43 // $_action = $actual_link; 44 44 if ( self::checkQuery($_action) ) { -
bad-ip-wp/tags/1.1.0/admin/partials/bad_ip_head_hook.php
r2301255 r2324310 5 5 $_now = date("Y-m-d H:i:s"); 6 6 7 // $whiteListArr = @array_map('trim', unserialize(file_get_contents(BAD_IP_WP_DIR.'/whitelist.bin')));8 // $blackListArr = @array_map('trim', unserialize(file_get_contents(BAD_IP_WP_DIR.'/blacklist.bin')));9 10 // if (is_null($whiteListArr)){11 // $whiteListArr = [];12 // }13 // if (is_null($blackListArr)){14 // $blackListArr = [];15 // }16 // is_null($blackListArr) ?: $blackListArr = [];17 18 // if (isset($blackListArr) && !empty($blackListArr)) { // if manually blacklisted19 7 if (self::checkIPInBlacklist($user_ip) && !self::checkIPInWhiteList($user_ip)) { 20 8 $url = BAD_IP_WP_JAIL_URL; 21 // echo "<script>window.open('".$url."','_self');</script>"; 22 Redirect($url); // todo buffer output first 23 // exit( wp_redirect($url)); 9 Redirect($url); 24 10 } 25 // }26 11 27 12 $table_settings = $wpdb->prefix . 'bad_ip_settings'; … … 30 15 31 16 32 if (self::checkOnline(BAD_IP_WP_API_URL)) {17 if (self::checkOnline(BAD_IP_WP_API_URL)) { 33 18 34 $data = array( 'uid' => $bad_ipSettings->token, 'ip' => $user_ip, );35 $bad_ipSettings->tor_block == '1' ? $data['tor'] = true : null;36 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_ip/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) );37 $_rsp = @json_decode($response->body);38 $_data = @json_encode($_rsp->data);19 $data = array( 'uid' => $bad_ipSettings->token, 'ip' => $user_ip, ); 20 $bad_ipSettings->tor_block == '1' ? $data['tor'] = true : null; 21 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_ip/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) ); 22 $_rsp = @json_decode($response->body); 23 $_data = @json_encode($_rsp->data); 39 24 40 $bodyRSP = $_data;25 $bodyRSP = $_data; 41 26 42 $dataArray = json_decode( $_data, true );43 isset($dataArray['tor_data'][0]) ? $isTor = true : $isTor = false;27 $dataArray = json_decode( $_data, true ); 28 isset($dataArray['tor_data'][0]) ? $isTor = true : $isTor = false; 44 29 45 $isBot = self::is_bot();30 $isBot = self::is_bot(); 46 31 47 if ($bad_ipSettings->deny_access == '1') {32 if ($bad_ipSettings->deny_access == '1') { 48 33 49 if ($bad_ipSettings->bot_access == '1' && $isBot) { //skip if is bot and bots are allowed50 return;51 }34 if ($bad_ipSettings->bot_access == '1' && $isBot) { //skip if is bot and bots are allowed 35 return; 36 } 52 37 53 if (self::checkIPInWhiteList($user_ip)) { //skip if is whitelisted54 return;55 }38 if (self::checkIPInWhiteList($user_ip)) { //skip if is whitelisted 39 return; 40 } 56 41 57 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 58 59 $table = $wpdb->prefix . "bad_ip_denied"; 60 $bad_ip['ip'] = $user_ip; 61 $bad_ip['seen'] = $_now; 62 $isTor ? $bad_ip['type'] = 'tor' : $bad_ip['type'] = 'bad_ip'; 63 $wpdb->replace($table, $bad_ip); 42 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 64 43 65 $url = BAD_IP_WP_JAIL_URL; 66 Redirect($url); // todo buffer output first 44 $table = $wpdb->prefix . "bad_ip_denied"; 45 $bad_ip['ip'] = $user_ip; 46 $bad_ip['seen'] = $_now; 47 $isTor ? $bad_ip['type'] = 'tor' : $bad_ip['type'] = 'bad_ip'; 48 $wpdb->replace($table, $bad_ip); 49 50 $url = BAD_IP_WP_JAIL_URL; 51 Redirect($url); // todo buffer output first 67 52 // echo "<script>window.open('".$url."','_self');</script>"; 68 53 69 54 70 } else { // check for bad_query against public database 71 72 $QS = $_SERVER['QUERY_STRING']; 73 if ($QS != '') { 74 $actual_link = $_SERVER['REQUEST_URI']; 75 if ( self::checkQuery($actual_link) ) { 76 return; 77 } //if query is whitelisted, skip 78 $data = array( 'uid' => $bad_ipSettings->token, 'query' => $actual_link, ); 79 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_query/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) ); 80 $_rsp = @json_decode($response->body); 81 $_data = @json_encode($_rsp->data); 55 } else { // check for bad_query against public database 82 56 83 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 84 $table = $wpdb->prefix . "bad_ip_denied"; 85 $bad_ip['ip'] = $user_ip; 86 $bad_ip['seen'] = $_now; 87 $bad_ip['type'] = 'bad_query'; 88 $wpdb->replace($table, $bad_ip); 89 90 $url = BAD_IP_WP_JAIL_URL; 91 Redirect($url); // todo buffer output first 57 isset($_SERVER['QUERY_STRING']) ? $QS = $_SERVER['QUERY_STRING'] : $QS = null; 58 if ($QS != '') { 59 isset($_SERVER['REQUEST_URI']) ? $actual_link = $_SERVER['REQUEST_URI'] : $actual_link = null; 60 if ( self::checkQuery($actual_link) ) { 61 return; 62 } //if query is whitelisted, skip 63 $data = array( 'uid' => $bad_ipSettings->token, 'query' => $actual_link, ); 64 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_query/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) ); 65 $_rsp = @json_decode($response->body); 66 $_data = @json_encode($_rsp->data); 67 68 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 69 $table = $wpdb->prefix . "bad_ip_denied"; 70 $bad_ip['ip'] = $user_ip; 71 $bad_ip['seen'] = $_now; 72 $bad_ip['type'] = 'bad_query'; 73 $wpdb->replace($table, $bad_ip); 74 75 $url = BAD_IP_WP_JAIL_URL; 76 Redirect($url); // todo buffer output first 92 77 // echo "<script>window.open('".$url."','_self');</script>"; 93 78 94 } 95 96 } 97 98 79 } 99 80 100 81 } 101 } 82 102 83 103 84 104 85 } 105 86 } 87 88 89 } 90 106 91 107 92 -
bad-ip-wp/tags/1.1.0/admin/partials/bad_ip_login_hook.php
r2247105 r2324310 10 10 11 11 session_start(); 12 $_SESSION['login_count'] ++;12 isset($_SESSION['login_count']) ? $_SESSION['login_count'] ++ : $_SESSION['login_count'] = 1; 13 13 14 14 -
bad-ip-wp/tags/1.1.0/admin/partials/class-bad_ip_actions.php
r2312968 r2324310 15 15 $_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; 16 16 } 17 $client = @$_SERVER['HTTP_CLIENT_IP'];18 $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];19 $remote = $_SERVER['REMOTE_ADDR'];17 isset($_SERVER['HTTP_CLIENT_IP']) ? $client = $_SERVER['HTTP_CLIENT_IP'] : $client = null; 18 isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $forward = $_SERVER['HTTP_X_FORWARDED_FOR'] : $forward = null; 19 isset($_SERVER['REMOTE_ADDR']) ? $remote = $_SERVER['REMOTE_ADDR'] : $remote = null; 20 20 21 if( filter_var($client, FILTER_VALIDATE_IP)) {21 if(isset($client) && filter_var($client, FILTER_VALIDATE_IP)) { 22 22 $ip = $client; 23 23 } 24 elseif( filter_var($forward, FILTER_VALIDATE_IP)) {24 elseif(isset($forward) && filter_var($forward, FILTER_VALIDATE_IP)) { 25 25 $ip = $forward; 26 26 } -
bad-ip-wp/tags/1.1.0/bad_ip_wp.php
r2313427 r2324310 11 11 * Plugin URI: https://bad-ip.iridiumintel.com 12 12 * Description: Protecting from malicious IP addresses visiting and trying to exploit your website with addition to block Tor endpoints 13 * Version: 1. 0.213 * Version: 1.1.0 14 14 * Author: Iridium Intelligence 15 15 * Author URI: https://iridiumintel.com … … 35 35 * Rename this for your plugin and update it as you release new versions. 36 36 */ 37 define( 'BAD_IP_WP_VERSION', '1. 0.2' );37 define( 'BAD_IP_WP_VERSION', '1.1.0' ); 38 38 define( 'BAD_IP_WP_NAME', trim(dirname(plugin_basename(__FILE__)), '/')); 39 39 define( 'BAD_IP_WP_URL', plugins_url( basename( plugin_dir_path(__FILE__) ), basename( __FILE__ ) )); -
bad-ip-wp/trunk/README.txt
r2313427 r2324310 4 4 Requires at least: 3.0.1 5 5 Tested up to: 5.4.1 6 Stable tag: 1. 0.26 Stable tag: 1.1.0 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 54 54 == Changelog == 55 55 56 = 1.0.2 = 56 = 1.1.0 = 57 * Regular refactoring and optimisation 58 59 = 1.0.20 = 57 60 * Regular refactoring and optimisation 58 61 -
bad-ip-wp/trunk/admin/partials/bad_ip_404_hook.php
r2247105 r2324310 26 26 $bad_ipSettings->login_incidents == '1' ? $origin = get_site_url() : $origin = 'anonymous'; 27 27 $reporter = get_site_url(); 28 $_action = $_SERVER['REQUEST_URI'];28 isset($_SERVER['REQUEST_URI']) ? $_action = $_SERVER['REQUEST_URI'] : $_action = null; 29 29 30 30 // echo 'QUERY_STRING ', $_SERVER['QUERY_STRING'], PHP_EOL; 31 $QS = $_SERVER['QUERY_STRING'];31 isset($_SERVER['QUERY_STRING']) ? $QS = $_SERVER['QUERY_STRING'] : $QS = null; 32 32 // echo var_dump($wp_query->query_vars); 33 33 // echo $_SERVER['QUERY_STRING']; … … 40 40 if ($QS != '' && !self::checkIPInWhiteList($user_ip)) { 41 41 // $actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 42 $actual_link = $_SERVER['REQUEST_URI'];42 isset($_SERVER['REQUEST_URI']) ? $actual_link = $_SERVER['REQUEST_URI'] : $actual_link = null; 43 43 // $_action = $actual_link; 44 44 if ( self::checkQuery($_action) ) { -
bad-ip-wp/trunk/admin/partials/bad_ip_head_hook.php
r2301255 r2324310 5 5 $_now = date("Y-m-d H:i:s"); 6 6 7 // $whiteListArr = @array_map('trim', unserialize(file_get_contents(BAD_IP_WP_DIR.'/whitelist.bin')));8 // $blackListArr = @array_map('trim', unserialize(file_get_contents(BAD_IP_WP_DIR.'/blacklist.bin')));9 10 // if (is_null($whiteListArr)){11 // $whiteListArr = [];12 // }13 // if (is_null($blackListArr)){14 // $blackListArr = [];15 // }16 // is_null($blackListArr) ?: $blackListArr = [];17 18 // if (isset($blackListArr) && !empty($blackListArr)) { // if manually blacklisted19 7 if (self::checkIPInBlacklist($user_ip) && !self::checkIPInWhiteList($user_ip)) { 20 8 $url = BAD_IP_WP_JAIL_URL; 21 // echo "<script>window.open('".$url."','_self');</script>"; 22 Redirect($url); // todo buffer output first 23 // exit( wp_redirect($url)); 9 Redirect($url); 24 10 } 25 // }26 11 27 12 $table_settings = $wpdb->prefix . 'bad_ip_settings'; … … 30 15 31 16 32 if (self::checkOnline(BAD_IP_WP_API_URL)) {17 if (self::checkOnline(BAD_IP_WP_API_URL)) { 33 18 34 $data = array( 'uid' => $bad_ipSettings->token, 'ip' => $user_ip, );35 $bad_ipSettings->tor_block == '1' ? $data['tor'] = true : null;36 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_ip/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) );37 $_rsp = @json_decode($response->body);38 $_data = @json_encode($_rsp->data);19 $data = array( 'uid' => $bad_ipSettings->token, 'ip' => $user_ip, ); 20 $bad_ipSettings->tor_block == '1' ? $data['tor'] = true : null; 21 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_ip/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) ); 22 $_rsp = @json_decode($response->body); 23 $_data = @json_encode($_rsp->data); 39 24 40 $bodyRSP = $_data;25 $bodyRSP = $_data; 41 26 42 $dataArray = json_decode( $_data, true );43 isset($dataArray['tor_data'][0]) ? $isTor = true : $isTor = false;27 $dataArray = json_decode( $_data, true ); 28 isset($dataArray['tor_data'][0]) ? $isTor = true : $isTor = false; 44 29 45 $isBot = self::is_bot();30 $isBot = self::is_bot(); 46 31 47 if ($bad_ipSettings->deny_access == '1') {32 if ($bad_ipSettings->deny_access == '1') { 48 33 49 if ($bad_ipSettings->bot_access == '1' && $isBot) { //skip if is bot and bots are allowed50 return;51 }34 if ($bad_ipSettings->bot_access == '1' && $isBot) { //skip if is bot and bots are allowed 35 return; 36 } 52 37 53 if (self::checkIPInWhiteList($user_ip)) { //skip if is whitelisted54 return;55 }38 if (self::checkIPInWhiteList($user_ip)) { //skip if is whitelisted 39 return; 40 } 56 41 57 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 58 59 $table = $wpdb->prefix . "bad_ip_denied"; 60 $bad_ip['ip'] = $user_ip; 61 $bad_ip['seen'] = $_now; 62 $isTor ? $bad_ip['type'] = 'tor' : $bad_ip['type'] = 'bad_ip'; 63 $wpdb->replace($table, $bad_ip); 42 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 64 43 65 $url = BAD_IP_WP_JAIL_URL; 66 Redirect($url); // todo buffer output first 44 $table = $wpdb->prefix . "bad_ip_denied"; 45 $bad_ip['ip'] = $user_ip; 46 $bad_ip['seen'] = $_now; 47 $isTor ? $bad_ip['type'] = 'tor' : $bad_ip['type'] = 'bad_ip'; 48 $wpdb->replace($table, $bad_ip); 49 50 $url = BAD_IP_WP_JAIL_URL; 51 Redirect($url); // todo buffer output first 67 52 // echo "<script>window.open('".$url."','_self');</script>"; 68 53 69 54 70 } else { // check for bad_query against public database 71 72 $QS = $_SERVER['QUERY_STRING']; 73 if ($QS != '') { 74 $actual_link = $_SERVER['REQUEST_URI']; 75 if ( self::checkQuery($actual_link) ) { 76 return; 77 } //if query is whitelisted, skip 78 $data = array( 'uid' => $bad_ipSettings->token, 'query' => $actual_link, ); 79 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_query/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) ); 80 $_rsp = @json_decode($response->body); 81 $_data = @json_encode($_rsp->data); 55 } else { // check for bad_query against public database 82 56 83 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 84 $table = $wpdb->prefix . "bad_ip_denied"; 85 $bad_ip['ip'] = $user_ip; 86 $bad_ip['seen'] = $_now; 87 $bad_ip['type'] = 'bad_query'; 88 $wpdb->replace($table, $bad_ip); 89 90 $url = BAD_IP_WP_JAIL_URL; 91 Redirect($url); // todo buffer output first 57 isset($_SERVER['QUERY_STRING']) ? $QS = $_SERVER['QUERY_STRING'] : $QS = null; 58 if ($QS != '') { 59 isset($_SERVER['REQUEST_URI']) ? $actual_link = $_SERVER['REQUEST_URI'] : $actual_link = null; 60 if ( self::checkQuery($actual_link) ) { 61 return; 62 } //if query is whitelisted, skip 63 $data = array( 'uid' => $bad_ipSettings->token, 'query' => $actual_link, ); 64 $response = Requests::post( BAD_IP_WP_API_URL.'/api/v1/bad_query/check/?uid='.$bad_ipSettings->token, array(), json_encode($data) ); 65 $_rsp = @json_decode($response->body); 66 $_data = @json_encode($_rsp->data); 67 68 if (isset($_rsp) && $_rsp->code == 666) { // if recorded in bad_ip public database 69 $table = $wpdb->prefix . "bad_ip_denied"; 70 $bad_ip['ip'] = $user_ip; 71 $bad_ip['seen'] = $_now; 72 $bad_ip['type'] = 'bad_query'; 73 $wpdb->replace($table, $bad_ip); 74 75 $url = BAD_IP_WP_JAIL_URL; 76 Redirect($url); // todo buffer output first 92 77 // echo "<script>window.open('".$url."','_self');</script>"; 93 78 94 } 95 96 } 97 98 79 } 99 80 100 81 } 101 } 82 102 83 103 84 104 85 } 105 86 } 87 88 89 } 90 106 91 107 92 -
bad-ip-wp/trunk/admin/partials/bad_ip_login_hook.php
r2247105 r2324310 10 10 11 11 session_start(); 12 $_SESSION['login_count'] ++;12 isset($_SESSION['login_count']) ? $_SESSION['login_count'] ++ : $_SESSION['login_count'] = 1; 13 13 14 14 -
bad-ip-wp/trunk/admin/partials/class-bad_ip_actions.php
r2312968 r2324310 15 15 $_SERVER['HTTP_CLIENT_IP'] = $_SERVER["HTTP_CF_CONNECTING_IP"]; 16 16 } 17 $client = @$_SERVER['HTTP_CLIENT_IP'];18 $forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];19 $remote = $_SERVER['REMOTE_ADDR'];17 isset($_SERVER['HTTP_CLIENT_IP']) ? $client = $_SERVER['HTTP_CLIENT_IP'] : $client = null; 18 isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $forward = $_SERVER['HTTP_X_FORWARDED_FOR'] : $forward = null; 19 isset($_SERVER['REMOTE_ADDR']) ? $remote = $_SERVER['REMOTE_ADDR'] : $remote = null; 20 20 21 if( filter_var($client, FILTER_VALIDATE_IP)) {21 if(isset($client) && filter_var($client, FILTER_VALIDATE_IP)) { 22 22 $ip = $client; 23 23 } 24 elseif( filter_var($forward, FILTER_VALIDATE_IP)) {24 elseif(isset($forward) && filter_var($forward, FILTER_VALIDATE_IP)) { 25 25 $ip = $forward; 26 26 } -
bad-ip-wp/trunk/bad_ip_wp.php
r2313427 r2324310 11 11 * Plugin URI: https://bad-ip.iridiumintel.com 12 12 * Description: Protecting from malicious IP addresses visiting and trying to exploit your website with addition to block Tor endpoints 13 * Version: 1. 0.213 * Version: 1.1.0 14 14 * Author: Iridium Intelligence 15 15 * Author URI: https://iridiumintel.com … … 35 35 * Rename this for your plugin and update it as you release new versions. 36 36 */ 37 define( 'BAD_IP_WP_VERSION', '1. 0.2' );37 define( 'BAD_IP_WP_VERSION', '1.1.0' ); 38 38 define( 'BAD_IP_WP_NAME', trim(dirname(plugin_basename(__FILE__)), '/')); 39 39 define( 'BAD_IP_WP_URL', plugins_url( basename( plugin_dir_path(__FILE__) ), basename( __FILE__ ) ));
Note: See TracChangeset
for help on using the changeset viewer.