Last active
April 15, 2018 21:17
-
-
Save notdodo/aa1d1136a32d4e8bac650ede2402c5ed to your computer and use it in GitHub Desktop.
Block an IP (better inside a loop for multiple IPs) in Wordfence plugin
This file contains 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 characters
#/usr/bin/env zsh | |
# | |
echo "Block IP \"${1}\"" | |
echo "=========================================" | |
local domain="www.mymegasite.org" | |
local user_agent="Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0" | |
local nonce="COPY-PASTED-NONCE" | |
local data="IP=${1}&reason=Manual+block+by+administrator&perm=1&action=wordfence_blockIP&nonce=${nonce}" | |
local cookie="COPY-PASTED-COOKIE" | |
curl "${domain}/wp-admin/admin-ajax.php" \ | |
-w "\n\n" \ | |
-H "Host: ${domain}" \ | |
-H "User-Agent: ${user_agent}" \ | |
-H 'Accept: application/json, text/javascript, */*; q=0.01' \ | |
-H "Referer: http://${domain}/wp-admin/admin.php?page=WordfenceBlocking" \ | |
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \ | |
-H "Cookie: ${cookie}" \ | |
--data ${data} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment