$until ) { WP_CLI::log( sprintf( '%s… — locked until %s', substr( $ip_hash, 0, 12 ), gmdate( 'Y-m-d H:i:s', $until ) ) ); } } $recent = Wp360_Login_Guard_Database::recent_attempts( 10 ); WP_CLI::log( '' ); WP_CLI::log( __( 'Last 10 attempts:', '360-orbit-login-guard' ) ); foreach ( $recent as $attempt ) { WP_CLI::log( sprintf( '%s %-20s %s %s', $attempt->created_at, $attempt->username ?: '–', $attempt->success ? 'OK' : 'FAIL', substr( $attempt->ip_hash, 0, 12 ) . '…' ) ); } } /** * Entsperrt eine IP-Adresse oder ein Konto. * * ## OPTIONS * * * : Die zu entsperrende IP-Adresse (z. B. 203.0.113.5) oder der Benutzername * bzw. die E-Mail-Adresse eines gesperrten Kontos. * * ## EXAMPLES * * wp 360-orbit-login-guard unlock 203.0.113.5 * wp 360-orbit-login-guard unlock admin * * @when after_wp_load */ public function unlock( $args, $assoc_args ) { $target = trim( (string) ( $args[0] ?? '' ) ); if ( '' === $target ) { WP_CLI::error( __( 'Please provide a valid IP address.', '360-orbit-login-guard' ) ); } if ( filter_var( $target, FILTER_VALIDATE_IP ) ) { Wp360_Login_Guard_Guard::unlock( Wp360_Login_Guard_Database::hash_ip( $target ) ); } else { Wp360_Login_Guard_Guard::unlock_username( $target ); } WP_CLI::success( __( 'Unlocked (if it was locked).', '360-orbit-login-guard' ) ); } /** * Uebernimmt die empfohlenen Einstellungen (Schnellstart): Sperre nach 5 * Fehlversuchen, neutrale Fehlermeldungen, Fallen-Feld, XML-RPC aus, * Schutz vor dem Auslesen von Benutzernamen. Erlaubnis- und Sperrliste, * Login-Adresse und Zwei-Faktor bleiben unveraendert. * * ## EXAMPLES * * wp 360-orbit-login-guard quickstart * * @when after_wp_load */ public function quickstart( $args, $assoc_args ) { Wp360_Login_Guard_Settings::apply_quickstart(); WP_CLI::success( __( 'Recommended settings applied.', '360-orbit-login-guard' ) ); } }