MalCare WordPress Security Plugin – Malware Scanner, Cleaner, Security Firewall - Version 3.6

Version Description

  • WPCli to server request path updated
  • Authentication header added in wpcli request param
Download this release

Release Info

Developer ritesh.soni36
Plugin Icon 128x128 MalCare WordPress Security Plugin – Malware Scanner, Cleaner, Security Firewall
Version 3.6
Comparing to
See all releases

Code changes from version 3.5 to 3.6

Files changed (5) hide show
  1. info.php +1 -1
  2. malcare.php +1 -1
  3. readme.txt +5 -1
  4. wp_api.php +6 -3
  5. wp_cli.php +13 -4
info.php CHANGED
@@ -9,7 +9,7 @@ if (!class_exists('MCInfo')) :
9
  public $badgeinfo = 'mcbadge';
10
  public $ip_header_option = 'mcipheader';
11
  public $brand_option = 'mcbrand';
12
- public $version = '3.5';
13
  public $webpage = 'https://www.malcare.com';
14
  public $appurl = 'https://app.malcare.com';
15
  public $slug = 'malcare-security/malcare.php';
9
  public $badgeinfo = 'mcbadge';
10
  public $ip_header_option = 'mcipheader';
11
  public $brand_option = 'mcbrand';
12
+ public $version = '3.6';
13
  public $webpage = 'https://www.malcare.com';
14
  public $appurl = 'https://app.malcare.com';
15
  public $slug = 'malcare-security/malcare.php';
malcare.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://www.malcare.com
5
  Description: WordPress Security, Firewall and Malware Scanner
6
  Author: MalCare Security
7
  Author URI: https://www.malcare.com
8
- Version: 3.5
9
  Network: True
10
  */
11
 
5
  Description: WordPress Security, Firewall and Malware Scanner
6
  Author: MalCare Security
7
  Author URI: https://www.malcare.com
8
+ Version: 3.6
9
  Network: True
10
  */
11
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://www.malcare.com
6
  Requires at least: 4.0
7
  Tested up to: 5.3
8
  Requires PHP: 5.3.0
9
- Stable tag: 3.5
10
  License: GPLv2 or later
11
  License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
12
 
@@ -218,6 +218,10 @@ FTP details input into MalCare is processed on our servers. We need your FTP cre
218
  8. With BlogVault's White-Label Solution you can showcase our service under your own brilliant brand.
219
 
220
  == CHANGELOG ==
 
 
 
 
221
  = 3.5 =
222
  * Firewall in prepend mode
223
  * Robust Firewall and Login protection
6
  Requires at least: 4.0
7
  Tested up to: 5.3
8
  Requires PHP: 5.3.0
9
+ Stable tag: 3.6
10
  License: GPLv2 or later
11
  License URI: [http://www.gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html)
12
 
218
  8. With BlogVault's White-Label Solution you can showcase our service under your own brilliant brand.
219
 
220
  == CHANGELOG ==
221
+ = 3.6 =
222
+ * WPCli to server request path updated
223
+ * Authentication header added in wpcli request param
224
+
225
  = 3.5 =
226
  * Firewall in prepend mode
227
  * Robust Firewall and Login protection
wp_api.php CHANGED
@@ -26,12 +26,15 @@ if (!class_exists('MCWPAPI')) :
26
  $this->http_request($url, $body);
27
  }
28
 
29
- public function http_request($url, $body) {
30
  $_body = array(
31
  'method' => 'POST',
32
  'timeout' => 15,
33
- 'body' => $body);
34
-
 
 
 
35
  return wp_remote_post($url, $_body);
36
  }
37
  }
26
  $this->http_request($url, $body);
27
  }
28
 
29
+ public function http_request($url, $body, $headers = array()) {
30
  $_body = array(
31
  'method' => 'POST',
32
  'timeout' => 15,
33
+ 'body' => $body
34
+ );
35
+ if (!empty($headers)) {
36
+ $_body['headers'] = $headers;
37
+ }
38
  return wp_remote_post($url, $_body);
39
  }
40
  }
wp_cli.php CHANGED
@@ -17,8 +17,8 @@ class MCWPCli {
17
  $this->bvapi = $bvapi;
18
  }
19
 
20
- public function request($url, $request_params = array()) {
21
- $resp = $this->bvapi->http_request($url, $request_params);
22
  $this->handle_response($resp);
23
  }
24
 
@@ -50,6 +50,12 @@ class MCWPCli {
50
  } else {
51
  WP_CLI::error("Invalid Response. Please retry or contact us.");
52
  }
 
 
 
 
 
 
53
  } else {
54
  if (isset($resp["response"]["message"])) {
55
  WP_CLI::error("code: {$resp_code} -- message: {$resp["response"]["message"]} . Please retry or contact us");
@@ -89,11 +95,14 @@ class MCWPCli {
89
  $request_params = array_merge($this->siteinfo->info(), $this->bvinfo->info());
90
  $request_params['bvpublic'] = MCAccount::getApiPublicKey($this->settings);
91
  $request_params['bvsecret'] = MCRecover::defaultSecret($this->settings);
92
- $url = $this->bvinfo->appUrl()."/wpcli/register";
93
  foreach (preg_grep('#time|customer_id|host_id|action|sig|site_id|email|password#i', array_keys($params)) as $key ) {
94
  $request_params[$key] = $params[$key];
95
  }
96
- $this->request($url, $request_params);
 
 
 
97
  break;
98
  case "disable_fw":
99
  $account = MCAccount::apiPublicAccount($this->settings);
17
  $this->bvapi = $bvapi;
18
  }
19
 
20
+ public function request($url, $request_params = array(), $headers = array()) {
21
+ $resp = $this->bvapi->http_request($url, $request_params, $headers);
22
  $this->handle_response($resp);
23
  }
24
 
50
  } else {
51
  WP_CLI::error("Invalid Response. Please retry or contact us.");
52
  }
53
+ } else if (preg_match("/^4[0-9][0-9]$/", strval($resp_code))) {
54
+ if (isset($resp["body"])) {
55
+ WP_CLI::error("code: {$resp_code} -- message: {$resp["body"]}");
56
+ } else {
57
+ WP_CLI::error("Invalid Response. Please retry or contact us.");
58
+ }
59
  } else {
60
  if (isset($resp["response"]["message"])) {
61
  WP_CLI::error("code: {$resp_code} -- message: {$resp["response"]["message"]} . Please retry or contact us");
95
  $request_params = array_merge($this->siteinfo->info(), $this->bvinfo->info());
96
  $request_params['bvpublic'] = MCAccount::getApiPublicKey($this->settings);
97
  $request_params['bvsecret'] = MCRecover::defaultSecret($this->settings);
98
+ $url = $this->bvinfo->appUrl()."/api/v2/sites/register";
99
  foreach (preg_grep('#time|customer_id|host_id|action|sig|site_id|email|password#i', array_keys($params)) as $key ) {
100
  $request_params[$key] = $params[$key];
101
  }
102
+ $headers = array(
103
+ 'Authorization' => "BVAPI-{HMAC-SHA512} {$request_params['host_id']}:{$request_params['sig']}:{$request_params['time']}"
104
+ );
105
+ $this->request($url, $request_params, $headers);
106
  break;
107
  case "disable_fw":
108
  $account = MCAccount::apiPublicAccount($this->settings);