From 405c1845587f3d63871aa08198db58d0d6abf303 Mon Sep 17 00:00:00 2001 From: hyugogirubato <65763543+hyugogirubato@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:26:54 +0200 Subject: [PATCH] Vendor filtering based on device SDK --- keydive/constants.py | 19 +++++++++---------- keydive/vendor.py | 12 +++++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/keydive/constants.py b/keydive/constants.py index 9efa9a0..42e22ef 100644 --- a/keydive/constants.py +++ b/keydive/constants.py @@ -82,32 +82,31 @@ OEM_CRYPTO_API = { # Add more as needed for different versions. } -# TODO: Add minimum required sdk CDM_VENDOR_API = { 'mediaserver': { - Vendor(11, '1.0', 'libwvdrmengine.so') # 23 + Vendor(23, 11, '1.0', 'libwvdrmengine.so') }, 'mediadrmserver': { - Vendor(11, '1.0', 'libwvdrmengine.so') # 24 + Vendor(24, 11, '1.0', 'libwvdrmengine.so') }, 'android.hardware.drm@1.0-service.widevine': { - Vendor(13, '5.1.0', 'libwvhidl.so') # 26 + Vendor(26, 13, '5.1.0', 'libwvhidl.so') }, 'android.hardware.drm@1.1-service.widevine': { - Vendor(14, '14.0.0', 'libwvhidl.so') # 28 + Vendor(28, 14, '14.0.0', 'libwvhidl.so') }, 'android.hardware.drm@1.2-service.widevine': { - Vendor(15, '15.0.0', 'libwvhidl.so') # 29 + Vendor(29, 15, '15.0.0', 'libwvhidl.so') }, 'android.hardware.drm@1.3-service.widevine': { - Vendor(16, '16.0.0', 'libwvhidl.so') # 30 + Vendor(30, 16, '16.0.0', 'libwvhidl.so') }, 'android.hardware.drm@1.4-service.widevine': { - Vendor(16, '16.1.0', 'libwvhidl.so') # 31 + Vendor(31, 16, '16.1.0', 'libwvhidl.so') }, 'android.hardware.drm-service.widevine': { - Vendor(17, '17.0.0', 'libwvaidl.so'), # 33 - Vendor(18, '18.0.0', 'android.hardware.drm-service.widevine') # 34 + Vendor(33, 17, '17.0.0', 'libwvaidl.so'), + Vendor(34, 18, '18.0.0', 'android.hardware.drm-service.widevine') } } diff --git a/keydive/vendor.py b/keydive/vendor.py index ca7854e..780d017 100644 --- a/keydive/vendor.py +++ b/keydive/vendor.py @@ -1,17 +1,19 @@ class Vendor: """ - Represents a Vendor with OEM, version, and name attributes. + Represents a Vendor with SDK, OEM, version, and name attributes. """ - def __init__(self, oem: int, version: str, name: str): + def __init__(self, sdk: int, oem: int, version: str, name: str): """ Initializes a Vendor instance. Args: - oem (int): The OEM identifier. - version (str): The version of the vendor. - name (str): The name of the vendor. + sdk (int): Minimum SDK version required. + oem (int): OEM identifier. + version (str): Version of the vendor. + name (str): Name of the vendor. """ + self.sdk = sdk self.oem = oem self.version = version self.name = name