refactor(commands): run the prd and wvd dump commands through the upstream pyplayready and pywidevine CLIs

This commit is contained in:
imSp4rky
2026-11-29 12:03:52 -07:00
parent 9eba810481
commit 975d3a106d
6 changed files with 265 additions and 253 deletions
+18 -6
View File
@@ -494,7 +494,7 @@ unshackle wvd COMMAND [ARGS]...
| `wvd add PATHS...` | Validate and move one or more `.wvd` files into the WVDs directory. |
| `wvd delete NAMES...` | Delete `.wvd` files by name (without extension). Prompts for confirmation. |
| `wvd parse PATH` | Parse a `.wvd` and print its System ID, security level, type, flags, and client info. Relative paths resolve against the WVDs directory. |
| `wvd dump WVD_PATHS... OUT_DIR` | Extract a device's contents (metadata, private key, client ID, VMP) into `OUT_DIR/<name>/`. With no paths, dumps every WVD in the WVDs directory. |
| `wvd dump WVD_PATHS... OUT_DIR` | Extract a device's contents (metadata, private key, client ID, VMP) into `OUT_DIR/<name>/`. With no paths, dumps every WVD in the WVDs directory. `dump` skips a device whose `OUT_DIR/<name>/` folder is not empty. |
| `wvd new NAME PRIVATE_KEY CLIENT_ID [FILE_HASHES]` | Create a new `.wvd` from a PEM private key and a `ClientIdentification` blob, optionally with a VMP (`FileHashes`) blob. |
`wvd new` options:
@@ -517,7 +517,7 @@ unshackle wvd COMMAND [ARGS]...
## `prd`
Manage PlayReady Device (`.prd`) files. Devices live in the configured PRDs directory. Built on `pyplayready`.
Manage PlayReady Device (`.prd`) files. Devices live in the configured PRDs directory. Each command runs the matching `pyplayready` command.
```
unshackle prd COMMAND [ARGS]...
@@ -525,19 +525,19 @@ unshackle prd COMMAND [ARGS]...
### `prd new PATHS...`
Make a new `.prd`. Give either a single folder that contains `zgpriv.dat` (group key) and `bgroupcert.dat` (group certificate), or two file paths (group key, then group certificate).
Make a new `.prd`. Give either a single folder that contains `zgpriv.dat` (group key) and `bgroupcert.dat` (group certificate), or two file paths (group key, then group certificate). `prd new` refuses a certificate chain that has a device certificate already or that has expired.
| Option | Description |
|---|---|
| `-e`, `--encryption_key` | Optional device ECC private encryption key (generated if omitted). |
| `-s`, `--signing_key` | Optional device ECC private signing key (generated if omitted). |
| `-o`, `--output` | Output directory or `.prd` file path. |
| `-o`, `--output` | Output directory or `.prd` file path. The default is the folder that you give, else the PRDs directory. |
`prd new` will not overwrite an existing file.
`prd new` does not overwrite an existing file.
### `prd reprovision PRD_PATH`
Reprovision an existing device by replacing its leaf certificate and keys. Only a device of version 3 or higher can do reprovisioning. Accepts the same `-e` / `-s` / `-o` options. By default it overwrites the device in place.
Reprovision an existing device by replacing its leaf certificate and keys. Only a provisioned device of version 3 or higher can do reprovisioning. Accepts the same `-e` / `-s` / `-o` options. By default it overwrites the device in place.
### `prd test DEVICE`
@@ -548,12 +548,24 @@ Do a test of a device against the Microsoft PlayReady demo server and print the
| `-c`, `--ckt` | `aesctr` | Content key encryption type: `aesctr` or `aescbc`. |
| `-sl`, `--security-level` | `2000` | Minimum security level: `150`, `2000`, or `3000`. |
If the server refuses the licence, `prd test` logs the server reply and exits with code 0.
### `prd export PRD_PATH`
Write the group key (`zgpriv.dat`) and the group certificate (`bgroupcert.dat`) of a device into `OUT_DIR/<name>/`. `-o` sets `OUT_DIR`; the default is the current directory. A version 2 device has no group key, so `export` writes only the certificate. If the folder is not empty, `export` writes nothing.
### `prd inspect`
Show each certificate of a certificate chain: type, security level, expiry date, name, features and keys. Give `-d` with a `.prd` file, or `-c` with a chain file such as `bgroupcert.dat`.
!!! example
```shell
unshackle prd new ./device_folder/
unshackle prd new zgpriv.dat bgroupcert.dat -o /out/dir
unshackle prd reprovision mydevice.prd
unshackle prd test mydevice.prd -sl 3000 -c aescbc
unshackle prd export mydevice.prd -o ./out_dir
unshackle prd inspect -d mydevice.prd
```
---
+14 -2
View File
@@ -143,6 +143,7 @@ The `wvd` command group manages `.wvd` files.
`delete` removes a device (with a confirmation prompt). `dump` extracts a
device's contents (metadata, private key, Client ID, VMP) into a folder.
`dump` does not write into a device folder that is not empty.
!!! warning "v1 WVD files must be migrated"
If loading a device fails with a message about a "v1 WVD file", it was made with
@@ -169,8 +170,8 @@ The `prd` command group creates and maintains `.prd` files.
$ unshackle prd new ./device_folder/
```
unshackle makes a fresh leaf certificate and writes the device to the PRDs
directory (or to `-o/--output`). Use `-e/--encryption_key` and `-s/--signing_key`
unshackle makes a fresh leaf certificate. The device goes into the folder that
you give, or into the PRDs directory when you give two files, or to `-o/--output`. Use `-e/--encryption_key` and `-s/--signing_key`
to supply your own ECC keys instead of generating them.
=== "Reprovision"
@@ -194,6 +195,17 @@ The `prd` command group creates and maintains `.prd` files.
`-sl/--security-level` accepts `150`, `2000`, or `3000` (default `2000`).
`-c/--ckt` accepts `aesctr` or `aescbc`.
=== "Export / inspect"
```console
$ unshackle prd export ./data/PRDs/mydevice.prd -o ./out
$ unshackle prd inspect -d ./data/PRDs/mydevice.prd
```
`export` writes the group key and group certificate of a device into a folder.
`inspect` shows each certificate in the chain of a device (`-d`) or of a chain
file (`-c`).
## Selecting which device to use: the `cdm` config
A device on disk is not enough. You must tell unshackle which device to use