sasuke-duck / wks-key Goto Github PK
View Code? Open in Web Editor NEWThis project forked from huliad2022/wks-key
This project forked from huliad2022/wks-key
You've taken a decision to parse the MPD to get PSSH with option for a manual input on failing to find it. All sensible stuff.
Why not go the extra mile if PSSH isn't found,? Find and create the PSSH from the Default Kid instead. There are Kid to pssh decoders around since forever. Hee is one.
import base64
def createpsshfromkid(kid_value):
kid_value = kid_value.replace('-', '')
assert len(kid_value) == 32 and not isinstance(kid_value, bytes), "wrong KID length"
array_of_bytes = bytearray(b'\x00\x00\x002pssh\x00\x00\x00\x00')
array_of_bytes.extend(bytes.fromhex("edef8ba979d64acea3c827dcd51d21ed"))
array_of_bytes.extend(b'\x00\x00\x00\x12\x12\x10')
array_of_bytes.extend(bytes.fromhex(kid_value.replace("-", "")))
return base64.b64encode(bytes.fromhex(array_of_bytes.hex())).decode('utf-8')
kid = input("Enter the KID:")
print(createpsshfromkid(kid))
I get this error witch certain PSSH. Example:
License URL: https://lic.drmtoday.com/license-proxy-widevine/cenc/
Input MPD URL: https://dash.hoopladigital.com/via_hdnfy207a/Manifest.mpd
Generating PSSH:.....
PSSH: AAAAVHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADQIARIQmrqeB0TpzjSbHIDSSLtrehoIY2FzdGxhYnMiEJq6ngdE6c40mxyA0ki7a3oqAlNE
/home/removed/Downloads/wks-keys_v3/pywidevine/L3/cdm/cdm.py:260: RuntimeWarning: Unexpected end-group tag: Not all data was converted
license.ParseFromString(base64.b64decode(license_b64))
Traceback (most recent call last):
File "./keys.py", line 46, in <module>
correct, keys = WV_Function(pssh, lic_url)
File "./keys.py", line 42, in WV_Function
wvdecrypt.update_license(license_b64)
File "/home/removed/Downloads/wks-keys_v3/pywidevine/L3/decrypt/wvdecryptcustom.py", line 58, in update_license
self.cdm.provide_license(self.session, license_b64)
File "/home/removed/Downloads/wks-keys_v3/pywidevine/L3/cdm/cdm.py", line 275, in provide_license
session.session_key = oaep_cipher.decrypt(license.SessionKey)
File "/home/removed/.local/lib/python3.8/site-packages/Cryptodome/Cipher/PKCS1_OAEP.py", line 167, in decrypt
raise ValueError("Ciphertext with incorrect length.")
ValueError: Ciphertext with incorrect length.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.