Changeset 1471472
- Timestamp:
- 08/10/2016 11:11:53 AM (10 years ago)
- Location:
- ivguard
- Files:
-
- 3 added
- 2 edited
-
tags/1.2.1 (added)
-
tags/1.2.1/IVGuard.php (added)
-
tags/1.2.1/readme.txt (added)
-
trunk/IVGuard.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ivguard/trunk/IVGuard.php
r1470852 r1471472 5 5 Description: IVGuard is one of the most powerful protection and monitoring services for WordPress. You will be informed immediately for any changes and discrepancies in your website and our team will be always on standby to help you resolve any security threats. Have full control of your website once and for all. 6 6 Author: Ignite Vision Ltd 7 Version: 1.2 7 Version: 1.2.1 8 8 Author URI: http://www.ignitevision.bg 9 9 */ … … 30 30 const CRAWLER = 'crawler.ivguard.net'; 31 31 const APIKEY = 'ivGuardKey'; 32 const ALLOWED_IPS_KEY = 'ivGuardAllowedIPs'; 32 33 const WEBSITE = 'https://ivguard.net/'; 33 34 const API = 'https://dashboard.ivguard.net/api/'; … … 359 360 360 361 public static function authorize() { 361 $allowIPs = dns_get_record(IVGuard::CRAWLER, DNS_A + DNS_AAAA); 362 if(is_array($allowIPs)) 363 array_walk($allowIPs, function(&$item, $key) { $item = $item['type'] == 'A' ? $item['ip'] : $item['ipv6']; }); 364 if(!in_array($_SERVER['REMOTE_ADDR'], $allowIPs)) 362 if(!in_array($_SERVER['REMOTE_ADDR'], IVGuard::getAllowedIPs())) 365 363 throw new Exception('Unauthorized actions have been detected! [BAD IP]'); 366 364 if(!($ivGuardKey = get_option(IVGuard::APIKEY))) … … 368 366 if(!isset($_POST['ivGuardKey']) || $_POST['ivGuardKey'] != $ivGuardKey) 369 367 throw new Exception('Unauthorized actions have been detected! [BAD KEY]'); 368 } 369 370 public static function getAllowedIPs() { 371 if(($data = get_option(IVGuard::ALLOWED_IPS_KEY))) { 372 if(!is_array($data = json_decode($data, true)) || !array_key_exists('expire', $data) || !array_key_exists('allowedIPs', $data) || $data['expire'] < time()) 373 $data = false; 374 } 375 if(!$data) { 376 $allowedIPs = dns_get_record(IVGuard::CRAWLER, DNS_A + DNS_AAAA); 377 if(!is_array($allowedIPs)) 378 throw new Exception('Unable to get a list with allowed IP addresses! [DNS Error]'); 379 array_walk($allowedIPs, function(&$item, $key) { $item = $item['type'] == 'A' ? $item['ip'] : $item['ipv6']; }); 380 $data = array('expire' => time() + 3600, 'allowedIPs' => $allowedIPs); 381 update_option(IVGuard::ALLOWED_IPS_KEY, json_encode($data)); 382 } 383 return $data['allowedIPs']; 370 384 } 371 385 -
ivguard/trunk/readme.txt
r1470852 r1471472 5 5 Requires at least: 4.4 6 6 Tested up to: 4.6 7 Stable tag: 1.2 7 Stable tag: 1.2.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 96 96 == Changelog == 97 97 98 = 1.2.1 = 99 * Add - DNS Cache 100 98 101 = 1.2 = 99 102 * Add - Brute-Force Protection … … 106 109 = 1.0 = 107 110 * Initial release 108 109 == Upgrade Notice ==110 111 = 1.2 =112 Version 1.2 content a new features (Brute-Force Protection). It is recommended for all users.113 114 = 1.1 =115 Version 1.1 contains a new feature (Bad Bots Block) and a bug fix that fixes API output. It is recommended for all users.116 117 = 1.0 =118 First Release
Note: See TracChangeset
for help on using the changeset viewer.