] * : Nur dieses Paket pruefen: `wordpress` oder der Ordnername eines Plugins. * * ## EXAMPLES * * wp 360-orbit-security-digest integrity * wp 360-orbit-security-digest integrity --package=akismet * * @when after_wp_load */ public function integrity( $args, $assoc_args ) { $progress = Wp360_Security_Digest_Integrity::start( isset( $assoc_args['package'] ) ? (string) $assoc_args['package'] : '' ); if ( is_wp_error( $progress ) ) { WP_CLI::error( $progress->get_error_message() ); } while ( 'running' === $progress['status'] ) { $progress = Wp360_Security_Digest_Integrity::step(); } $result = Wp360_Security_Digest_Integrity::result(); if ( ! $result ) { WP_CLI::error( __( 'The check could not be continued.', '360-orbit-security-digest' ) ); } $rows = array(); $findings = 0; foreach ( $result['packages'] as $package ) { $count = $package['counts']['modified'] + $package['counts']['missing'] + $package['counts']['unknown'] + $package['counts']['unreadable']; $findings += $count; $rows[] = array( 'package' => $package['slug'], 'version' => $package['version'], 'state' => $package['state'], 'modified' => $package['counts']['modified'], 'missing' => $package['counts']['missing'], 'unknown' => $package['counts']['unknown'], 'note' => $package['reason'], ); foreach ( array( 'modified', 'missing', 'unknown', 'unreadable' ) as $kind ) { foreach ( $package[ $kind ] as $path ) { WP_CLI::log( sprintf( '%s %s/%s', $kind, $package['slug'], $path ) ); } } } WP_CLI\Utils\format_items( 'table', $rows, array( 'package', 'version', 'state', 'modified', 'missing', 'unknown', 'note' ) ); if ( $findings ) { /* translators: %d: number of files with findings */ WP_CLI::warning( sprintf( _n( '%d file with findings.', '%d files with findings.', $findings, '360-orbit-security-digest' ), $findings ) ); return; } WP_CLI::success( __( 'No findings in the packages that could be checked.', '360-orbit-security-digest' ) ); } /** * Gleicht WordPress, Plugins und Themes mit der Schwachstellen-Datenbank * WPVulnerability ab. Je Paket wird hoechstens einmal am Tag gefragt. * * ## EXAMPLES * * wp 360-orbit-security-digest vulnerabilities * * @when after_wp_load */ public function vulnerabilities( $args, $assoc_args ) { do { $result = Wp360_Security_Digest_Vulnerabilities::refresh(); if ( is_wp_error( $result ) ) { WP_CLI::error( $result->get_error_message() ); } } while ( $result['fetched'] > 0 && $result['remaining'] > 0 ); $report = Wp360_Security_Digest_Vulnerabilities::report(); $rows = array(); $total = 0; foreach ( $report['packages'] as $package ) { $count = 0; foreach ( $package['entries'] as $entry ) { $count += (int) $entry['count']; if ( 'core' !== $package['type'] ) { WP_CLI::log( sprintf( '%s %s %s %s', $package['slug'], $package['version'], '' !== $entry['cve'] ? $entry['cve'] : '-', $entry['title'] ) ); } } $total += $count; $rows[] = array( 'package' => $package['slug'], 'type' => $package['type'], 'version' => $package['version'], 'state' => $package['state'], 'entries' => $count, 'note' => $package['reason'], ); } WP_CLI\Utils\format_items( 'table', $rows, array( 'package', 'type', 'version', 'state', 'entries', 'note' ) ); if ( $total ) { /* translators: %d: number of known vulnerabilities */ WP_CLI::warning( sprintf( _n( '%d known vulnerability.', '%d known vulnerabilities.', $total, '360-orbit-security-digest' ), $total ) ); return; } WP_CLI::success( __( 'No known vulnerabilities in the packages that could be checked.', '360-orbit-security-digest' ) ); } }