pyplayready


Namepyplayready JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/ready-dl/pyplayready
Summarypyplayready CDM (Content Decryption Module) implementation in Python.
upload_time2025-01-04 18:22:41
maintainerNone
docs_urlNone
authorDevLARLEY, Erevoc
requires_python<4.0,>=3.8
licenseCC BY-NC-ND 4.0
keywords python drm playready microsoft
VCS
bugtrack_url
requirements requests pycryptodome ecpy construct click PyYAML aiohttp xmltodict
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyplayready
All of this is already public. 100% of this code has been derived from the mspr_toolkit.

## Installation
```shell
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`:
```shell
pyplayready create-device -c bgroupcert.dat -k zgpriv.dat
```

Test a playready device:
```shell
pyplayready test DEVICE.prd
```

> [!IMPORTANT]  
> There currently isn't a proper method of extracting Group Certificates/Keys. They can be found inside older Samsung phones/Smart TVs, Windows DLLs and set-top-boxes in encrypted form.

Export a provisioned device to its raw .dat files
```shell
pyplayready export-device DEVICE.prd
```

## Usage
An example code snippet:

```python
from pyplayready.cdm import Cdm
from pyplayready.device import Device
from pyplayready.system.pssh import PSSH

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=="
)

wrm_headers = pssh.get_wrm_headers()
request = cdm.get_license_challenge(session_id, wrm_headers[0])

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
+ [mspr_toolkit](https://security-explorations.com/materials/mspr_toolkit.zip)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ready-dl/pyplayready",
    "name": "pyplayready",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "python, drm, playready, microsoft",
    "author": "DevLARLEY, Erevoc",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/5a/39/c90e5e279b46360840f59dbf9988355d86324ed4bfc375d72fae903c59d8/pyplayready-0.5.0.tar.gz",
    "platform": null,
    "description": "# pyplayready\nAll of this is already public. 100% of this code has been derived from the mspr_toolkit.\n\n## Installation\n```shell\npip install pyplayready\n```\n\nRun `pyplayready --help` to view available cli functions\n\n## Devices\nRun the command below to create a Playready Device (.prd) from a `bgroupcert.dat` and `zgpriv.dat`:\n```shell\npyplayready create-device -c bgroupcert.dat -k zgpriv.dat\n```\n\nTest a playready device:\n```shell\npyplayready test DEVICE.prd\n```\n\n> [!IMPORTANT]  \n> There currently isn't a proper method of extracting Group Certificates/Keys. They can be found inside older Samsung phones/Smart TVs, Windows DLLs and set-top-boxes in encrypted form.\n\nExport a provisioned device to its raw .dat files\n```shell\npyplayready export-device DEVICE.prd\n```\n\n## Usage\nAn example code snippet:\n\n```python\nfrom pyplayready.cdm import Cdm\nfrom pyplayready.device import Device\nfrom pyplayready.system.pssh import PSSH\n\nimport requests\n\ndevice = Device.load(\"C:/Path/To/A/Device.prd\")\ncdm = Cdm.from_device(device)\nsession_id = cdm.open()\n\npssh = PSSH(\n    \"AAADfHBzc2gAAAAAmgTweZhAQoarkuZb4IhflQAAA1xcAwAAAQABAFIDPABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AH\"\n    \"QAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABh\"\n    \"AHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUg\"\n    \"BPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQA\"\n    \"UgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgA0AFIAcABsAGIAKwBUAGIATgBFAFMAOAB0AE\"\n    \"cAawBOAEYAVwBUAEUASABBAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+AEsATABqADMAUQB6AFEAUAAvAE4AQQA9ADwALwBD\"\n    \"AEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcABzADoALwAvAHAAcgBvAGYAZgBpAGMAaQBhAGwAcwBpAHQAZQAuAGsAZQ\"\n    \"B5AGQAZQBsAGkAdgBlAHIAeQAuAG0AZQBkAGkAYQBzAGUAcgB2AGkAYwBlAHMALgB3AGkAbgBkAG8AdwBzAC4AbgBlAHQALwBQAGwAYQB5AFIA\"\n    \"ZQBhAGQAeQAvADwALwBMAEEAXwBVAFIATAA+ADwAQwBVAFMAVABPAE0AQQBUAFQAUgBJAEIAVQBUAEUAUwA+ADwASQBJAFMAXwBEAFIATQBfAF\"\n    \"YARQBSAFMASQBPAE4APgA4AC4AMQAuADIAMwAwADQALgAzADEAPAAvAEkASQBTAF8ARABSAE0AXwBWAEUAUgBTAEkATwBOAD4APAAvAEMAVQBT\"\n    \"AFQATwBNAEEAVABUAFIASQBCAFUAVABFAFMAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==\"\n)\n\nwrm_headers = pssh.get_wrm_headers()\nrequest = cdm.get_license_challenge(session_id, wrm_headers[0])\n\nresponse = requests.post(\n    url=\"https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(persist:false,sl:2000)\",\n    headers={\n        'Content-Type': 'text/xml; charset=UTF-8',\n    },\n    data=request,\n)\n\ncdm.parse_license(session_id, response.text)\n\nfor key in cdm.get_keys(session_id):\n    print(f\"{key.key_id.hex}:{key.key.hex()}\")\n\ncdm.close(session_id)\n```\n\n## Disclaimer\n\n1. This project requires a valid Microsoft Certificate and Group Key, which are not provided by this project.\n2. Public test provisions are available and provided by Microsoft to use for testing projects such as this one.\n3. This project does not condone piracy or any action against the terms of the DRM systems.\n4. All efforts in this project have been the result of Reverse-Engineering, Publicly available research, and Trial & Error.\n5. Do not use this program to decrypt or access any content for which you do not have the legal rights or explicit permission.\n6. Unauthorized decryption or distribution of copyrighted materials is a violation of applicable laws and intellectual property rights.\n7. 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.\n8. The developers, contributors, and maintainers of this program are not responsible for any misuse or illegal activities performed using this software.\n9. By using this program, you agree to comply with all applicable laws and regulations governing digital rights and copyright protections.\n\n## Credits\n+ [mspr_toolkit](https://security-explorations.com/materials/mspr_toolkit.zip)\n\n",
    "bugtrack_url": null,
    "license": "CC BY-NC-ND 4.0",
    "summary": "pyplayready CDM (Content Decryption Module) implementation in Python.",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/ready-dl/pyplayready",
        "Issues": "https://github.com/ready-dl/pyplayready/issues",
        "Repository": "https://github.com/ready-dl/pyplayready"
    },
    "split_keywords": [
        "python",
        " drm",
        " playready",
        " microsoft"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f46b68074000f2f3d759c53c58e4240b7423a27dd88302cc918ee3e9f0778f4",
                "md5": "89d31e2e64ba9ce954925f3c245e42b7",
                "sha256": "bd619953db071c5b6ecacb760bfeb99255513c8482e90d2bb6322107025d6b7a"
            },
            "downloads": -1,
            "filename": "pyplayready-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "89d31e2e64ba9ce954925f3c245e42b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 77989,
            "upload_time": "2025-01-04T18:22:39",
            "upload_time_iso_8601": "2025-01-04T18:22:39.404879Z",
            "url": "https://files.pythonhosted.org/packages/8f/46/b68074000f2f3d759c53c58e4240b7423a27dd88302cc918ee3e9f0778f4/pyplayready-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a39c90e5e279b46360840f59dbf9988355d86324ed4bfc375d72fae903c59d8",
                "md5": "a37b9c5f135814365a83eacecbbdec8d",
                "sha256": "93ff8b17ebee1b406a1d91708fdc4c0b7a12d5847773e7ae818b695dd099c527"
            },
            "downloads": -1,
            "filename": "pyplayready-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a37b9c5f135814365a83eacecbbdec8d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 62538,
            "upload_time": "2025-01-04T18:22:41",
            "upload_time_iso_8601": "2025-01-04T18:22:41.303803Z",
            "url": "https://files.pythonhosted.org/packages/5a/39/c90e5e279b46360840f59dbf9988355d86324ed4bfc375d72fae903c59d8/pyplayready-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-04 18:22:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ready-dl",
    "github_project": "pyplayready",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "pycryptodome",
            "specs": []
        },
        {
            "name": "ecpy",
            "specs": []
        },
        {
            "name": "construct",
            "specs": [
                [
                    "==",
                    "2.8.8"
                ]
            ]
        },
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "PyYAML",
            "specs": []
        },
        {
            "name": "aiohttp",
            "specs": []
        },
        {
            "name": "xmltodict",
            "specs": []
        }
    ],
    "lcname": "pyplayready"
}
        
Elapsed time: 1.31445s