What's the best way to learn Smali (and how/when to use Dalvik VM opcodes)?

Ken Kinder picture Ken Kinder · Apr 14, 2011 · Viewed 72.5k times · Source

I know Java, and learned C but never used it. I do not know any form of assembly, either for a virtual machine or a real one.

What's the best way to learn how to hack Smali?

Answer

Aleadam picture Aleadam · Apr 14, 2011

UPDATE: As I promised yesterday, I added some more links to the list.

Ufff. Not much documentation around! Best advice? Decompile, and read, and tweak, and see how it did, and start the cycle again and again. But you did not ask for that advice, right? ;)

Now, there are a few places out there that wil lhelp a little bit:

http://androidcracking.blogspot.com/search/label/smali This is the best one. I even asked the guy a question and he answered very quickly, so go and take a look.

http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html Very comprehensive table - good reference!

http://webchat.freenode.net/?channels=smali I never tried it, but it's on the google code page of the baksmali author ( http://code.google.com/p/smali/ )

http://forum.xda-developers.com/showthread.php?t=777707 Lastly, this is a post I made some time ago describing some hacks to the Captivate camera. You can follow the diffs in there as I comment a little bit on what each .diff file is doing. The good stuff starts at the post #20.

http://www.slideshare.net/paller/understanding-the-dalvik-bytecode-with-the-dedexer-tool Interesting slide show with some basic concepts. Good way to start.

http://sites.google.com/site/haynesmathew/home/projects/dalvik-notes Even more low level than the typical .smali. A reference for later, but a good read.

http://jasmin.sourceforge.net/guide.html Smali syntax is based on Jasmin, so this gives good concepts.

http://groups.google.com/group/apktool?pli=1 Some discussions there are worth reading through. Also a good place to search for when you're stuck in something.

And last, but not least, the most helpful trick I used: start coding very basic classes and methods in java, compile them and then baksmali your own code. You know exactly what it does, so it will be a lot easier to follow.

Good luck!