Last active
August 18, 2020 21:06
-
-
Save jaydansand/dcb66a0e36365c178a91 to your computer and use it in GitHub Desktop.
Revisions
-
jaydansand revised this gist
Nov 13, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ Plugin URI: Description: Deliberately introduce some delay into XMLRPC calls to rate limit brute-force and DoS attacks. Version: 1.0 Author: Jay Dansand, Technology Services, Lawrence University Author URI: https://gist.github.com/jaydansand */ /* Copyright 2014 Lawrence University -
jaydansand revised this gist
Jul 29, 2014 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,21 @@ Author URI: */ /* Copyright 2014 Lawrence University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * Implement filters xmlrpc_enabled and xmlrpc_login_error. * -
jaydansand created this gist
Jul 29, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ <?php /* Plugin Name: XMLRPC Slowdown Plugin URI: Description: Deliberately introduce some delay into XMLRPC calls to rate limit brute-force and DoS attacks. Version: 1.0 Author: Jay Dansand Author URI: */ /** * Implement filters xmlrpc_enabled and xmlrpc_login_error. * * @see class-wp-xmlrpc-server.php */ function xmlrpc_slowdown_filter_sleep($arg) { // Keep track of calls (should be 1 or 2) to increase delay // when called after a login failure. static $calls = 0; ++$calls; $rand = function_exists('mt_rand') ? 'mt_rand' : 'rand'; usleep(call_user_func($rand, 500000 * $calls, 2000000 * $calls)); return $arg; } add_filter('xmlrpc_enabled', 'xmlrpc_slowdown_filter_sleep'); add_filter('xmlrpc_login_error', 'xmlrpc_slowdown_filter_sleep');