monkey see monkey do

This commit is contained in:
ksyasuda 2022-03-29 17:45:32 -07:00
parent 1d1dc517f4
commit cee96ec9cc

22
ani-cli
View File

@ -107,30 +107,14 @@ download() {
decrypt_link() { decrypt_link() {
lg "BEGIN: decrypt_link()" > /dev/stderr lg "BEGIN: decrypt_link()" > /dev/stderr
secret_key='3235373136353338353232393338333936313634363632323738383333323838' secret_key='3633393736383832383733353539383139363339393838303830383230393037'
iv='31323835363732393835323338333933' iv='34373730343738393639343138323637'
ajax_url="https://gogoplay4.com/encrypt-ajax.php" ajax_url="https://gogoplay4.com/encrypt-ajax.php"
id=$(printf "%s" "$1" | sed -nE 's/.*id=(.*)&title.*/\1/p') id=$(printf "%s" "$1" | sed -nE 's/.*id=(.*)&title.*/\1/p')
ajax=$(echo $id | openssl enc -e -aes256 -K "$secret_key" -iv "$iv" | base64)
if [ "${#id}" -lt "8" ]; then
#pad the id with character until it length(id) reaches to 8, no xor needed to be done on it
pad=$(printf "\010\016\003\010\t\003\004\t" | cut -c"$((8 - (${#id} % 16)))"-)
new_id=$(printf "%s$pad" "$id")
else
# xor the last character of id with 0xA if length(id) is 8, make it the new last character
lastchar=$(printf %s "$id" | tail -c 1)
lastcharval=$(printf %d "'$lastchar")
xor=$((lastcharval ^ 10))
octalval=$(printf "\\$(printf %o "$xor")")
new_id=$(printf "%s" "$id" | sed "s/.$/$octalval/")
fi
#encrypt and create the final ajax
ajax=$(printf "%s\010\016\003\010\t\003\004\t" "$new_id" | openssl enc -aes256 -K "$secret_key" -iv "$iv" -a)
#send request and get the data(most lamest way)
data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g') data=$(curl -s -H "X-Requested-With:XMLHttpRequest" "$ajax_url" -d "id=$ajax" | sed -e 's/{"data":"//' -e 's/"}/\n/' -e 's/\\//g')
#decrypt the data to get final links
printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' | printf '%s' "$data" | base64 -d | openssl enc -d -aes256 -K "$secret_key" -iv "$iv" | sed -e 's/\].*/\]/' -e 's/\\//g' |
grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*' grep -Eo 'https:\/\/[-a-zA-Z0-9@:%._\+~#=][a-zA-Z0-9][-a-zA-Z0-9@:%_\+.~#?&\/\/=]*'
} }