Skip to content
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

[Feature Request] Work with reversed application's source #130

Closed
Anon-Exploiter opened this issue Nov 15, 2021 · 6 comments
Closed

[Feature Request] Work with reversed application's source #130

Anon-Exploiter opened this issue Nov 15, 2021 · 6 comments

Comments

@Anon-Exploiter
Copy link

Hi,

Is it possible to make the extension work with source of decompiled applications (apks) using jadx or d2j-dex2jar? I've been trying to make it work with apks I have but it doesn't hit the breakpoints of those.

I guess it has to do something with the path of the application etc. which isn't being satisfied.

@Anon-Exploiter
Copy link
Author

To give more details.

This (https://stackoverflow.com/a/58969794) but in VS code utilizing your extension.

@Anon-Exploiter
Copy link
Author

The issue arises in the appSrcRoot key's value. It isn't being satisfied with the decompiled code. I've shared the directory structure of an application decompiled with jadx in the screenshot.

image

It would be awesome if we can support it somehow! :)

@adelphes
Copy link
Owner

If the decompiler produces valid Java code which matches the line numbers encoded in the app debug info, I think this should work.
Normally appSrcRoot is set to the root of the package folders, where AndroidManifest.xml normally lives (I don't see it in your source tree - does the decompiler not extract it?). The reason it's reporting No source files found is because it's trying to find folders matching the package names inside a well-known source folder (like 'main' or 'java').

I would suggest:

  • setting appSrcRoot to /home/umar_0x01/apk-debugging/ViewerJNI
  • rename the sources folder to java

That should be enough to allow the debugger to find the package-name folders and the java source files. If your decompiler has produced a good Java file, everything should then match up and your breakpoints should be hit.

@Anon-Exploiter
Copy link
Author

Thanks, I get your point. In my case, I'm using jadx which keeps AndroidManifest.xml in the resources directory and the Java source inside the sources directory.

I'm not sure if the decompiled code will have the same lines (sequence) as the original order. I think I've been having some issues in Android studio because of this as well since the bytecode doesn't match the Java code (in sequence/line numbers).

@adelphes
Copy link
Owner

Yes, it's a common problem with decompilers - the line numbers are encoded in the compiled files so the decompiled files should be formatted to match, but many don't bother which makes debugging very difficult.

It looks like there is already an issue about this in jadx: skylot/jadx#476

@Anon-Exploiter
Copy link
Author

Closing this one.

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

No branches or pull requests

2 participants