Fernflower not renaming fields/methods - Printable Version +- The Bytecode Club - Reverse Engineering Forum (https://the.bytecode.club) +-- Forum: Lobby (https://the.bytecode.club/forumdisplay.php?fid=1) +--- Forum: Programming (https://the.bytecode.club/forumdisplay.php?fid=86) +--- Thread: Fernflower not renaming fields/methods (/showthread.php?tid=1202) Pages:
1
2
|
RE: Fernflower not renaming fields/methods - sothatsit - 05-17-2015 (05-16-2015, 06:55 PM)Bibl Wrote:What is the issue with using ClassVisitors?(05-16-2015, 08:28 AM)sothatsit Wrote:nono, you can run retroguard it and the classes are renamed (still in classfile form)(05-15-2015, 06:51 AM)Bibl Wrote: just tried fernflower and the same thing is happening for me, guess you should rename with proguard or retroguard.I think I'm actually going to use asm to edit the bytecode to rename the fields/methods/classes. This is good because then I don't have to recompile the source code afterwards. Thanks for your help Just to give you an idea of what i am doing: I am loading the classes using a ClassReader, i then use a ClassVisitor and map out all of values given for the classes/fields/methods into a ClassMap class, then i use this ClassMap to base my refactoring off of. So after that i loop through the classes from my ClassMap and do all the refactoring. My reasoning for this is that it would be a lot easier to manage super classes/interfaces by doing this as i can directly get access to all of the info whenever i need it. I then create a RefactorMap using the ClassMap which i will later use to rename everything. If you want to check out what i have done so far you can see it here https://github.com/Sothatsit/GamepackDownloader/ RE: Fernflower not renaming fields/methods - Bibl - 05-18-2015 I prefer the node system rather than the visitor system (it's much more flexible imo). My idea for it is going through all the classes/fields/methods and grabbing a name from the mapping provider and then just setting it. all of the other stuff, such as descriptions, super classes, super interfaces, inherited methods etc. are handled by the refactorer and the remapper only gives new names for the nodes. RE: Fernflower not renaming fields/methods - Bibl - 05-18-2015 https://gist.github.com/TheBiblMan/5e1d9e20c877b5ea6fcb got field and class renaming done 100%, methods may not work 100% so i've gotta work on that. RE: Fernflower not renaming fields/methods - sothatsit - 05-18-2015 (05-18-2015, 05:51 AM)Bibl Wrote: https://gist.github.com/TheBiblMan/5e1d9e20c877b5ea6fcb That looks interesting, I'll definitely take a look and see what you do. The main issue I have is that I want to rename classes/fields/methods to more unique and identifiable names, like class_eSomeClass_iSomeInterface_1. This is just as an attempt to make it less breakable if the order of the classes/methods/fields are changed. I have the renaming completely working, like working and mapping out there names, but I am having some issues with Frnflower throwing an error to something of the effect of "the archive or some of its contents is invalid". I'm not at the computer now so I can't check it. Do you think you could take a look at https://github.com/Sothatsit/GamepackDownloader/tree/master/src/net/sothatsit/gamepackdownloader/refactor/asm and tell me if you see anything wrong? If not, no problem, I'm sure I'll figure it out I have only implemented class refactoring thus far as I thought I would get that to work before working on methods/fields. RE: Fernflower not renaming fields/methods - Bibl - 05-18-2015 I think you also need to handle TypeInsnNodes, maybe even LdcInsnNodes as well for(Types). I'd recommend you look at the code I posted to see the sort of things you should refactor and what you shouldn't (which insns, which methods, hierarchy methods and classes etc) RE: Fernflower not renaming fields/methods - sothatsit - 05-23-2015 (05-18-2015, 02:59 PM)Bibl Wrote: I think you also need to handle TypeInsnNodes, maybe even LdcInsnNodes as well for(Types). Sorry for the late reply, been really busy. I have been looking through AbstractInsnNode's sub classes and it seems these are the ones which refer to types which could be refactored: TypeInsnNode MethodInsnNode MultiANewArrayInsnNode FieldInsnNode Those are the ones which refer to names which could be refactored. On another note, i have started to switch from visitors to using ClassNodes. There is a performance difference but its not much of an issue for me. Thanks for all your help with everything! RE: Fernflower not renaming fields/methods - sothatsit - 05-23-2015 RE: Fernflower not renaming fields/methods - Bibl - 05-24-2015 does the jar run properly? RE: Fernflower not renaming fields/methods - sothatsit - 05-24-2015 (05-24-2015, 03:12 AM)Bibl Wrote: does the jar run properly? I have not tried yet, but fernflower decompiles it properly, which it wasn't doing before. Having thought about how I did everything though I have made some mistakes which I need to fix. Like, duplicate methods does not take into account if the method is overriden in a super class or is from a sub-class. It doesn't rename the class file if the class name has changed. I'm sure there's more that I haven't thought of yet. So, I don't think it would run in its current state, but when I fix some of the issues with it, it hopefully will. RE: Fernflower not renaming fields/methods - Bibl - 05-24-2015 yeah, inheritence was my biggest problem at the start. |