PluginProbe
Patchstack – WordPress & Plugins Security / 2.1.25
Patchstack – WordPress & Plugins Security v2.1.25
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | patchstack.php +40 -9 2.1.112.1.25 View file →
@@ -2,9 +2,9 @@
2 2 /**
3 3 * Plugin Name: Patchstack Security
4 4 * Plugin URI: https://patchstack.com
5 5 * Description: Patchstack identifies security vulnerabilities in WordPress plugins, themes, and core.
6 - * Version: 2.1.11
6 + * Version: 2.1.25
7 7 * Author: Patchstack
8 8 * License: GPLv3
9 9 * Text Domain: patchstack
10 10 * Domain Path: /languages
@@ -57,9 +57,9 @@
57 57 * The plugin version.
58 58 *
59 59 * @var string
60 60 */
61 - const VERSION = '2.1.11';
61 + const VERSION = '2.1.25';
62 62
63 63 /**
64 64 * API URL of Patchstack to communicate with.
65 65 *
@@ -88,15 +88,8 @@
88 88 */
89 89 const PRIVATE_KEY = 'PATCHSTACK_PRIVATE_KEY';
90 90
91 91 /**
92 - * Known IP addresses.
93 - *
94 - * @var array
95 - */
96 - protected $ips = array( '18.221.197.243', '52.15.237.250', '3.19.3.34', '3.18.238.17', '13.58.49.77', '18.222.191.77', '3.131.108.250', '3.23.157.140', '18.220.70.233', '3.140.84.221', '185.212.171.100' );
97 -
98 - /**
99 92 * URL of the plugin directory.
100 93 *
101 94 * @var string
102 95 */
@@ -145,8 +138,9 @@
145 138 protected $htaccess;
146 139 protected $hacker_log;
147 140 protected $upload;
148 141 protected $rules;
142 + protected $hide_login;
149 143 protected $listener;
150 144 protected $event_log;
151 145 protected $multisite;
152 146 protected $notice;
@@ -175,8 +169,13 @@
175 169 $this->basename = plugin_basename( __FILE__ );
176 170 $this->url = plugin_dir_url( __FILE__ );
177 171 $names = explode( '/', $this->basename );
178 172 $this->name = $names[0];
173 +
174 + // Define WP_CLI command.
175 + if ( defined( 'WP_CLI' ) && WP_CLI && method_exists('\WP_CLI', 'add_command')) {
176 + \WP_CLI::add_command( 'patchstack activate', [ $this, 'cli_activate' ] );
177 + }
179 178 }
180 179
181 180 /**
182 181 * Call the constructor of all the Patchstack related classes.
@@ -195,8 +194,9 @@
195 194 'htaccess' => 'P_Htaccess',
196 195 'hacker_log' => 'P_Hacker_Log',
197 196 'upload' => 'P_Upload',
198 197 'rules' => 'P_Rules',
198 + 'hide_login' => 'P_Hide_Login',
199 199 'listener' => 'P_Listener',
200 200 'event_log' => 'P_Event_Log',
201 201 'activation' => 'P_Activation',
202 202 'multisite' => 'P_Multisite',
@@ -218,8 +218,39 @@
218 218 */
219 219 public function activate() {
220 220 $this->plugin_classes();
221 221 $this->activation->activate( $this );
222 + }
223 +
224 + /**
225 + * Connects the Patchstack plugin to the API with the license id and secret key.
226 + *
227 + * Returns an error if the connection was not successful.
228 + *
229 + * ## OPTIONS
230 + *
231 + * <id>
232 + * : The API client id.
233 + *
234 + * <secret>
235 + * : The API secret key.
236 + *
237 + * ## EXAMPLES
238 + *
239 + * $ wp patchstack activate 123456 2b072e8b60402e30d481df351fc08183906254e0
240 + * Success: The Patchstack plugin has been successfully connected.
241 + */
242 + public function cli_activate( $args ) {
243 + $id = isset( $args[0] ) ? trim( $args[0] ) : '';
244 + $secret = isset( $args[1] ) ? trim( $args[1] ) : '';
245 +
246 + $result = $this->activation->alter_license( $id, $secret, 'activate' );
247 + if ( $result['result'] == 'error' ) {
248 + \WP_CLI::error( 'The Patchstack plugin could not be connected. Make sure the id and secret key are valid and that api.patchstack.com is not blocked.' );
249 + return;
250 + }
251 +
252 + \WP_CLI::success( 'The Patchstack plugin has been successfully connected.' );
222 253 }
223 254
224 255 /**
225 256 * Deactivate the plugin.