Closed studiofruits closed 11 months ago
Hi, when you use Docker you cannot directly access the files on your system from a running container. You have to mount the file/directory to be able to access it from the container, using the -v
parameter. In your case, the command should be docker run -v "D:\app files\ObfuscatorMIT\Obfuscapk\src\":"/workdir" obfuscapk -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature "original.apk"
(not sure if this will work in Windows, I don't use Docker on this platform).
Hi Gabriel, thank you for getting back to me. I ran the command in cmd (running in admin) from the directory "D:\app files\ObfuscatorMIT\Obfuscapk\src" and get the error:
docker run -v "D:\app files\ObfuscatorMIT\Obfuscapk\src\":"/workdir" obfuscapk -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature "original.apk" "docker run" requires at least 1 argument. See 'docker run --help'.
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container
I also tried: docker run -v "D:\app files\ObfuscatorMIT\Obfuscapk\src\Dockerfile":"/workdir" obfuscapk -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature "original.apk"
but got this error:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: rootfs_linux.go:60: mounting "/run/desktop/mnt/host/d/app files/ObfuscatorMIT/Obfuscapk/src/Dockerfile" to rootfs at "/var/lib/docker/overlay2/d0d522f187719f8034d3eee784dee3dc9f524e62e93eb0ca0e425be41e0741c3/merged/workdir" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
Please forgive my complete lack of competence with Docker :(
I'm sorry but I never used Docker on Windows, so I can't help with this. You can also try using it without Docker (it works directly on Windows if you install all the needed tools).
Thanks anyway Gabriel. Hopefully someone has managed to execute this successfully using Windows. I also tried to install Python on Window and execute Obfuscapk. However, I still encountered errors.
I ran the following commands in the main directory of the project (Obfuscapk/) to install the needed dependencies: python -m venv .
then CD into "D:\app files\ObfuscatorMIT\Obfuscapk\Scripts>" directory. And execute D:\app files\ObfuscatorMIT\Obfuscapk\Scripts>python -m pip install -r "D:\app files\ObfuscatorMIT\Obfuscapk\src\requirements.txt"
Then I executed: D:\app files\ObfuscatorMIT\Obfuscapk\src>python -m obfuscapk.cli --help
and got the following error:
Traceback (most recent call last):
File "C:\Users\jonlg\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\jonlg\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\app files\ObfuscatorMIT\Obfuscapk\src\obfuscapk\cli.py", line 188, in
If anyone has ran this successfully on Windows please reply :)
Hi @studiofruits, regarding the issue with Docker, your command should include the Docker image (see https://stackoverflow.com/questions/56308424/docker-container-run-requires-at-least-1-argument).
Instead, regarding the runtime error raised with python, do you have add the path of apktool, apksigner, and zipalign (i.e., APKTOOL_PATH, APKSIGNER_PATH and ZIPALIGN_PATH)?
Hi @Dado1513 , I am still not sure what the command should be, I have seen that stackoverflow question before, but I still couldn't get it working :(
I am using Python in Windows and I had to install apktool from here: APKTOOL
then python complains regarding "apksigner" not found so I added the build tools 30.0.3 to my path: In my case I am using version 30.0.3: "C:\Users\edgar\AppData\Local\Android\Sdk\build-tools\30.0.3"
Finally I ran the command:
python -m obfuscapk.cli -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature "C:\Users\edgar\AndroidStudioProjects\Test\app\release\app-release.apk" -p
It ran flawlessly
I hope this works for you @studiofruits
@studiofruits docker run -v "D:\app files\ObfuscatorMIT\Obfuscapk\src:/workdir" obfuscapk -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature "original.apk", i.e. remove the "" in path, this works for me :)
Hi Gabriel, I installed Docker successfully, pulled the project, installed it and tested to see if everything was installed correctly using the following cmd: docker run --rm -it obfuscapk --help . I also copied the latest versions of apktool.jar, apksigner.jar and zipalign.exe into Obfuscapk/src/ directory, I am not sure if this was necessary(?)
Anyway, every time I run a command on my apk (original.apk), I get the error below. The error says - "Unable to find application file "D:\app files\ObfuscatorMIT\Obfuscapk\src\original.apk"", however the file does certainly exist:
D:\app files\ObfuscatorMIT\Obfuscapk\src>docker run obfuscapk -o RandomManifest -o Rebuild -o NewAlignment -o NewSignature "D:\app files\ObfuscatorMIT\Obfuscapk\src\original.apk"
14/05/2021 22:29:48> [CRITICAL][obfuscapk.main][perform_obfuscation()] Unable to find application file "D:\app files\ObfuscatorMIT\Obfuscapk\src\original.apk" Traceback (most recent call last): File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Obfuscapk/obfuscapk/cli.py", line 188, in
main()
File "/Obfuscapk/obfuscapk/cli.py", line 170, in main
perform_obfuscation(
File "/Obfuscapk/obfuscapk/main.py", line 98, in perform_obfuscation
raise FileNotFoundError(
FileNotFoundError: Unable to find application file "D:\app files\ObfuscatorMIT\Obfuscapk\src\original.apk"
Please help? Am I missing something I am desperate to use this.
thank you James