diff --git a/extractor/cdm.py b/extractor/cdm.py index 4814156..f5265ca 100644 --- a/extractor/cdm.py +++ b/extractor/cdm.py @@ -71,6 +71,10 @@ class Cdm: """ symbols = {} if path: + # Verify symbols file path + if not path.is_file(): + raise FileNotFoundError('Symbols file not found') + try: # Parse the XML file program = xmltodict.parse(path.read_bytes())['PROGRAM'] diff --git a/keydive.py b/keydive.py index 0b1c63f..af3d7e2 100644 --- a/keydive.py +++ b/keydive.py @@ -1,5 +1,6 @@ import argparse import logging +import subprocess import time import coloredlogs @@ -23,12 +24,13 @@ if __name__ == '__main__': args = parser.parse_args() try: - symbols = args.symbols - if symbols and not symbols.is_file(): - raise FileNotFoundError('Symbols file not found') + # Start ADB server + exitcode, _ = subprocess.getstatusoutput('adb start-server') + if exitcode != 0: + raise EnvironmentError('ADB is not recognized as an environment variable') # Initialize CDM handler with given device - cdm = Cdm(device=args.device, symbols=symbols) + cdm = Cdm(device=args.device, symbols=args.symbols) # Find Widevine process on the device process: Process = next((p for p in cdm.device.enumerate_processes() if cdm.vendor.process == p.name), None)