-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
Fixes #61, and other improvements. #68
base: master
Are you sure you want to change the base?
Conversation
|
||
#If the path contains a space.. | ||
#This is the case if apkleaks was installed on windows through PyPi, as apkleaks.exe ends up in the path "C:/Program Files/Python39/Lib/site-packages/jadx/bin/jadx.bat" (in this example, under python39) | ||
#On windows, if an executable's path doesn't contain spaces but is it quoted anyway, the command fails. We must only quote the path if it has spaces. | ||
if(self.jadx.__contains__(" ")): | ||
args = ["\"" + self.jadx + "\"", self.file, "-d", self.tempdir] | ||
else: | ||
args = [self.jadx, self.file, "-d", self.tempdir] | ||
|
||
|
||
try: | ||
args.extend(re.split(r"\s|=", self.disarg)) | ||
except Exception: | ||
pass | ||
|
||
#add single quotes to every parameter | ||
comm = "%s" % (" ".join(quote(arg) for arg in args)) | ||
|
||
#jadix.bat doesn't like single quotes. Replace them with double quotes | ||
comm = comm.replace("\'","\"") | ||
|
||
#If the path to jadx contains a space | ||
if(self.jadx.__contains__(" ")): | ||
#eliminate duplicate quotes | ||
comm = comm.replace("\"\"","\"") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this can be reworked cleaner & less typing using pathlib module and apply it to both JADX and APK file paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do realize it's a very sloppy way of doing it. I didn't want to completely refactor the logic you put in place, mostly because I didn't know what issues that could cause down the line. For example, I don't understand what the porpuse of this codeblock is:
try:
args.extend(re.split(r"\s|=", self.disarg))
except Exception:
pass
So I decided to just keep it and instead modify as little as possible to make this work.
You can refactor it if you want, but I'm satisfied with it as it is. decompile() is called a single time during the execution of apkleaks, so performance doesn't really matter
When installing apkleaks from PyPi on Windows, jadx.bat was installed in the path
C:\Program Files\Python39\Lib\site-packages\jadx\bin\jadx.bat
. This caused #61, because apkleaks was trying to runC:/Program Files/Python39/Lib/site-packages/jadx/bin/jadx.bat Aurora.Droid.ver.1.0.8.build.8.apk -d C:\Users\REDACTED\AppData\Local\Temp\apkleaks-t996o3tz
without quoting the jadx.bat path.