Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #629 #682

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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