super icon indicating copy to clipboard operation
super copied to clipboard

Remove Java dependencies

Open Razican opened this issue 9 years ago • 6 comments

We should not require Java dependencies for our software, here is the current status of Java dependencies:

  • [x] APKTool - #20
  • [ ] jd-cmd - #23
  • [ ] dex2jar - #24

Razican avatar Sep 15 '16 19:09 Razican

@zerjioang maybe you could help with some of these by puting some light in some of them? Maybe dex2jar is near your FDP?

Razican avatar Sep 15 '16 19:09 Razican

@Razican yep, it might help you since I do not decompile android bytecode to java. I just read it as a decompiler does but without generating final code. So you can check, how I parse bytecode array into structured code for later, gather information such as class names, methods, fields and so on. I can even follow inner and outter class method so, it can be interesing

zerjioang avatar Sep 21 '16 11:09 zerjioang

And btw, if you guys @Razican @Br1oP @Chuky9 @SergioD0l agree, we can collaborate and improve one each others projects and create something big!

zerjioang avatar Sep 21 '16 11:09 zerjioang

@zerjioang It is of course my desire. Since version 0.2.0 we are planning big changes to the project (until then, first of October, we are only looking forward to a release).

But one of our biggest problems is the fact that we are using a ton of external Java dependencies we would like to avoid, and two of them are the ones that extract the .dex file and convert it to .jar (Java bytecode) which we only use to convert it to original Java code wirh another dependency.

That takes us a lot of analysis time, and could probably be solved by using a Rust dex to Java decompiler. I'll check out your code once we release this first version and I'll try to port it to Rust.

We still have some issues parsing XML files though (we are using APKtool for that). Do you have any information in that area?

Razican avatar Sep 21 '16 12:09 Razican

@Razican I know Java dependencies can be slow, and indeed, the latest version of apktool is much more slower than the previous one.

Extracting .dex is simple cause you use a zip algorithm and its done. Reading the bytecode is a bit difficult since you have to create the model based on .dex architecture and parse the byte array into that. Even with this, I recommend you to take a look to 'dx' utility source code. You have it there all you want to parse the code into readable format with classes, methods, arguments and so on.

Regardint to XML, I have a class that you can port to rust that converts binary xml to readable xml. It was taken from axml project so maybe this can put some light into your problem.

Did you think about using 'dx' output result (json/xml I guess) instead of dex2jar outcome?

Anyway, Im thinking on how viable is to port all my project to rust too. I know, you convince me! :P

zerjioang avatar Sep 21 '16 15:09 zerjioang

A dex/Dalvik parser is being worked on in the dalvik repo. Once we have the parser, we will be able to create a dex to Java direct decompiler. Which would solve #23 (jd-cmd) and #24 (dex2jar). About APKTool, we are currently using it only for XML extraction, which I think can be solved with your proposal, @zerjioang.

Razican avatar Oct 03 '16 11:10 Razican