31 Commits

Author SHA1 Message Date
rlaphoenix
81fd2649a4 Update Project URLs to devine-dl 2023-11-21 10:13:55 +00:00
rlaphoenix
5087da31a0 Fix test CLI function's PSSH type 2023-11-08 22:42:14 +00:00
rlaphoenix
79cdbc007c Remove Types shortcut from Device, rename to DeviceTypes
This is because a static linter cannot recognize a class variable as a type. If we instead directly reference the enum, it can.
2023-11-08 22:42:14 +00:00
rlaphoenix
c362192c11 Improve and simplify creation of protobuffer objects 2023-11-08 22:27:33 +00:00
rlaphoenix
0e6aa1d5e8 Various typing/linting fixes and improvements 2023-11-08 22:18:12 +00:00
rlaphoenix
dad32e728b Add isort config, run isort across project 2023-09-19 12:05:41 +01:00
rlaphoenix
bfaae20e81 Prevent overwriting files when using create-device 2023-07-07 20:10:08 +01:00
rlaphoenix
728a3e7575 Add ability to specify output filename when using create-device 2023-07-07 20:09:34 +01:00
rlaphoenix
29693bedf6 Ensure output directory exists when using create-device 2023-07-07 19:48:11 +01:00
rlaphoenix
99aef63354 Add export-device command to export WVDs back as files
In reality you wouldn't need this for use with pywidevine, but a lot have asked me for this feature so they can use WVDs in other ways or with other software that does not support WVDs.
2023-02-03 06:53:55 +00:00
rlaphoenix
7436c60d00 Replace all lazy log formatting with logging formatting
DeepSource (PYL-W1203)
2022-09-10 20:35:39 +01:00
rlaphoenix
1d606a9e54 Use Cdm.get_keys in license CLI command 2022-08-06 09:54:14 +01:00
rlaphoenix
27a701aaea Cdm: Rework init_data param to expect PSSH object
A by product of this change is dropped support for providing a PSSH or init data directly in any form, that includes base64.

You must now provide it as a PSSH object, e.g., `cdm.get_license_challenge(session_id, PSSH("AAAAW3Bzc2...CSEQyAA=="))`

The idea behind this is to simplify the amount of places where parsing of PSSH and Init Data to a minimal amount. The codebase is getting quite annoying with the constant jumps and places where it needs to test for base64 strings, hex strings, bytes, and direct parsed PSSH boxes or WidevinePsshData. That's a ridiculous amount of code just to take in a pssh/init data, especially when the full pssh box will eventually be discarded/unused by the Cdm, as it just cares about the init data.

Client code should pass any PSSH value they get into a PSSH object appropriately, and then store it as such, instead of as a string or bytes. This makes it overall more powerful thanks to the ability to also access the underlying PSSH data more easily with this change.

It also helps to increase contrast between a compliant Widevine Cenc Header or PSSH Box, and arbitrary data (e.g., Netflix WidevineExchange's init data) because of how you initialize the PSSH.

It also allows the user to more accurately trace the underlying final parse of the PSSH value, instead of looking at it being pinged between multiple functions.

RemoteCdm now also sends the PSSH/init_data in full box form now, the serve API will be able to handle both scenarios but in edge cases providing the full box may be the difference between a working License Request and not.
2022-08-05 08:26:03 +01:00
rlaphoenix
c969d80931 Cdm: Change construction interface to allow manual creation
This is so you can construct a Cdm object without using `.wvd` files (nor the Device class). It also improves enforcement of some required data from the Device. The underlying Device object is discarded for it's data as it won't be required.

Note that the Client ID and Private Key related variables are now stored as private `__var` variables to further amplify their private nature and to really discourage manual read write. This is not impossible to workaround in Python but further discourages manual read/writes to the variable that could cause serious issues.

The RSA Key is also no longer stored as-is. It is now stored as PSS and PKCS1_OAEP objects, as they will be used like so. This makes it even more annoying to directly read/write the RSA key (but not impossible).
2022-08-04 04:52:26 +01:00
rlaphoenix
6a286a4c23 Remove second serve dependencies check
The second one isnt needed so long as the YAML import is 2nd. Once it tries to import serve it will fail and it's ImportError will get handled.
2022-08-02 01:48:48 +01:00
rlaphoenix
c7ec596031 Update license CLI command for Cdm changes 2022-07-30 04:50:18 +01:00
rlaphoenix
7078759cdf Remove uses of raw from CLI commands and serve 2022-07-30 02:29:20 +01:00
rlaphoenix
d9d8074f73 Extend functionality of migrate cmd to folders of wvds
This is so you can mass migrate devices instead of painfully one by one.
2022-07-29 19:29:39 +01:00
rlaphoenix
f63b94c31d Add ability to serve cdm devices remotely with serve command 2022-07-24 21:48:09 +01:00
rlaphoenix
93cdc7f44e Remove f-string without expression, mute unused variable in Cdm 2022-07-23 16:29:28 +01:00
rlaphoenix
e1532b1451 Fix optional --vmp argument to create-device command 2022-07-22 19:25:08 +01:00
rlaphoenix
b262e115d3 Add ability to use Privacy mode on test command 2022-07-21 17:28:04 +01:00
rlaphoenix
fe21bfe88c Fix migrate cmd's error handling, missing ValueError catching 2022-07-21 16:20:22 +01:00
rlaphoenix
1442c945cc Move Migration Code to Device.migrate()
Also now more effectively migrates using the v1 Structure data.

Also fixes the migration error of possibly leaving behind VMP data. Will warn you if VMP data is already in the Client ID (if its different).
2022-07-21 16:10:42 +01:00
rlaphoenix
7b06a3c053 Add cmd to migrate older .wvd files to v2 2022-07-21 13:58:41 +01:00
rlaphoenix
14126c67b1 Remove doc-string about non-existent name argument 2022-07-21 13:34:12 +01:00
rlaphoenix
5e93d6321d Add cmd to create a new .wvd device file
It even adds VMP data to the Client ID blob directly (instead of storing possibly duplicated). It will warn you if the Client ID already had VMP data there.

The filename is generated from client id information and has a crc32 checksum to help avoid with conflicts.
The output directory is the current working directory. You can set the directory with -o/--output.
2022-07-21 13:32:13 +01:00
rlaphoenix
e9e65e5760 Update license cmd to move license type from Cdm to get_license_challenge() 2022-07-20 21:11:01 +01:00
rlaphoenix
6a9e875e35 Add Test command, uses Bitmovin demo 'Art of Motion' 2022-07-20 14:46:36 +01:00
rlaphoenix
7f4ff5e0f0 Add License command for quick generic licensing 2022-07-20 14:45:28 +01:00
rlaphoenix
2701c7dcd0 Add main CLI function, shows version and homepage 2022-07-20 14:44:20 +01:00