pymonalisa
A Python library to decrypt IQIYI DRM License Ticket using the MonaLisa Content Decryption Module.
Installation
pip install pymonalisa
Run pymonalisa --help to view available CLI functions.
Devices
To use pymonalisa, you need a MonaLisa device file (.mld). These device files load the WASM module required to process IQIYI DRM License Tickets correctly.
License Processing
Process a MonaLisa encoded license and extract decryption keys:
pymonalisa license "AAAADgMwAADECisAAAdoS7HZAQEASDVEQ0lELVYzLVAxLTIwMjUwNTE5LTE0NDM1Mi1NRDc0N0RBNS0xNzQ0NjQ0OTk3LUExMTJERwEQcMHbn2aue/wLGYFpS2aNngMCADhAACCzbv21P1LuugXC34EhhYOfBQm1K7vNBcxClOM9nTS50AIQxPPew5UYQhKhOg3UrJqXLQQBAwMDADkBADCvjimPScsXNIyb9HxbzkHRB7Bhv3J8Pvpgm54TFhIKSwH32SedaLf7dJ6PRExsjyoBAQECASADBAA4QAAgIreHYYp2nI86fJDaAxR6CJyvM1h+OKXATIn9aj43O2ADEIDB259mrnv8CxmBaUtmjZ4EAQMEBQATARBwwdufZq57/AsZgWlLZo2eAP8GADQBEIDB259mrnv8CxmBaUtmjZ4AIM11WGlDSqV01Aw8PkaTUEgYPVduGGQpxMTnWbNx7qpP" device.mld
Options
-t, --key-type: Filter keys by type (CONTENT or FULL). Default: FULL-v, --version: Print version information
Usage
An example code snippet:
from pymonalisa.cdm import Cdm
from pymonalisa.module import Module
from pymonalisa.license import License
from pymonalisa.types import KeyType
# Load the MonaLisa device module
module = Module.load("path/to/device.mld")
# Initialize CDM from module
cdm = Cdm.from_module(module)
# Open a new session
session_id = cdm.open()
# Create license object from base64 encoded license data
license_data = "AAAADgMwAADECisAAAdoS7HZAQEASDVEQ0lELVYzLVAxLTIwMjUwNTE5LTE0NDM1Mi1NRDc0N0RBNS0xNzQ0NjQ0OTk3LUExMTJERwEQcMHbn2aue/wLGYFpS2aNngMCADhAACCzbv21P1LuugXC34EhhYOfBQm1K7vNBcxClOM9nTS50AIQxPPew5UYQhKhOg3UrJqXLQQBAwMDADkBADCvjimPScsXNIyb9HxbzkHRB7Bhv3J8Pvpgm54TFhIKSwH32SedaLf7dJ6PRExsjyoBAQECASADBAA4QAAgIreHYYp2nI86fJDaAxR6CJyvM1h+OKXATIn9aj43O2ADEIDB259mrnv8CxmBaUtmjZ4EAQMEBQATARBwwdufZq57/AsZgWlLZo2eAP8GADQBEIDB259mrnv8CxmBaUtmjZ4AIM11WGlDSqV01Aw8PkaTUEgYPVduGGQpxMTnWbNx7qpP"
license_obj = License(license_data)
# Parse the license
cdm.parse_license(session_id, license_obj)
# Get content keys
keys = cdm.get_keys(session_id, KeyType.CONTENT)
# Print extracted keys
for key in keys:
print(f"{key.key.hex()}") # Content key only
# or for full key info:
# print(f"{key.kid.hex()}:{key.key.hex()}")
# Close the session
cdm.close(session_id)
Key Types
CONTENT: Returns only the content decryption KEYFULL: Returns both Key ID and content key in KID:KEY format
Notes
- This implementation is designed specifically for IQIYI DRM content
- The library currently focuses on content key extraction for decrypting IQIYI BBTS streams
- LicenseVersion 3 and below are supported
- Keys are typically returned in hexadecimal format
TODO
- Add support for LicenseVersion up to 3
Credits
Thanks to xhlove and duck.
License
This project is intended for educational and research purposes only.
Metadata
Release files for pymonalisa 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymonalisa-0.1.2.tar.gz | 18.5 kB | Without provenance | Details for pymonalisa-0.1.2.tar.gz |
Release files / pymonalisa-0.1.2.tar.gz
| Download URL | pymonalisa-0.1.2.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff76fe05adebfede07a3c242fe7fce1bd8d121d571def5cca898737eccf28f23
|
|
BLAKE2b-256 checksum How to use checksums |
86539b0c0a8100fdbd0a2e838cbe408c55817334f1a59e85e242f50a765f2bab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Security for pymonalisa 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.