Skip to main content

pyplayready CDM (Content Decryption Module) implementation in Python.

Project description

pyplayready

All of this is already public. Almost 100% of this code has been derived from the mspr_toolkit.

Installation

pip install pyplayready

Run pyplayready --help to view available cli functions

Devices

Run the command below to create a Playready Device (.prd) from a bgroupcert.dat and zgpriv.dat:

pyplayready create-device -c bgroupcert.dat -k zgpriv.dat

Test a playready device:

pyplayready test DEVICE.prd

Export a provisioned device to its raw .dat files

pyplayready export-device DEVICE.prd

Usage

An example code snippet:

from pyplayready.cdm import Cdm
from pyplayready.device import Device
from pyplayready.system.pssh import PSSH
from pyplayready.misc.revocation_list import RevocationList

import requests

device = Device.load("C:/Path/To/A/Device.prd")
cdm = Cdm.from_device(device)
session_id = cdm.open()

pssh = PSSH(
    "AAADfHBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAA1xcAwAAAQABAFIDPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AH"
    "QAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABh"
    "AHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUg"
    "BPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQA"
    "UgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgA0AFIAcABsAGIAKwBUAGIATgBFAFMAOAB0AE"
    "cAawBOAEYAVwBUAEUASABBAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+AEsATABqADMAUQB6AFEAUAAvAE4AQQA9ADwALwBD"
    "AEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAcgBvAGYAZgBpAGMAaQBhAGwAcwBpAHQAZQAuAGsAZQ"
    "B5AGQAZQBsAGkAdgBlAHIAeQAuAG0AZQBkAGkAYQBzAGUAcgB2AGkAYwBlAHMALgB3AGkAbgBkAG8AdwBzAC4AbgBlAHQALwBQAGwAYQB5AFIA"
    "ZQBhAGQAeQAvADwALwBMAEEAXwBVAFIATAA+ADwAQwBVAFMAVABPAE0AQQBUAFQAUgBJAEIAVQBUAEUAUwA+ADwASQBJAFMAXwBEAFIATQBfAF"
    "YARQBSAFMASQBPAE4APgA4AC4AMQAuADIAMwAwADQALgAzADEAPAAvAEkASQBTAF8ARABSAE0AXwBWAEUAUgBTAEkATwBOAD4APAAvAEMAVQBT"
    "AFQATwBNAEEAVABUAFIASQBCAFUAVABFAFMAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA=="
)

request = cdm.get_license_challenge(session_id, pssh.wrm_headers[0], rev_lists=RevocationList.SupportedListIds)

response = requests.post(
    url="https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:2000)",
    headers={
        'Content-Type': 'text/xml; charset=UTF-8',
    },
    data=request,
)

cdm.parse_license(session_id, response.text)

for key in cdm.get_keys(session_id):
    print(f"{key.key_id.hex}:{key.key.hex()}")

cdm.close(session_id)

Disclaimer

  1. This project requires a valid Microsoft Certificate and Group Key, which are not provided by this project.
  2. Public test provisions are available and provided by Microsoft to use for testing projects such as this one.
  3. This project does not condone piracy or any action against the terms of the DRM systems.
  4. All efforts in this project have been the result of Reverse-Engineering, Publicly available research, and Trial & Error.
  5. Do not use this program to decrypt or access any content for which you do not have the legal rights or explicit permission.
  6. Unauthorized decryption or distribution of copyrighted materials is a violation of applicable laws and intellectual property rights.
  7. This tool must not be used for any illegal activities, including but not limited to piracy, circumventing digital rights management (DRM), or unauthorized access to protected content.
  8. The developers, contributors, and maintainers of this program are not responsible for any misuse or illegal activities performed using this software.
  9. By using this program, you agree to comply with all applicable laws and regulations governing digital rights and copyright protections.

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyplayready-0.8.3.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyplayready-0.8.3-py3-none-any.whl (78.0 kB view details)

Uploaded Python 3

File details

Details for the file pyplayready-0.8.3.tar.gz.

File metadata

  • Download URL: pyplayready-0.8.3.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pyplayready-0.8.3.tar.gz
Algorithm Hash digest
SHA256 a86b6cee37fa502e49e5b6956a0086de677afff82507ed34a4507eac8fa563af
MD5 74f887a3cced2870d18d59133a8a36c5
BLAKE2b-256 997a5c83dd76a3e1cf5158f7cc7a62193a5a329acce3e2a8237cd921ac5c6b31

See more details on using hashes here.

File details

Details for the file pyplayready-0.8.3-py3-none-any.whl.

File metadata

  • Download URL: pyplayready-0.8.3-py3-none-any.whl
  • Upload date:
  • Size: 78.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pyplayready-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 995ea335998cc63890f24959e9ab88cd5ef962a507396f1097badc843bc7be9e
MD5 425600300d467e57e36f23607932f818
BLAKE2b-256 26f08dc65e90a21ec65b52278d1017d7abbff763f536ca168a687a1a60d2deb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page