Settings'; array_unshift($links, $settings_link); return $links; } $plugin = plugin_basename(__FILE__); add_filter("plugin_action_links_$plugin", 'antihacker_plugin_settings_link' ); /* Begin Language */ if(is_admin()) { function ah_localization_init_fail() { echo '
'; echo '
'; echo __('Anti Hacker Plugin: Could not load the localization file (Language file)','antihacker'); echo '.
'; echo __('Please, take a look in our site, FAQ page, item => How can i translate this plugin?', 'antihacker'); echo '

'; } if (isset($_GET['page'])) { $page = sanitize_text_field($_GET['page']); if ($page == 'anti-hacker') { $path = dirname(plugin_basename( __FILE__ )) . '/language/'; $loaded = load_plugin_textdomain( 'antihacker', false, $path); if (!$loaded AND get_locale() <> 'en_US') { //if( function_exists('ah_localization_init_fail')) // add_action( 'admin_notices', 'ah_localization_init_fail' ); } } } } else { add_action( 'plugins_loaded', 'ah_localization_init' ); } function ah_localization_init() { $path = dirname(plugin_basename( __FILE__ )) . '/language/'; $loaded = load_plugin_textdomain( 'antihacker', false, $path); } /* End language */ require_once (ANTIHACKERPATH . "settings/load-plugin.php"); require_once (ANTIHACKERPATH . "includes/functions/functions.php"); $my_whitelist = trim(sanitize_text_field(get_site_option('my_whitelist',''))); $amy_whitelist = explode(PHP_EOL, $my_whitelist); $antihackerip = trim(ahfindip()); $ah_admin_email = trim(sanitize_text_field(get_option( 'my_email_to' ))); $my_radio_all_logins = sanitize_text_field(get_site_option('my_radio_all_logins', 'No')); // Alert me All Logins $my_checkbox_all_failed = sanitize_text_field(get_site_option('my_checkbox_all_failed', '0')); // Alert me all Failed Login Attempts $anti_hacker_firewall = sanitize_text_field(get_option('antihacker_firewall','yes')); $antihacker_Blocked_Firewall = sanitize_text_field(get_option('antihacker_Blocked_Firewall','no')); if(!empty($_POST["myemail"])) {$myemail = $_POST["myemail"];} else {$myemail = '';} require_once (ANTIHACKERPATH . "settings/options/plugin_options_tabbed.php"); $ah_admin_email = trim(sanitize_text_field(get_option( 'my_email_to' ))); if( ! empty($ah_admin_email)) { if ( ! is_email($ah_admin_email)) { $ah_admin_email = ''; update_option('my_email_to', ''); } } if(empty($ah_admin_email)) $ah_admin_email = sanitize_email(get_option( 'admin_email' )); // Firewall if( ! is_admin()) { if( $anti_hacker_firewall != 'no') { $antihacker_request_uri_array = array('@eval', 'eval\(', 'UNION(.*)SELECT', '\(null\)', 'base64_', '\/localhost', '\%2Flocalhost', '\/pingserver', 'wp-config\.php', '\/config\.', '\/wwwroot', '\/makefile', 'crossdomain\.', 'proc\/self\/environ', 'usr\/bin\/perl', 'var\/lib\/php', 'etc\/passwd', '\/https\:', '\/http\:', '\/ftp\:', '\/file\:', '\/php\:', '\/cgi\/', '\.cgi', '\.cmd', '\.bat', '\.exe', '\.sql', '\.ini', '\.dll', '\.htacc', '\.htpas', '\.pass', '\.asp', '\.jsp', '\.bash', '\/\.git', '\/\.svn', ' ', '\<', '\>', '\/\=', '\.\.\.', '\+\+\+', '@@', '\/&&', '\/Nt\.', '\;Nt\.', '\=Nt\.', '\,Nt\.', '\.exec\(', '\)\.html\(', '\{x\.html\(', '\(function\(', '\.php\([0-9]+\)', '(benchmark|sleep)(\s|%20)*\(', 'indoxploi', 'xrumer'); $antihacker_query_string_array = array('@@', '\(0x', '0x3c62723e', '\;\!--\=', '\(\)\}', '\:\;\}\;', '\.\.\/', '127\.0\.0\.1', 'UNION(.*)SELECT', '@eval', 'eval\(', 'base64_', 'localhost', 'loopback', '\%0A', '\%0D', '\%00', '\%2e\%2e', 'allow_url_include', 'auto_prepend_file', 'disable_functions', 'input_file', 'execute', 'file_get_contents', 'mosconfig', 'open_basedir', '(benchmark|sleep)(\s|%20)*\(', 'phpinfo\(', 'shell_exec\(', '\/wwwroot', '\/makefile', 'path\=\.', 'mod\=\.', 'wp-config\.php', '\/config\.', '\$_session', '\$_request', '\$_env', '\$_server', '\$_post', '\$_get', 'indoxploi', 'xrumer'); $antihacker_user_agent_array = array('drivermysqli', 'acapbot', '\/bin\/bash', 'binlar', 'casper', 'cmswor', 'diavol', 'dotbot', 'finder', 'flicky', 'md5sum', 'morfeus', 'nutch', 'planet', 'purebot', 'pycurl', 'semalt', 'shellshock', 'skygrid', 'snoopy', 'sucker', 'turnit', 'vikspi', 'zmeu'); $antihacker_request_uri_string = false; $antihacker_query_string_string = false; if (isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) $antihacker_request_uri_string = $_SERVER['REQUEST_URI']; if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) $antihacker_query_string_string = $_SERVER['QUERY_STRING']; if (isset($_SERVER['HTTP_USER_AGENT']) && !empty($_SERVER['HTTP_USER_AGENT'])) $antihacker_user_agent_string = $_SERVER['HTTP_USER_AGENT']; if ($antihacker_request_uri_string || $antihacker_query_string_string || $antihacker_user_agent_screen_string) { if ( preg_match('/'. implode('|', $antihacker_request_uri_array) .'/i', $antihacker_request_uri_string, $matches) || preg_match('/'. implode('|', $antihacker_query_string_array) .'/i', $antihacker_query_string_string, $matches2) || preg_match('/'. implode('|', $antihacker_user_agent_array) .'/i', $antihacker_user_agent_string,$matches3) ) { if( $antihacker_Blocked_Firewall == 'yes') { if(isset($matches)) { if (is_array($matches)) { if(count($matches) > 0) { antihacker_alertme3($matches[0]); } } } if(isset($matches2)) { if (is_array($matches2)) { if(count($matches2) > 0) antihacker_alertme3($matches2[0]); } } if(isset($matches3)) { if (is_array($matches3)) { if(count($matches3) > 0) antihacker_alertme4($matches3[0]); } } } wp_die(""); } // Endif match... } // endif if ($antihacker_query_string_string || $user_agent_string) } // firewall <> no } // End Firewall if (! ah_whitelisted($antihackerip, $amy_whitelist)) { add_action('login_form', 'ah_email_display'); add_action('wp_authenticate_user', 'ah_validate_email_field', 10, 2); function ah_validate_email_field($user, $password) { global $myemail; if (!is_email($myemail)) return new WP_Error('wrong_email', 'Please, fill out the email field!'); else { // The Query $user_query = new WP_User_Query( array ( 'orderby' => 'registered', 'order' => 'ASC' ) ); // User Loop if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results as $user ) { if(strtolower(trim($user->user_email)) == $myemail ) return $user; } } else { // echo 'No users found.'; } return new WP_Error( 'wrong_email', 'email not found!'); } return $user; } } /* endif if (! ah_whitelisted($antihackerip, $my_whitelist)) */ add_action('wp_login', 'ah_successful_login'); add_action('wp_login_failed', 'ah_failed_login'); register_deactivation_hook(__FILE__, 'ah_my_deactivation'); register_activation_hook( __FILE__, 'ah_activated' ); if (sanitize_text_field(get_site_option('antihacker_automatic_plugins', 'no')) == 'yes') add_filter( 'auto_update_plugin', '__return_true' ); if (get_site_option('antihacker_automatic_themes', 'no') == 'yes') add_filter( 'auto_update_theme', '__return_true' ); if (sanitize_text_field(get_site_option('antihacker_replace_login_error_msg', 'no')) == 'yes') add_filter( 'login_errors', function( $error ) { return ''.__('Wrong Username or Password', 'antihacker') .''; } ); if (sanitize_text_field(get_site_option('antihacker_disallow_file_edit', 'yes')) == 'yes') { if( ! defined('DISALLOW_FILE_EDIT')) define('DISALLOW_FILE_EDIT', true); } if (WP_DEBUG and get_site_option('antihacker_debug_is_true', 'yes') == 'yes') add_action( 'admin_notices', 'ah_debug_enabled' ); function antihacker_load_feedback() { if(is_admin()) { // ob_start(); require_once (ANTIHACKERPATH . "includes/feedback/feedback.php"); if( sanitize_text_field(get_option('bill_last_feedback', '')) != '1') require_once (ANTIHACKERPATH . "includes/feedback/feedback-last.php"); } // ob_end_clean(); } add_action( 'wp_loaded', 'antihacker_load_feedback' ); function antihackerplugin_load_activate() { if (is_admin()) { require_once (ANTIHACKERPATH . 'includes/feedback/activated-manager.php'); } } add_action('in_admin_footer', 'antihackerplugin_load_activate'); //$out = ob_get_clean(); ?>