Esempio n. 1
0
 /**
  * Check plugins.
  */
 protected function check_installed_plugins()
 {
     $plugins = array_filter(get_plugins(), [$this, 'plugin_filter'], ARRAY_FILTER_USE_KEY);
     foreach ($plugins as $file => $headers) {
         list($slug, $basename) = explode(DIRECTORY_SEPARATOR, $file);
         $response = $this->client->plugins($slug);
         $vulnerabilities = $response->vulnerabilities_by_version($headers['Version']);
         if (empty($vulnerabilities)) {
             continue;
         }
         $this->vulnerabilities = array_merge($this->vulnerabilities, $vulnerabilities);
     }
 }
Esempio n. 2
0
 /**
  * Check a plugin for vulnerabilities.
  *
  * ## OPTIONS
  *
  * <slug>
  * : The plugin slug to check.
  *
  * [<version>]
  * : The plugin version to check.
  * ---
  * default: null
  * ---
  *
  * @subcommand check-plugin
  *
  * @param array $args Positional args.
  */
 public function check_plugin($args)
 {
     $plugin = $args[0];
     $version = isset($args[1]) ? $args[1] : null;
     $client = new Client();
     $response = $client->plugins($plugin);
     $vulnerabilities = $response->vulnerabilities_by_version($version);
     $formatter = new Text();
     $formatter->display_results($vulnerabilities);
 }