Skip to content

Conversation

@c0dist
Copy link
Member

@c0dist c0dist commented Apr 11, 2017

No description provided.

@anantshri
Copy link
Member

one bug identified.

$pwd
/home/android/
$apk2java /home/android/Desktop/TRY\ ME/crackme-three.apk ./"TEST ME"

expectation: a folder @ "/home/android/TEST ME"
but "/home/android/Desktop/TRY\ ME/TEST ME" is created
so spaces are handled nicely which is the core issue with #5
but the CWD somewhere is lost in relative paths.

May be using realpath could be a solution


if [[ $# -eq 2 ]]
then
if [[ "$2" != /* ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where we need to see if the $2 is relative or full path and then append the full path. may be realpath or grealpath (in case of mac) in this case would be helpful.

@c0dist
Copy link
Member Author

c0dist commented Apr 12, 2017

@anantshri I have (hopefully) fixed the bug mentioned here. For testing, I mimicked following scenarios:

Either the source or destination could be in current path, an absolute path or a relative path. Below are the situations and output:

Note: For the tests, assume working directory as: /home/android/Desktop/apk2java

  1. APK in absolute path — Destination is current
$ ./apk2java /tmp/com.domobile.applockwatcher.apk
APK_DIR_PATH: /tmp
Source dir: /home/android/Desktop/apk2java/com.domobile.applockwatcher.apk_src/
  1. APK in absolute path — Destination is relative
$ ./apk2java /tmp/com.domobile.applockwatcher.apk "./test"
APK_DIR_PATH: /tmp
Source dir: /home/android/Desktop/apk2java/./test/com.domobile.applockwatcher.apk_src/
  1. APK is in absolute path — Destination is absolute path:
$ apk2java /tmp/com.domobile.applockwatcher.apk /tmp/testcase/
APK_DIR_PATH: /tmp
Source dir: /tmp/testcase//com.domobile.applockwatcher.apk_src/
  1. APK path is relative — Destination is absolute
$ apk2java ../apks/com.domobile.applockwatcher.apk /tmp/testcase/
APK_DIR_PATH: /home/android/Desktop/apks
Source dir: /tmp/testcase//com.domobile.applockwatcher.apk_src/
  1. APK path is relative — Destination is relative
$ apk2java ../apks/com.domobile.applockwatcher.apk ../../Desktop
APK_DIR_PATH: /home/android/Desktop/apks
Source dir: /home/android/Desktop/apk2java/../../Desktop/com.domobile.applockwatcher.apk_src/
  1. APK path is relative — Destination is current/no dest
$ apk2java ../apks/com.domobile.applockwatcher.apk
APK_DIR_PATH: /home/android/Desktop/apks
Source dir: /home/android/Desktop/apk2java/com.domobile.applockwatcher.apk_src/
  1. APK is in current dir — Destination is absolute
$ apk2java com.domobile.applockwatcher.apk /tmp/testcase/
APK_DIR_PATH: /home/android/Desktop/apk2java
Source dir: /tmp/testcase//com.domobile.applockwatcher.apk_src/
  1. APK is in current dir — Destination is relative
$ apk2java com.domobile.applockwatcher.apk ../../Desktop
APK_DIR_PATH: /home/android/Desktop/apk2java
Source dir: /home/android/Desktop/apk2java/../../Desktop/com.domobile.applockwatcher.apk_src/
  1. APK is in current dir — Destination not given/current one
$ apk2java com.domobile.applockwatcher.apk
APK_DIR_PATH: /home/android/Desktop/apk2java
Source dir: /home/android/Desktop/apk2java/com.domobile.applockwatcher.apk_src/

Let me know if this works for you.

@roblav96
Copy link

@anantshri @c0dist Why hasn't this been merged? :X

@anantshri
Copy link
Member

@roblav96 Thanks for the reminder. This completely skipped my radar. I will be looking at in next 2-3 days and will get this added in.

@roblav96
Copy link

roblav96 commented Oct 22, 2017

@anantshri Such a useful tool! :D Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants