Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Seadox committed Jun 1, 2024
1 parent e6db48b commit 8856b96
Showing 1 changed file with 35 additions and 12 deletions.
47 changes: 35 additions & 12 deletions objection/utils/patchers/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import delegator
import requests
import semver
import subprocess

from .base import BasePlatformGadget, BasePlatformPatcher, objection_path
from .github import Github
Expand Down Expand Up @@ -304,18 +305,40 @@ def _get_appt_output(self):
"""

if not self.aapt:
o = delegator.run(self.list2cmdline([
self.required_commands['aapt']['location'],
'dump',
'badging',
self.apk_source
]), timeout=self.command_run_timeout)

if len(o.err) > 0:
click.secho('An error may have occurred while running aapt.', fg='red')
click.secho(o.err, fg='red')

self.aapt = o.out
cmd = self.list2cmdline([
self.required_commands['aapt']['location'],
'dump',
'badging',
self.apk_source
])

try:
o = delegator.run(cmd, timeout=self.command_run_timeout)

if len(o.err) > 0:
click.secho('An error may have occurred while running aapt.', fg='red')
click.secho(o.err, fg='red')

self.aapt = o.out

except ValueError:
result = subprocess.run(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=self.command_run_timeout,
shell=True,
encoding='utf-8'
)

self.aapt = result.stdout
error_output = result.stderr

if result.returncode != 0:
click.secho('An error may have occurred while running aapt.', fg='red')
click.secho(error_output, fg='red')



return self.aapt

Expand Down

0 comments on commit 8856b96

Please sign in to comment.