![]() PPS This is not a general case recipe: if your class contains, say, a static factory method, the required modifications become even more tricky. PS This method, of course, is not for production code. It's evident that a dedicated tool would make this long sequence much easier to perform. remove the original application, install the modified apk.sign the apk: jarsigner -verbose -keystore.copy classes-dex2jar.jar to classes-X.jar, add the class files obtained at step 9 (including nested classes) to classes-X.jar.(If you can debug now, you may begin debugging and skip the following steps.) extract the new (renamed) classes to an Eclipse project (Xtuff.class, Xtuff$Useless, etc.), derive classes from top-level renamed classes ( class Stuff extends Xtuff), compile, you get the new Stuff.class.convert dex to jar: ~/Downloads/dex2jar-0.0.9.13/d2j-jar2dex.sh classes.jar, you get classes-dex2jar.jar.extract x from that new apk (obtained at step 6) I used the Midnight Commander, it shows zipped archives (including dex and jar) as directories.(Save the original apk and) rebuild the apk with apktool, use the -f flag: apktool b -f AppName AppName.apk.At this step you need some understanding of what you are doing. Replace all (or not all) occurrences of the class name "Stuff" with "Xtuff" in this case it is very likely that you will replace not all occurrences.Lfoo/bar/baz/qux/Stuff becomes Lfoo/bar/baz/qux/Xtuff it is better to see each replacement you are doing, but most likely you will replace all of them (Note: you do replace strings like Lfoo/bar/baz/qux/Stuff$Data but do not replace strings like Lfoo/bar/baz/qux/StuffData) Replace all occurrences of the full class path there, e.g. ![]() ![]() open these new files in a text editor, I used gedit.Stuff.smali becomes Xtuff.smali and Stuff$Useless.smali becomes Xtuff$Useless.smali Copy the class and its subclasses to a new file, e.g.You get the subdirectory yourApkName/smali/ packageName/ with the decompiled source of your class there. The above code sample will produce the following result.To test this example, first create a file 'program.txt' in 'C' drive. In my case, this was an Android application, you may need to convert your classes to an Android application to repeat what I did :). I did rename the class file, but it was a long and boring story.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |