Arthur Schopenhauer said :

"A man can do what he wants, but not want what he wants"







Saturday, October 20, 2012

disassembling .dex files

requirements

- JRE
- android.policy.jar (an example)
- disassembler from code.google.com

to get android.policy.jar from the phone use

adb pull /system/framework/android.policy.jar c:/temp/android.policy.jar


android.policy.jar in a java archive so extract classes.dex copy both classes.dex and disassembler files to a working folder (c:/temp) and open a cmd line to that folder
to disassemble dex file input

java -Xmx512M -jar baksmali.jar -o classout classes.dex






and wait for an /classout folder 


when editing source files use a decent source code editor like Notepad++ or Kate/ Vim for Linux never use notepad from Windows - this is not bad but it's as he says : a "note" editor only so will not recognize/ save smali-file syntax elements

I used this when working to change default screen-locker on Move ROM or to add new entries to Power Menu

when finishing the job put it back together

java -Xmx512M -jar smali.jar classout -o classes.dex

then replace new classes.dex on original android.policy.jar and then push it back on phone

adb push android.policy.jar /system/framework/android.policy.jar


No comments:

Post a Comment