fix subprocess codec
This commit is contained in:
parent
da3b1f95d9
commit
80da61e0bb
|
@ -63,7 +63,8 @@ class Cdm:
|
|||
"""
|
||||
# https://source.android.com/docs/core/architecture/configuration/add-system-properties?#shell-commands
|
||||
properties = {}
|
||||
for line in subprocess.getoutput(f'adb -s "{self.device.id}" shell getprop').splitlines():
|
||||
sp = subprocess.run(f'adb -s "{self.device.id}" shell getprop', capture_output=True)
|
||||
for line in sp.stdout.decode('utf-8').splitlines():
|
||||
match = re.match(r'\[(.*?)\]: \[(.*?)\]', line)
|
||||
if match:
|
||||
key, value = match.groups()
|
||||
|
@ -135,7 +136,8 @@ class Cdm:
|
|||
# https://github.com/frida/frida/issues/1225#issuecomment-604181822
|
||||
# Iterate through lines starting from the second line (skipping header)
|
||||
processes = {}
|
||||
for line in subprocess.getoutput(f'adb -s "{self.device.id}" shell ps').splitlines()[1:]:
|
||||
sp = subprocess.run(f'adb -s "{self.device.id}" shell ps', capture_output=True)
|
||||
for line in sp.stdout.decode('utf-8').splitlines()[1:]:
|
||||
try:
|
||||
line = line.split() # USER,PID,PPID,VSZ,RSS,WCHAN,ADDR,S,NAME
|
||||
name = ' '.join(line[8:]).strip()
|
||||
|
|
|
@ -29,8 +29,8 @@ if __name__ == '__main__':
|
|||
logger.info('Version: %s', extractor.__version__)
|
||||
|
||||
# Ensure the ADB server is running
|
||||
exitcode, _ = subprocess.getstatusoutput('adb start-server')
|
||||
if exitcode != 0:
|
||||
sp = subprocess.run('adb start-server', capture_output=True)
|
||||
if sp.returncode != 0:
|
||||
raise EnvironmentError('ADB is not recognized as an environment variable, see https://github.com/hyugogirubato/KeyDive/blob/main/docs/PACKAGE.md#adb-android-debug-bridge')
|
||||
|
||||
# Initialize the CDM handler with the specified or default device
|
||||
|
|
Loading…
Reference in New Issue