medvm / widevine_keys

This repo created for bypassing Widevine L3 DRM and obtaining keys.
450 stars 186 forks source link

Add [Polsatgo] support #59

Closed NiesmialyGosc closed 2 years ago

NiesmialyGosc commented 2 years ago

Hi team,

I can't seem to download any encrypted videos from PolsatGo, could you kindly help look into this and guide me on how to obtain the correct keys (I do have the key to the following individual video now, as someone has figured out the key for me, but that guy refuses to share the code/script for key extraction while I'm asking for help on a general way of extracting keys for virtually ALL the videos on PolsatGo..)? Below is the video info + the runtime error I've run into.

Video link MPD: https://ipla-e1-81.pluscdn.pl/p/vm2dash/08/0897136437d81253076a60933e6b933847c60e2e/manifest.mpd License URL: https://b2c-www.redefine.pl/rpc/drm/ PSSH: AAAATXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAC0IARIQJMAV1i4HIe2g+gAAAKiiCRoNY3lmcm93eXBvbHNhdCIIzyUIAAAAAAA= Header generated on curlconverter:

import requests

headers = { 'Connection': 'keep-alive', 'Accept': '/', 'Access-Control-Request-Method': 'POST', 'Access-Control-Request-Headers': 'content-type', 'Origin': 'https://polsatgo.pl', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Site': 'cross-site', 'Sec-Fetch-Dest': 'empty', 'Referer': 'https://polsatgo.pl/', 'Accept-Language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,zh-CN;q=0.6,zh;q=0.5', }

response = requests.options('https://b2c-www.redefine.pl/rpc/drm/', headers=headers)

Please refer to the following error that I've encountered, and give some tips on how to resolve this? I'm not sure how to attach screenshots, and if you need screenshots please let me know how to do that? That'll be much appreciated.

Many thanks in advance! Nies


> C:\Users\DELL\video\Bento4-SDK-1-6-0-639.x86_64-microsoft-win32\widevine_keys-main>py l3.py
> 
> Input MPD URL: https://ipla-e1-81.pluscdn.pl/p/vm2dash/08/0897136437d81253076a60933e6b933847c60e2e/manifest.mpd
> License URL: https://b2c-www.redefine.pl/rpc/drm/
> Unable to find PSSH in mpd. Edit getPSSH.py or enter PSSH manually: AAAATXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAC0IARIQJMAV1i4HIe2g+gAAAKiiCRoNY3lmcm93eXBvbHNhdCIIzyUIAAAAAAA=
> 
> PSSH obtained.
> AAAATXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAC0IARIQJMAV1i4HIe2g+gAAAKiiCRoNY3lmcm93eXBvbHNhdCIIzyUIAAAAAAA=
> 
> license response status: <Response [200]>
> server reports: {"error":{"code":-32600,"message":"Invalid Request"},"id":null,"jsonrpc":"2.0"}
> server did not issue license, make sure you have correctly pasted all the required headers in the headers.py. Also check json/raw params of POST request.
> 
NiesmialyGosc commented 2 years ago

Team,

I've added the following header info in the json table

responses.append(requests.post(url=lic_url, headers=headers.headers, params=params, 
        json={
        "jsonrpc":"2.0",
        "id":1,
        "method":"getWidevineLicense",
        "params":{
            "userAgentData":{"deviceType":"pc","application":"chrome","os":"windows","build":2162101,"portal":"pg","player":"html","widevine":True},
            "cpid":1,
            "mediaId":"70e5d8dd4a2eeddbab30e5c0c8fa088f",
            "sourceId":"2430a0aa0a404775044f0262788b1603",
            "keyId":"24c015d6-2e07-21ed-a0fa-000000a8a209",
            "object":"CAQ': '",
            "deviceId":{"type":"other","value":"1325adbde3576d43001a7ee92642145e_"},
            "ua":"pg_pc_windows_chrome_html/2162101",
            "authData":{"sessionToken":"df2bf095-731b-4a49-b97d-36ff2806b329|1646103901|drm|getWidevineLicense|F9NjViqSPY4N5FoVdR69pwlTjw8447KlleosnbpRoNk="},
            "clientId":"d5efb74e-37dc-4378-90cb-a9582c14fc3d",
            #"payload":str(request, "utf-8")
        }
        }
))

but it still gives me the following error: Ciphertext

Can you please help here.. I've heard that the key needs to be hmac'ed before being sent over to the license server.. How can that be achieved? Can we use this script as a template to fix the error? I'm not a professional Pythoner and have limited knowledge so I can't figure out how to modify the l3.py or even the underlying PKCS1_OAEP.py script. Help please!!

Thank you Nies

medvm commented 2 years ago

> license response status: <Response [200]> > server reports: {"error":{"code":-32600,"message":"Invalid Request"},"id":null,"jsonrpc":"2.0"}

So, do you have your own CDMs that have never been leaked? Looks like this is the problem.