2021-10-23 15:27:12 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2022-10-30 02:23:28 +00:00
|
|
|
import argparse
|
2021-10-23 15:24:49 +00:00
|
|
|
import time
|
|
|
|
import logging
|
2022-10-04 22:23:53 +00:00
|
|
|
from Helpers.Device import Device
|
2021-10-23 15:24:49 +00:00
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
format='%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(message)s',
|
|
|
|
datefmt='%Y-%m-%d %I:%M:%S %p',
|
|
|
|
level=logging.DEBUG,
|
|
|
|
)
|
|
|
|
|
2022-10-04 22:23:53 +00:00
|
|
|
def main():
|
2022-10-30 02:23:28 +00:00
|
|
|
parser = argparse.ArgumentParser(description='Android Widevine L3 dumper.')
|
|
|
|
parser.add_argument('--cdm-version', help='The CDM version of the device e.g. \'14.0.0\'', default='14.0.0')
|
|
|
|
parser.add_argument('--function-name', help='The name of the function to hook to retrieve the private key.', default='')
|
2023-07-28 17:56:42 +00:00
|
|
|
parser.add_argument('--module-name',
|
|
|
|
nargs='+',
|
|
|
|
type=str,
|
|
|
|
help='The names of the widevine `.so` modules',
|
|
|
|
default=["libwvaidl.so", "libwvhidl.so"]
|
|
|
|
)
|
2022-10-30 02:23:28 +00:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
dynamic_function_name = args.function_name
|
|
|
|
cdm_version = args.cdm_version
|
2023-07-28 17:56:42 +00:00
|
|
|
module_names = args.module_name
|
2022-10-30 02:23:28 +00:00
|
|
|
|
2022-10-04 22:23:53 +00:00
|
|
|
logger = logging.getLogger("main")
|
2023-07-28 17:56:42 +00:00
|
|
|
device = Device(dynamic_function_name, cdm_version, module_names)
|
2022-10-04 22:23:53 +00:00
|
|
|
logger.info('Connected to %s', device.name)
|
|
|
|
logger.info('Scanning all processes')
|
|
|
|
|
|
|
|
for process in device.usb_device.enumerate_processes():
|
|
|
|
if 'drm' in process.name:
|
|
|
|
for library in device.find_widevine_process(process.name):
|
|
|
|
device.hook_to_process(process.name, library)
|
2023-07-28 17:56:42 +00:00
|
|
|
logger.info('Functions hooked, now open the DRM stream test on Bitmovin from your Android device! https://bitmovin.com/demos/drm')
|
2022-10-04 22:23:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|
|
|
|
while True:
|
|
|
|
time.sleep(1000)
|