cyberboysumanjay / JioSaavnAPI

An unofficial API for JioSaavn written in Python 3
https://saavnapi-nine.vercel.app
MIT License
363 stars 182 forks source link

(Question) How did you figured out how to decrypt ecrypted_media_url? #37

Closed Shabinder closed 3 years ago

Shabinder commented 3 years ago

You are using des-ECB like below...

def decrypt_url(url):
    des_cipher = des(b"38346591", ECB, b"\0\0\0\0\0\0\0\0",pad=None, padmode=PAD_PKCS5)
    enc_url = base64.b64decode(url.strip())
    dec_url = des_cipher.decrypt(enc_url, padmode=PAD_PKCS5).decode('utf-8')
    dec_url = dec_url.replace("_96.mp4", "_320.mp4")
    return dec_url

I want to know how did you fingure the type of encryption and decrypted it?

Shabinder commented 3 years ago
  1. Problem with Saavn URL encryption : I think it is pretty obvious that you would not want other people to know about how the URL is decrypted. Unfortunately for Saavn, they messed up. Since they have to decrypt the URLS to be able to play the songs, the URL is therefore decrypted on the client side i.e in the app and on the website. Armed with this knowledge, it is only a matter of analysis to figure out how exactly the decryption occurs. And this is what happened. One Github user figured out the decryption method.

This explained well, if you have more to add , comment , I would love to hear