263 header( 'Content-Type: text/html' );
264 header( 'Content-Length: 0' );
265 }
266
267 private function fake_wplogin() {
268
269 $server_name = isset( $_SERVER['SERVER_NAME'] )
270 ? $_SERVER['SERVER_NAME']
271 : $_SERVER['HTTP_HOST'];
272 $username = trim( $_POST['log'] );
273 $expire = time() + 3600;
274 $token = substr( hash_hmac( 'sha256', (string) rand(), 'token' ), 0, 43 );
275 $hash = hash_hmac( 'sha256', (string) rand(), 'hash' );
276 $auth_cookie = $username . '|' . $expire . '|' . $token . '|' . $hash;
277 $authcookie_name = 'wordpress_' . md5( 'authcookie' );
278 $loggedincookie_name = 'wordpress_logged_in_' . md5( 'cookiehash' );
279
280 header( 'Cache-Control: max-age=0, private, no-store, no-cache, must-revalidate' );
281 header( 'X-Robots-Tag: noindex, nofollow' );
282 setcookie( $authcookie_name, $auth_cookie, $expire, '/brake/wp_content/plugins', '', false, true );
283 setcookie( $authcookie_name, $auth_cookie, $expire, '/brake/wp-admin', '', false, true );
284 setcookie( $loggedincookie_name, $auth_cookie, $expire, '/', '', false, true );
285 header( 'Location: ' . home_url( '/brake/wp-admin/' ) );
|
186
187 // Trigger Miniban at first
188 if ( class_exists( '\Miniban' ) ) {
189 if ( true !== \Miniban::ban() ) {
190 $this->enhanced_error_log( 'Miniban operation failed.' );
191 }
192 }
193
194 $this->trigger( $slug, $message, $level, $this->prefix_instant );
195
196 // Remove session
197 remove_action( 'wp_logout', array( $this, 'logout' ) );
198 wp_logout();
199
200 // Respond
201 ob_get_level() && ob_end_clean();
202 if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
203 $this->fake_xmlrpc();
204 } elseif ( ! headers_sent() ) {
205 if ( 'wp-login.php' === $GLOBALS['pagenow'] && ! empty( $_POST['log'] ) ) {
206 $this->fake_wplogin();
207 } else {
208 $this->ban();
|
496 print '<script type="text/javascript">setTimeout(function(){
497 try{document.getElementById("wp-submit").setAttribute("disabled", "disabled");}
498 catch(e){}}, 0);</script>';
499 }
500
501 public function login_failed( $username ) {
502
503 $this->trigger( 'wpf2b_auth_failed', $username );
504 }
505
506 /**
507 * Ban blacklisted usernames and authentication through XML-RPC.
508 */
509 public function before_login( $user, $username ) {
510
511 if ( in_array( strtolower( $username ), $this->names2ban, true ) ) {
512 $this->trigger_instant( 'wpf2b_banned_username', $username );
513 }
514
515 if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
516 $this->trigger_instant( 'wpf2b_xmlrpc_login', $username );
517 }
518
|