Does not handle APKs with spaces in the name properly
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 663
- PR merge metrics
- No merged PRs in 30d
Description
Calling APKTool with following command
b'java -Djava.awt.headless=true -jar c:\\\\program files\\\\python36\\\\lib\\\\site-packages\\\\qark-3.0.0-py3.6.egg\\\\qark\\\\decompiler\\\\..\\\\lib\\\\apktool/apktool.jar d D:\\\\mas\\\\NPTU.apk --no-src --force -m --output D:\\\\mas\\\\build\\\\qark\\\\apktool'
Error: Unable to access jarfile c:\program
It seems that APKTool take
`c:\\\\program files\\\\python36\\\\lib\\\\site-packages\\\\qark-3.0.0-py3.6.egg\\\\qark\\\\decompiler\\\\..\\\\lib\\\\apktool/apktool.jar`
as 2 arguments, since there is a `space` in the "program files"
This will also cause the failure of `move manifest into proper location`, because there is no manifest to move
so I change the decompiler.py at line 29
`APK_TOOL_COMMAND = ("java -Djava.awt.headless=true -jar {apktool_path}/apktool.jar "
"d {path_to_source} --no-src --force -m --output {build_directory}")`
to
`APK_TOOL_COMMAND = ("java -Djava.awt.headless=true -jar '{apktool_path}/apktool.jar' "
"d '{path_to_source}' --no-src --force -m --output '{build_directory}'")`
I just simply add quotes in every path-argument and fix it
Maybe we should add quotes in every command not just APKTool in case there is more `space` in users' path
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with decompiler.py around line 29, where APK_TOOL_COMMAND is assembled, and reproduce the command using an APK or installation path containing spaces. Verify that the APKTool invocation and subsequent manifest handling succeed when paths contain spaces; no specific test file is mentioned in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, python
- Domain
- security, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100