dwisiswant0 / apkleaks

Scanning APK file for URIs, endpoints & secrets.
Apache License 2.0
4.92k stars 489 forks source link

'C:/Program' is not recognized as an internal or external command, operable program or batch file. #61

Open ItsIgnacioPortal opened 2 years ago

ItsIgnacioPortal commented 2 years ago

Issue exists on Apkleaks v2.6.1, running on Windows 10, with python 3.9.0.

This is probably because of the space in name of the Program Files folder. The error message appears after ** Decompiling APK...

ahopelesshadow commented 2 years ago

Put it in "" ?

ItsIgnacioPortal commented 2 years ago

I didn't make myself clear. I'm trying to scan the APK for Aurora-Droid. Both of these commands:

show the same error.

'C:/Program' is not recognized as an internal or external command, operable program or batch file.

Since the time I encoutered this issue, I've created a little program called "improper-quotes monitor"; What it does is that it keeps a log of the parameters that are passed to C:\Program whenever a program attempts to access a path under C:\Program Files without quotes. Thanks to this, I've been able to detect that some library within python is trying to run:

C:/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

But because it doesn't have quotes in the path, it actually runs C:\Program.exe with 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 as its parameters.

ahopelesshadow commented 2 years ago

Yea i think i understand you but you dont understand me, your typing a path in terminal... you always need to quote it if it has spaces... thats why its trying to run program... because thats the last str before the space.

ItsIgnacioPortal commented 2 years ago

Yea i think i understand you but you dont understand me, your typing a path in terminal... you always need to quote it if it has spaces... thats why its trying to run program... because thats the last str before the space.

I have already tried using quotes. Look at my comment carefully.

Both of these commands:

  • apkleaks -f "C:\Users\REDACTED\Downloads\Aurora.Droid.ver.1.0.8.build.8.apk"
  • apkleaks -f Aurora.Droid.ver.1.0.8.build.8.apk

show the same error.

The full path to the APK doesn't even have spaces. It doesn't need to be quoted. This is not my error. It's an error within apkleaks

By the way, please refrain from using dots (...) in your comments. It makes you seem condescending

ItsIgnacioPortal commented 2 years ago

TL;DR: 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 run C:/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.

I've fixed this and opened a pull request. See: #68