decompile and desugar java bytecode - General Questions and Answers

i need to do pentesting for developer, but all my decompiling tools failed to show proper code, take a look at my issue on github, what issue i'm facing :
https://github.com/leibnitz27/cfr/issues/235
Is there option in some others java bytecode decompilers which can decompile and desugar lambda, so it displays proper code. I wasn't been able to do pentest because of this, i can't read code, not even try to exploit it at all.

The Java bytecode decompiler in IntelliJ IDEA is a built-in tool that allows you to read compiled bytecode as if it were human-readable Java code.

jwoegerbauer said:
The Java bytecode decompiler in IntelliJ IDEA is a built-in tool that allows you to read compiled bytecode as if it were human-readable Java code.
Click to expand...
Click to collapse
just checked (IntelliJ IDEA), and tried, still no luck, as i know it uses Fernlower, which i already tried. (i have problems, with improper decopmilaton/desugaring java bytecode, and it throws multiple .class files with $$Lambda$ extention)
and this is my first time to see this retrolambda, for which i never heard before.
i wish i could decompile it manually, but i can't as before 2 days i didn't knew what is retrolambda, let alone manually decompile it.
resources, how i can manually decompile and understand retrolambda, are welcome, i will check in their git repository if i can find anything, some instrutions.

Related

[Q] Compiling services.jar from source?

I've got an idea for a mod I want to make. I know where to find the Java code in the AOSP. This afternoon I spent some time futzing around with framework-res.apk; I used apktool to uncompress/decompile it, made some goofy changes, rebuilt the .apk, then signed and pushed back to my phone successfully.
Now, I want to make programmatic changes. So I pulled services.jar, decompiled with apktool again, and got my .smali files. Unfortunately, I don't understand the format whatsoever. I'm trying to do something more complicated than simply changing colors/graphics.
I want to know whether I can download the Android source, make my modification to the Java file I need, and recreate a services.jar out of it all. Is that possible? If so, is there a tutorial somewhere?

[Q] decompiling java/ recompiling

I can take dex files and decompiling them to smali assembler and make changes there but it is much harder to read than java. I have been able to decompiling to sTraight java but then once I have made a change, I can't figure out how to compile just the single java back to a class without recreating the entire project in eclipse. Is there a way to just compile that single file I changed and insert it back in?
Sent from my Inspire '4g'.
How did you decompiled dex file?
You can't compile it back just like that, but you could use some workaround:
If you reference in Java some other classes from dex, then you will have to create Java stubs for these classes.
Compile your java class, linking to above stubs and android.jar file (javac).
dex resulting *.class files (dx tool).
baksmali resulting classes.dex.
baksmali original dex file.
replace smali files with new ones.
smali everything back to classes.dex form.
You could also read this: http://code.google.com/p/android-apktool/issues/detail?id=88

[Q] Any way to compile java programs in android ?

Is there a way to compile .java file to .class file and execute it
I wanted to compile c/c++/java programs, not for my phone but in my phone...
I searched but did not find an easy way for it.
At last I found out a real easy way to compile c/c++ by using adosbox for android.
I copied the turbo c 'tc' folder from my pc to my sdcard and used adosbox like command promt to go to 'bin' folder in tc and start tc.exe...
Then I could easily write and compile programs just like i did on the pc
But still no luck for java programs...
I copied the reqired java folder and then used adosbox to run the command "javac file.java" but it said "This Program Cannot Be Run in DOS Mode"
So if there is any other way to compile java programs in my phone
please help
Thanx in advance
Try looking at Eclipse, although Eclipse is a large desktop IDE, it includes its own Java compiler written in Java (in the part called "JDT core"), and if (as I hope) that Java compiler is not copyrighted by Sun/Oracle, you (or someone else already maybe) may be able to compile that part of Eclipse into a "native" Dalvik/Android App.
Googling the issue, I see that others have been asking for an Android port of Eclipse too, so maybe there will be some momentum going for this soon.

Android Reverse Toolkit

I want to share my Tool I made yesterday in a couple of hours. I was just sad about all the steps which have to be done until you have a proper codebase of an android app (apk) so I automated some processes.
You might think "this guy have only 1 post I can't trust him !!!" I would probably think the same but I'm here on xda actually pretty long but just read as anonymous user without an account and now I just wanted to give something back so I created an account.
My Tool includes following thirdparty software:
jad (decompile .class files)
dex2Jar (converts apk files into .class files)
apktool Decompile (is used for extracting resources and Smali code)
apktool build (is used to build the smali code into an apk again)
testsign.jar (is used to sign the build apk file)
Features:
Decompile assets
Decompile resources
Decompile smali files
Decompile java files
Build apk from smali source
Sign build apk
Nice gui with drag and drop
The application is written in java so it should probably work on all operating system (not sure because jad isnt written in java so I have to use os specific files)
Screenshot:
i.imgur.com/U85AU.png
Virustotal
virustotal.com/file/69601c98a25edf2fcb22b94fb58863848a4cd4a7ee0a39b4ad40de54c086f102/analysis/1358111315/
Download: ul.to/5hy2wf9x
Awesome tool! Tested it and works perfectly! Thank you!

How to decompile library (.so) android on windows

how to decompile file *.so (library) android on windows? what tool can I used? any ideas??
saigetshu said:
how to decompile file *.so (library) android on windows? what tool can I used? any ideas??
Click to expand...
Click to collapse
Decompiling a library is not easy even on Linux! This is not something you will learn overnight. It takes years to master this.
For starters, forget about cross-decompiling. Install Linux, even a virtual machine will be better than nothing.
A .so is a compiled library. Usually generated from C or C++ source code but these days it may have been generated directly from Go source, D or some other minor language.
Then, Google "linux decompiler" and try it. But you will need to learn quite a bit of C, C++, Assembler and Linux API. Also, use readelf to find out the dependencies (DT_NEEDED ELF header).
You probably want to read Ulrich Drepper's paper on Linux shared objects and the ELF specification.
pgquiles said:
Decompiling a library is not easy even on Linux! This is not something you will learn overnight. It takes years to master this.
For starters, forget about cross-decompiling. Install Linux, even a virtual machine will be better than nothing.
A .so is a compiled library. Usually generated from C or C++ source code but these days it may have been generated directly from Go source, D or some other minor language.
Then, Google "linux decompiler" and try it. But you will need to learn quite a bit of C, C++, Assembler and Linux API. Also, use readelf to find out the dependencies (DT_NEEDED ELF header).
You probably want to read Ulrich Drepper's paper on Linux shared objects and the ELF specification.
Click to expand...
Click to collapse
thanks for advice, it's possible to convert architecture library? example from architecture arm v7a to x86.
saigetshu said:
thanks for advice, it's possible to convert architecture library? example from architecture arm v7a to x86.
Click to expand...
Click to collapse
It's not impossible but it's very complex. It's not a path you want to pursue unless you are in the business of providing a solution to run ARM code on x86.
Use qemu or a vendor-provided ARM virtualization/emulation solution (e. g. WindRiver Simics) if you want to debug ARM code on x86. Or just start gdb server on the ARM device and remotely debug, here you have a nice guide that will get you started:
https://sourceware.org/gdb/wiki/BuildingCrossGDBandGDBserver
thats really helping me, thanks again for your advice

Categories

Resources