├── .gitignore ├── README.md ├── pom.xml └── src └── main └── java └── eUpdater ├── analysers ├── classes │ ├── actor.java │ ├── animable.java │ ├── animationSequence.java │ ├── boundaryObject.java │ ├── buffer.java │ ├── cacheable.java │ ├── classAnalyserFrame.java │ ├── client.java │ ├── floorDecoration.java │ ├── gameObject.java │ ├── gameShell.java │ ├── hashTable.java │ ├── item.java │ ├── linkedList.java │ ├── model.java │ ├── nnode.java │ ├── npc.java │ ├── npcDefinition.java │ ├── objectDefinition.java │ ├── player.java │ ├── region.java │ ├── renderable.java │ ├── sceneTile.java │ ├── wallDecoration.java │ ├── widget.java │ └── widgetNode.java ├── mainAnalyser.java └── methods │ ├── actor.java │ ├── boundaryObject.java │ ├── cacheable.java │ ├── client.java │ ├── floorDecoration.java │ ├── gameObject.java │ ├── hashTable.java │ ├── item.java │ ├── linkedList.java │ ├── methodAnalyserFrame.java │ ├── methods.java │ ├── nnode.java │ ├── npc.java │ ├── npcDefinition.java │ ├── objectDefinition.java │ ├── player.java │ ├── region.java │ ├── renderable.java │ ├── sceneTile.java │ ├── wallDecoration.java │ ├── widget.java │ └── widgetNode.java ├── deob ├── DeobFrame.java ├── Deobsfucate.java ├── EqualSwap.java ├── Method.java ├── MethodInfo.java ├── MethodName.java ├── Multipliers.java ├── OpaquePredicates.java └── RemoveExceptions.java ├── frame ├── classFrame.java ├── hook.java └── methodFrame.java ├── main └── eUpdater.java ├── misc ├── JarHandler.java ├── Misc.java ├── Printer.java ├── classes.java ├── myException.java └── timer.java ├── refactor └── refactor.java └── searchers ├── FieldSearcher.java ├── Modulo.java ├── Searcher.java └── mutltiplierSearcher.java /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | res 3 | target 4 | *.iml 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java-Class-Updater 2 | 3 | ## Requirements 4 | - Maven ^3.0.0 5 | - Java ^1.8 6 | 7 | ## How to run from cmd 8 | - Run `mvn verify` to generate shaded jar 9 | - Locate jar, it should be `repo_base/target/eUpdater.jar` 10 | - Run `java -jar path/to/jar/eUpdater.jar` -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | eUpdater 6 | Java-Class-Updater 7 | 1.0-SNAPSHOT 8 | Java-Class-Updater 9 | http://maven.apache.org 10 | 11 | 12 | 1.8 13 | 14 | 15 | 16 | eUpdater 17 | 18 | 19 | org.apache.maven.plugins 20 | maven-compiler-plugin 21 | 2.3.2 22 | 23 | ${jdk.version} 24 | ${jdk.version} 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-shade-plugin 31 | 2.4.3 32 | 33 | 34 | package 35 | 36 | shade 37 | 38 | 39 | false 40 | 41 | 42 | eUpdater.main.eUpdater 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | org.ow2.asm 55 | asm-all 56 | 4.1 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/actor.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | 7 | /** 8 | * Created by Kyle on 7/22/2015. 9 | */ 10 | public class actor extends classAnalyserFrame { 11 | 12 | public void identify(classFrame c) { 13 | classes.myActor.setId("Actor"); 14 | this.setMethodAnalyser(methods.myActor); 15 | if (c.superName.equals(classes.myRenderable.getName()) && c.access == 1057 && c.fields.size() > 40) 16 | classes.myActor.set(c); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/animable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.misc.classes; 5 | import org.objectweb.asm.tree.MethodNode; 6 | 7 | /** 8 | * Created by Kyle on 7/21/2015. 9 | */ 10 | public class animable extends classAnalyserFrame { 11 | 12 | public void identify(classFrame c) { 13 | classes.myAnimable.setId("Animable"); 14 | if (c.superName.equals(classes.myRenderable.getName())) { 15 | for (int I = 0; I < c.methods.size(); ++I) { 16 | MethodNode Method = (MethodNode) c.methods.get(I); 17 | if (Method.desc.equals("(IIIIIIIZL" + classes.myRenderable.getName() + ";)V")) 18 | classes.myAnimable.set(c); 19 | } 20 | } 21 | } 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/animationSequence.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.tree.MethodNode; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by Kyle on 7/22/2015. 12 | */ 13 | public class animationSequence extends classAnalyserFrame { 14 | 15 | public void identify(classFrame c) { 16 | classes.myAnimationSequence.setId("AnimationSequence"); 17 | if (c.superName.equals(classes.myCacheable.getName())) { 18 | List methodList = c.methods; 19 | for (MethodNode m : methodList) { 20 | if (m.desc.equals("(L" + classes.myModel.getName() + ";IL" + c.name + ";I)L" 21 | + classes.myModel.getName() + ";")) 22 | classes.myAnimationSequence.set(c); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/boundaryObject.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | /** 9 | * Created by Kyle on 7/23/2015. 10 | */ 11 | public class boundaryObject extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | classes.myBoundaryObject.setId("BoundaryObject"); 15 | this.setMethodAnalyser(methods.myBoundaryObject); 16 | if ((c.getFields("L" + classes.myRenderable.getName() + ";").size() == 2) 17 | && (c.getFields(Opcodes.ACC_PUBLIC, Opcodes.ACC_STATIC).size() == 6)) 18 | classes.myBoundaryObject.set(c); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/buffer.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.misc.classes; 5 | import org.objectweb.asm.tree.MethodNode; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by Kyle on 7/22/2015. 11 | */ 12 | public class buffer extends classAnalyserFrame { 13 | 14 | public void identify(classFrame c) { 15 | classes.myBuffer.setId("Buffer"); 16 | if (c.superName.equals(classes.myNode.getName())) { 17 | int Count = 0; 18 | List methodList = c.methods; 19 | for (MethodNode m : methodList) { 20 | if (m.desc.contains("(Ljava/lang/CharSequence;")) 21 | ++Count; 22 | if (m.desc.contains("(Ljava/math/BigInteger;Ljava/math/BigInteger;")) 23 | ++Count; 24 | if (Count == 2) { 25 | classes.myBuffer.set(c); 26 | break; 27 | } 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/cacheable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methodAnalyserFrame; 4 | import eUpdater.analysers.methods.methods; 5 | import eUpdater.frame.classFrame; 6 | import eUpdater.misc.classes; 7 | import eUpdater.searchers.FieldSearcher; 8 | 9 | /** 10 | * Created by Kyle on 7/21/2015. 11 | */ 12 | public class cacheable extends classAnalyserFrame { 13 | 14 | public void identify(classFrame c) { 15 | classes.myCacheable.setId("Cacheable"); 16 | setMethodAnalyser(methods.myCacheable); 17 | 18 | int nodeCount; 19 | if (c.superName.equals(classes.myNode.getName()) && c.fields.size() == 2) { 20 | FieldSearcher fieldSearch = new FieldSearcher(c); 21 | nodeCount = fieldSearch.countDesc(String.format("L%s;", c.name)); 22 | if (nodeCount == 2) 23 | classes.myCacheable.set(c); 24 | } 25 | } 26 | 27 | public void setMethodAnalyser(methodAnalyserFrame m) { 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/classAnalyserFrame.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methodAnalyserFrame; 4 | import eUpdater.frame.classFrame; 5 | 6 | import java.util.ArrayList; 7 | 8 | import static eUpdater.misc.JarHandler.CLASSES; 9 | 10 | /** 11 | * Created by Kyle on 7/21/2015. 12 | */ 13 | public abstract class classAnalyserFrame { 14 | 15 | int count; 16 | private String id, name; 17 | private ArrayList nodes = new ArrayList<>(); 18 | public boolean hasMethodAnalyser = false; 19 | private methodAnalyserFrame methodAnalyser; 20 | 21 | public abstract void identify(classFrame c); 22 | 23 | public int duplicates() { 24 | 25 | return count - 1; 26 | } 27 | 28 | public void setId(String s) { 29 | 30 | this.id = s; 31 | } 32 | 33 | public String getId() { 34 | 35 | return this.id; 36 | } 37 | 38 | public void setNode(classFrame c) { 39 | nodes.add(c); 40 | if (nodes.size() > 1) { 41 | if (!c.name.equals(nodes.get(nodes.size() - 2).name)) 42 | ++count; 43 | } else { 44 | ++count; 45 | } 46 | } 47 | 48 | public ArrayList getNodes() { 49 | 50 | return this.nodes; 51 | } 52 | 53 | public classFrame getNode() { 54 | return getNodes().get(0); 55 | } 56 | 57 | public void setName(classFrame c) { 58 | this.name = c.name; 59 | } 60 | 61 | public String getName() { 62 | return this.name; 63 | } 64 | 65 | public void set(String id, classFrame c) { 66 | this.setId(id); 67 | this.setName(c); 68 | this.setNode(c); 69 | } 70 | 71 | public void set(classFrame c) { 72 | this.setName(c); 73 | this.setNode(c); 74 | } 75 | 76 | public boolean getClass(String name) { 77 | for (classFrame c : CLASSES.values()) { 78 | if (name.equals(c.name)) { 79 | this.set(c); 80 | return true; 81 | } 82 | } 83 | return false; 84 | } 85 | 86 | public void setMethodAnalyser(methodAnalyserFrame m) { 87 | this.methodAnalyser = m; 88 | this.hasMethodAnalyser = true; 89 | } 90 | 91 | public methodAnalyserFrame getMethodAnalyser() { 92 | return this.methodAnalyser; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/client.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | 7 | /** 8 | * Created by Kyle on 7/22/2015. 9 | */ 10 | public class client extends classAnalyserFrame { 11 | 12 | public void identify(classFrame c) { 13 | classes.myClient.setId("Client"); 14 | this.setMethodAnalyser(methods.myClient); 15 | if (c.name.equals("client")) 16 | classes.myClient.set(c); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/floorDecoration.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | /** 9 | * Created by Kyle on 7/23/2015. 10 | */ 11 | public class floorDecoration extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | classes.myFloorDecoration.setId("FloorDecoration"); 15 | this.setMethodAnalyser(methods.myFloorDecoration); 16 | if ((c.getFields("L" + classes.myRenderable.getName() + ";").size() == 1) 17 | && (c.getFields(Opcodes.ACC_PUBLIC, Opcodes.ACC_STATIC)).size() == 4) 18 | classes.myFloorDecoration.set(c); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/gameObject.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.Opcodes; 7 | import org.objectweb.asm.tree.FieldNode; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by Kyle on 7/23/2015. 13 | */ 14 | public class gameObject extends classAnalyserFrame { 15 | 16 | public void identify(classFrame c) { 17 | classes.myGameObject.setId("GameObject"); 18 | this.setMethodAnalyser(methods.myGameObject); 19 | 20 | classFrame removed = c; 21 | removed.removeFields("I"); 22 | int count = 0, count2 = 0; 23 | List fields = removed.fields; 24 | for (FieldNode fN : fields) { 25 | if (fN.desc.equals("I")) { 26 | if ((fN.access & Opcodes.ACC_PUBLIC) == 0 27 | && (fN.access & Opcodes.ACC_STATIC) == 0) 28 | ++count; 29 | if ((fN.access & Opcodes.ACC_PUBLIC) != 0 && (fN.access & Opcodes.ACC_STATIC) == 0) 30 | ++count2; 31 | } 32 | } 33 | if ((count == 12) && count2 == 1) 34 | classes.myGameObject.set(c); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/gameShell.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.misc.classes; 5 | 6 | /** 7 | * Created by Kyle on 7/22/2015. 8 | */ 9 | public class gameShell extends classAnalyserFrame { 10 | 11 | public void identify(classFrame c) { 12 | classes.myGameShell.setId("GameShell"); 13 | if (c.superName.equals("java/applet/Applet")) { 14 | if (c.interfaces.size() == 3) 15 | classes.myGameShell.set(c); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/hashTable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.FieldSearcher; 7 | 8 | /** 9 | * Created by Kyle on 7/22/2015. 10 | */ 11 | public class hashTable extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | classes.myHashTable.setId("HashTable"); 15 | this.setMethodAnalyser(methods.myHashTable); 16 | 17 | if (c.superName.equals("java/lang/Object")) { 18 | FieldSearcher FSearch = new FieldSearcher(c); 19 | int nodeArray = FSearch.countDesc("[L" + classes.myNode.getName() + ";"); 20 | int nodeCount = FSearch.countDesc("L" + classes.myNode.getName() + ";"); 21 | if (nodeArray == 1 && nodeCount == 2) { 22 | classes.myHashTable.set(c); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/item.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.Opcodes; 7 | import org.objectweb.asm.tree.FieldNode; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by Kyle on 7/24/2015. 13 | */ 14 | public class item extends classAnalyserFrame { 15 | 16 | public void identify(classFrame c) { 17 | classes.myItem.setId("Item"); 18 | this.setMethodAnalyser(methods.myItem); 19 | if (c.superName.equals(classes.myRenderable.getName()) && c.access == 49) { 20 | List fields = c.fields; 21 | int count = 0; 22 | for (FieldNode fN : fields) { 23 | if (fN.desc.equals("I") && (fN.access & Opcodes.ACC_PUBLIC) == 0 && (fN.access & Opcodes.ACC_STATIC) == 0) 24 | ++count; 25 | } 26 | if (count == 2) 27 | classes.myItem.set(c); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/linkedList.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.FieldSearcher; 7 | 8 | 9 | /** 10 | * Created by Kyle on 7/22/2015. 11 | */ 12 | public class linkedList extends classAnalyserFrame { 13 | 14 | public void identify(classFrame c) { 15 | classes.myLinkedList.setId("linkedList"); 16 | setMethodAnalyser(methods.myLinkedList); 17 | if (c.superName.equals("java/lang/Object") && c.fields.size() == 2) { 18 | FieldSearcher FSearch = new FieldSearcher(c); 19 | int L = FSearch.countDesc("L" + classes.myNode.getName() + ";"); 20 | if (L == 2 && c.methods.size() > 9) 21 | classes.myLinkedList.set(c); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/model.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.misc.classes; 5 | import org.objectweb.asm.tree.MethodNode; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by Kyle on 7/22/2015. 11 | */ 12 | public class model extends classAnalyserFrame { 13 | 14 | public void identify(classFrame c) { 15 | classes.myModel.setId("Model"); 16 | if (c.superName.equals(classes.myRenderable.getName()) && c.access == 33 && c.fields.size() > 50) { 17 | List methodList = c.methods; 18 | for (MethodNode m : methodList) { 19 | if (m.desc.equals("([[IIIIZI)" + "L" + c.name + ";")) 20 | classes.myModel.set(c); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/nnode.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.FieldSearcher; 7 | 8 | /** 9 | * Created by Kyle on 7/21/2015. 10 | */ 11 | public class nnode extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | int nodeCount; 15 | int idCount; 16 | setMethodAnalyser(methods.myNode); 17 | if (c.superName.equals("java/lang/Object")) { 18 | classes.myNode.setId("Node"); 19 | FieldSearcher fieldSearch = new FieldSearcher(c); 20 | idCount = fieldSearch.countDesc("J"); 21 | nodeCount = fieldSearch.countDesc(String.format("L%s;", c.name)); 22 | if ((idCount >= 1) & (nodeCount == 2)) { 23 | classes.myNode.set(c); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/npc.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | 7 | /** 8 | * Created by Kyle on 7/22/2015. 9 | */ 10 | public class npc extends classAnalyserFrame { 11 | 12 | public void identify(classFrame c) { 13 | classes.myNpc.setId("Npc"); 14 | classes.myNpc.setMethodAnalyser(methods.myNpc); 15 | if (c.superName.equals(classes.myActor.getName()) && c.access == 49 16 | && c.fields.size() < 10) 17 | classes.myNpc.set(c); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/npcDefinition.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.tree.MethodNode; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by Kyle on 7/22/2015. 12 | */ 13 | public class npcDefinition extends classAnalyserFrame { 14 | 15 | public void identify(classFrame c) { 16 | classes.myNpcDefinition.setId("NpcDefinition"); 17 | setMethodAnalyser(methods.myNpcDefinition); 18 | 19 | if (c.superName.equals(classes.myCacheable.getName()) && c.access == 33) { 20 | List methodList = c.methods; 21 | for (MethodNode m : methodList) { 22 | if (m.desc.contains(classes.myAnimationSequence.getName() 23 | + ";IL" + classes.myAnimationSequence.getName())) 24 | classes.myNpcDefinition.set(c); 25 | 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/objectDefinition.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.tree.MethodNode; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by Kyle on 7/22/2015. 12 | */ 13 | public class objectDefinition extends classAnalyserFrame { 14 | 15 | public void identify(classFrame c) { 16 | classes.myObjectDefinition.setId("ObjectDefinition"); 17 | classes.myObjectDefinition.setMethodAnalyser(methods.myObjectDefinition); 18 | if (c.superName.equals(classes.myCacheable.getName())) { 19 | List methodList = c.methods; 20 | for (MethodNode m : methodList) { 21 | if (m.desc.contains("II[[IIII")) { 22 | classes.myObjectDefinition.set(c); 23 | break; 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/player.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.tree.FieldNode; 7 | 8 | /** 9 | * Created by Kyle on 7/22/2015. 10 | */ 11 | public class player extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | classes.myPlayer.setId("Player"); 15 | this.setMethodAnalyser(methods.myPlayer); 16 | 17 | if (c.superName.equals(classes.myActor.getName())) { 18 | for (int I = 0; I < c.fields.size(); ++I) { 19 | FieldNode field = (FieldNode) c.fields.get(I); 20 | if (field.desc.equals("Ljava/lang/String;")) { 21 | if (c.fields.size() > 10) 22 | classes.myPlayer.set(c); 23 | } 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/region.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.FieldSearcher; 7 | 8 | /** 9 | * Created by Kyle on 7/22/2015. 10 | */ 11 | public class region extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | classes.myRegion.setId("Region"); 15 | this.setMethodAnalyser(methods.myRegion); 16 | if (c.superName.equals("java/lang/Object")) { 17 | FieldSearcher s = new FieldSearcher(c); 18 | int L = s.countDesc("[[[[Z"); 19 | if (L == 1) 20 | classes.myRegion.set(c); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/renderable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.MethodNode; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by Kyle on 7/21/2015. 14 | */ 15 | public class renderable extends classAnalyserFrame { 16 | 17 | public void identify(classFrame c) { 18 | this.setId("Renderable"); 19 | setMethodAnalyser(methods.myRenderable); 20 | 21 | if (c.superName.equals(classes.myCacheable.getName())) { 22 | for (int I = 0; I < c.methods.size(); ++I) { 23 | List methodList = c.methods; 24 | for (MethodNode m : methodList) { 25 | if (m.desc.contains("(IIIIIIII")) { 26 | Searcher search = new Searcher(m); 27 | int L = search.find(new int[]{Opcodes.ALOAD, Opcodes.ILOAD, Opcodes.ILOAD, Opcodes.ILOAD, Opcodes.ILOAD, Opcodes.ILOAD}, 0); 28 | if (L > 0) { 29 | this.set(c); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/sceneTile.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import org.objectweb.asm.Opcodes; 6 | import org.objectweb.asm.tree.FieldNode; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by Kyle on 7/23/2015. 12 | */ 13 | public class sceneTile extends classAnalyserFrame { 14 | 15 | public void identify(classFrame c) { 16 | this.setId("SceneTile"); 17 | this.setMethodAnalyser(methods.mySceneTile); 18 | List fields = c.fields; 19 | int count = 0, count2 = 0; 20 | for (FieldNode fN : fields) { 21 | if (fN.desc.equals("I") && (fN.access & Opcodes.ACC_PUBLIC) == 0 && (fN.access & Opcodes.ACC_STATIC) == 0) 22 | ++count; 23 | if (fN.desc.equals("[I") && (fN.access & Opcodes.ACC_PUBLIC) == 0 && (fN.access & Opcodes.ACC_STATIC) == 0) 24 | ++count2; 25 | } 26 | if ((count == 11) && count2 == 1) 27 | this.set("SceneTile", c); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/wallDecoration.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | /** 9 | * Created by Kyle on 7/23/2015. 10 | */ 11 | public class wallDecoration extends classAnalyserFrame { 12 | 13 | public void identify(classFrame c) { 14 | this.setId("WallDecoration"); 15 | this.setMethodAnalyser(methods.myWallDecoration); 16 | if ((c.getFields("L" + classes.myRenderable.getName() + ";").size() == 2) 17 | && (c.getFields(Opcodes.ACC_PUBLIC, Opcodes.ACC_STATIC).size() == 8)) 18 | this.set(c); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/widget.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.FieldSearcher; 7 | 8 | 9 | /** 10 | * Created by Kyle on 7/22/2015. 11 | */ 12 | public class widget extends classAnalyserFrame { 13 | 14 | public void identify(classFrame c) { 15 | this.setId("Widget"); 16 | this.setMethodAnalyser(methods.myWidget); 17 | classes.myWidget.setId("Widget"); 18 | if (c.superName.equals(classes.myNode.getName()) && c.fields.size() > 50) { 19 | this.set(c); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/classes/widgetNode.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.classes; 2 | 3 | import eUpdater.analysers.methods.methods; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.misc.classes; 6 | import org.objectweb.asm.tree.FieldNode; 7 | 8 | import java.lang.reflect.Modifier; 9 | 10 | /** 11 | * Created by Kyle on 7/22/2015. 12 | */ 13 | public class widgetNode extends classAnalyserFrame { 14 | 15 | public void identify(classFrame c) { 16 | this.setId("WidgetNode"); 17 | this.setMethodAnalyser(methods.myWidgetNode); 18 | int intCount = 0, boolCount = 0; 19 | if (c.superName.equals(classes.myNode.getName())) { 20 | for (int I = 0; I < c.fields.size(); ++I) { 21 | FieldNode Field = (FieldNode) c.fields.get(I); 22 | if (Modifier.isStatic(Field.access)) 23 | continue; 24 | if (Field.desc.equals("I")) 25 | ++intCount; 26 | if (Field.desc.equals("Z")) 27 | ++boolCount; 28 | } 29 | if (boolCount == 1 && intCount == 2) 30 | this.set(c); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/mainAnalyser.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers; 2 | 3 | import eUpdater.analysers.classes.classAnalyserFrame; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.frame.hook; 6 | import eUpdater.main.eUpdater; 7 | import eUpdater.misc.Misc; 8 | import eUpdater.misc.classes; 9 | import eUpdater.misc.timer; 10 | import eUpdater.refactor.refactor; 11 | import eUpdater.searchers.mutltiplierSearcher; 12 | import org.objectweb.asm.tree.FieldNode; 13 | 14 | import javax.json.*; 15 | import java.io.FileWriter; 16 | import java.io.IOException; 17 | import java.io.PrintWriter; 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | import java.util.Scanner; 21 | 22 | import static eUpdater.misc.JarHandler.CLASSES; 23 | import static javax.json.Json.createArrayBuilder; 24 | 25 | /** 26 | * Created by Kyle on 7/21/2015. 27 | */ 28 | public class mainAnalyser { 29 | public static mainAnalyser access = null; 30 | 31 | private ArrayList classAnalysers = new ArrayList(); 32 | private List brokenFields = new ArrayList<>(); 33 | private int brokenFieldsInt = 0, totalFieldsInt = 0; 34 | private List duplicateFields = new ArrayList<>(); 35 | private int duplicateFieldsInt = 0; 36 | 37 | public ArrayList getClassAnalysers() { 38 | return classAnalysers; 39 | } 40 | 41 | public void setClassAnalysers(ArrayList classAnalysers) { 42 | this.classAnalysers = classAnalysers; 43 | } 44 | 45 | private void loadClasses() { 46 | 47 | this.classAnalysers.add(classes.myNode); 48 | this.classAnalysers.add(classes.myCacheable); 49 | this.classAnalysers.add(classes.myRenderable); 50 | this.classAnalysers.add(classes.myAnimable); 51 | this.classAnalysers.add(classes.myModel); 52 | this.classAnalysers.add(classes.myAnimationSequence); 53 | this.classAnalysers.add(classes.myNpcDefinition); 54 | this.classAnalysers.add(classes.myLinkedList); 55 | this.classAnalysers.add(classes.myActor); 56 | this.classAnalysers.add(classes.myNpc); 57 | this.classAnalysers.add(classes.myObjectDefinition); 58 | this.classAnalysers.add(classes.myBuffer); 59 | this.classAnalysers.add(classes.myWidget); 60 | this.classAnalysers.add(classes.myWidgetNode); 61 | this.classAnalysers.add(classes.myHashTable); 62 | this.classAnalysers.add(classes.myGameShell); 63 | this.classAnalysers.add(classes.myPlayer); 64 | this.classAnalysers.add(classes.myClient); 65 | this.classAnalysers.add(classes.myRegion); 66 | this.classAnalysers.add(classes.myBoundaryObject); 67 | this.classAnalysers.add(classes.myGameObject); 68 | this.classAnalysers.add(classes.myFloorDecoration); 69 | this.classAnalysers.add(classes.myWallDecoration); 70 | this.classAnalysers.add(classes.mySceneTile); 71 | this.classAnalysers.add(classes.myItem); 72 | } 73 | 74 | private void runClassAnalysers() { 75 | timer t = new timer(true); 76 | System.out.println("%% Identifying Classes.."); 77 | for (classAnalyserFrame a : this.classAnalysers) { 78 | for (classFrame c : CLASSES.values()) { 79 | a.identify(c); 80 | } 81 | if (a.getName() == null) { 82 | Scanner inputClass = new Scanner(System.in); 83 | System.out.println(a.getId() + " broke :/"); 84 | System.out.print(a.getId() + " = "); 85 | if (!a.getClass(inputClass.next())) { 86 | System.out.println("Class not found, terminating.."); 87 | System.exit(1); 88 | } 89 | } 90 | } 91 | System.out.print(" (Identified " + this.classAnalysers.size() + " out of " + this.classAnalysers.size() + " Classes)"); 92 | System.out.println(" ~ Took " + t.getElapsedTime() + " ms\n"); 93 | } 94 | 95 | private void runMethodAnalysers() { 96 | timer t = new timer(true); 97 | System.out.println("%% Identifying Fields.."); 98 | for (classAnalyserFrame a : this.classAnalysers) { 99 | if (a.hasMethodAnalyser) { 100 | a.getMethodAnalyser().identify(); 101 | for (hook f : a.getMethodAnalyser().getHooks()) { 102 | if (f.isDuplicate()) { 103 | duplicateFieldsInt += 1; 104 | duplicateFields.add(f.getId()); 105 | } 106 | if (f.broken) 107 | brokenFieldsInt += 1; 108 | } 109 | brokenFieldsInt += (a.getMethodAnalyser().getNeededHooks().size() - a.getMethodAnalyser().getHooks().size()); 110 | totalFieldsInt += a.getMethodAnalyser().getNeededHooks().size(); 111 | } 112 | } 113 | System.out.print(" (Identified " + (totalFieldsInt - brokenFieldsInt - duplicateFieldsInt) + " out of " + totalFieldsInt + " Fields)"); 114 | System.out.println(" ~ Took " + t.getElapsedTime() + " ms\n"); 115 | } 116 | 117 | private void checkFoundFields() { 118 | for (classAnalyserFrame a : this.classAnalysers) { 119 | if (!a.hasMethodAnalyser) 120 | continue; 121 | if (a.getMethodAnalyser().getNeededHooks().size() != a.getMethodAnalyser().getHooks().size()) { 122 | for (String f : a.getMethodAnalyser().getNeededHooks()) { 123 | if (!a.getMethodAnalyser().containsHook(f)) { 124 | Scanner inputField = new Scanner(System.in); 125 | System.out.println(a.getId() + "." + f + " broke :/"); 126 | System.out.print(f + " = "); 127 | String id = inputField.next(); 128 | System.out.println(id); 129 | FieldNode newField = Misc.getField(id, a.getNode()); 130 | if (newField == null) 131 | System.out.println("Field" + id + " Not Found"); 132 | a.getMethodAnalyser().addHook(new hook(f, newField)); 133 | } 134 | } 135 | } 136 | } 137 | } 138 | 139 | private void addMultis() { 140 | int multis = 0; 141 | boolean staticc; 142 | System.out.println("%% Populating Multipliers.."); 143 | timer t = new timer(true); 144 | for (classAnalyserFrame a : this.classAnalysers) { 145 | if (a.getId().contains("Client")) 146 | staticc = true; 147 | else 148 | staticc = false; 149 | if (!a.hasMethodAnalyser) 150 | continue; 151 | for (hook f : a.getMethodAnalyser().getHooks()) { 152 | if (f.getDesc().equals("I")) { 153 | if (staticc) 154 | f.setMultiplier(mutltiplierSearcher.get(f.getName(), f.getOwner(), true)); 155 | else 156 | f.setMultiplier(mutltiplierSearcher.get(f.getName(), a.getName(), false)); 157 | if (f.getMultiplier() != 0) 158 | ++multis; 159 | } 160 | } 161 | } 162 | System.out.print(" (Populated " + multis + " Multipliers)"); 163 | System.out.println(" ~ Took " + t.getElapsedTime() + " ms\n\n"); 164 | 165 | } 166 | 167 | /* private void jsonPrint() { 168 | 169 | JsonBuilderFactory factory = Json.createBuilderFactory(null); 170 | JsonObjectBuilder build = factory.createObjectBuilder(); 171 | JsonObjectBuilder build2 = factory.createObjectBuilder(); 172 | 173 | for (classAnalyserFrame a : this.classAnalysers) { 174 | if (!a.hasMethodAnalyser) 175 | continue; 176 | for (hook f : a.getMethodAnalyser().getHooks()) { 177 | 178 | if (!a.getId().equals("Client")) { 179 | build2.add(f.getId(), factory.createObjectBuilder() 180 | .add("hook", f.getName()) 181 | .add("multi", f.getMultiplier())); 182 | build2.add("name", a.getName()); 183 | } else { 184 | build2.add(f.getId(), factory.createObjectBuilder() 185 | .add("hook", f.getOwner() + "." + f.getName()) 186 | .add("multi", f.getMultiplier())); 187 | build2.add("name", a.getName()); 188 | } 189 | } 190 | build.add(a.getId(), build2); 191 | } 192 | System.out.println(build.build().toString()); 193 | } 194 | */ 195 | private void logPrint() { 196 | for (classAnalyserFrame a : this.classAnalysers) { 197 | System.out.print(" # " + a.getId() + ": " + a.getNodes().get(0).name + ", " + a.duplicates() + " duplicates"); 198 | if (a.duplicates() > 0) { 199 | System.out.print(": "); 200 | for (int i = 1; i < a.getNodes().size(); ++i) 201 | System.out.print(a.getNodes().get(i).name + ", "); 202 | } 203 | System.out.println(""); 204 | if (a.hasMethodAnalyser) { 205 | for (hook f : a.getMethodAnalyser().getHooks()) { 206 | if (f.broken) { 207 | brokenFields.add(f.getId()); 208 | System.out.println(" ~> " + f.getId() + " : Broken"); 209 | } else { 210 | if (f.getMultiplier() != 0) { 211 | if (a.getId().equals("Client")) { 212 | System.out.println(" ~> " + f.getId() + " : " + f.getOwner() + "." + f.getName() + " * " + f.getMultiplier()); 213 | } else { 214 | System.out.println(" ~> " + f.getId() + " : " + a.getNodes().get(0).name + "." + f.getName() + " * " + f.getMultiplier()); 215 | } 216 | } else { 217 | if (a.getId().equals("Client")) { 218 | System.out.println(" ~> " + f.getId() + " : " + f.getOwner() + "." + f.getName()); 219 | } else { 220 | System.out.println(" ~> " + f.getId() + " : " + a.getNodes().get(0).name + "." + f.getName()); 221 | } 222 | 223 | } 224 | } 225 | } 226 | int brokenFields = a.getMethodAnalyser().getBrokenHooks().size(); 227 | int totalFields = a.getMethodAnalyser().getNeededHooks().size(); 228 | System.out.println(" **Identified (" + (totalFields - brokenFields) + " / " + totalFields + ") Fields**"); 229 | } 230 | System.out.println(""); 231 | } 232 | if (brokenFields.size() > 0) { 233 | System.out.println("Broken Fields:"); 234 | for (String s : brokenFields) 235 | System.out.println(" ~> " + s); 236 | System.out.println(""); 237 | } else 238 | System.out.println(""); 239 | 240 | if (duplicateFieldsInt > 0) { 241 | System.out.println("Duplicate Fields:"); 242 | for (String s : duplicateFields) 243 | System.out.println(" ~> " + s); 244 | System.out.println(""); 245 | } else 246 | System.out.println(""); 247 | } 248 | 249 | private void banzaiPrint() { 250 | int length = 0; 251 | try { 252 | FileWriter write = new FileWriter("" + 253 | "C:/Users/Kyle/Banzai/Internal/hooks.py", false); 254 | PrintWriter printer = new PrintWriter(write); 255 | printer.println("ReflectionRevision = '" + eUpdater.Revision + "'\n"); 256 | for (classAnalyserFrame a : this.classAnalysers) { 257 | printer.print("# " + a.getId() + ": " + a.getNodes().get(0).name); 258 | printer.println(""); 259 | if (a.hasMethodAnalyser) { 260 | for (hook f : a.getMethodAnalyser().getHooks()) { 261 | length = (a.getId().length() + f.getId().length()); 262 | if (f.getMultiplier() != 0) { 263 | printer.print(a.getId() + "_" + f.getId() + " = "); 264 | for (int I = 0; I < 25 - length; ++I) 265 | printer.print(" "); 266 | if (a.getId().equals("Client")) 267 | printer.println("['" + f.getOwner() + "." + f.getName() + "', " + f.getMultiplier() + "]"); 268 | else 269 | printer.println("['" + f.getName() + "', " + f.getMultiplier() + "]"); 270 | 271 | } else { 272 | printer.print(a.getId() + "_" + f.getId() + " = "); 273 | for (int I = 0; I < 25 - length; ++I) 274 | printer.print(" "); 275 | if (a.getId().equals("Client")) 276 | printer.println("['" + f.getOwner() + "." + f.getName() + "', 1]"); 277 | else 278 | printer.println("['" + f.getName() + "', 1]"); 279 | 280 | 281 | } 282 | } 283 | } 284 | printer.println(""); 285 | } 286 | printer.close(); 287 | } catch (IOException e) { 288 | System.out.println(e.getStackTrace()); 289 | } 290 | } 291 | 292 | private void simbaPrint() { 293 | int length = 0; 294 | try { 295 | FileWriter write = new FileWriter("" + 296 | "C:/Simba/Includes/Reflection/lib/internal/Hooks.simba", false); 297 | PrintWriter printer = new PrintWriter(write); 298 | printer.println("const"); 299 | printer.println(" ReflectionRevision = '" + eUpdater.Revision + "';"); 300 | for (classAnalyserFrame a : this.classAnalysers) { 301 | printer.print("{" + a.getId() + ": " + a.getNodes().get(0).name + "}"); 302 | printer.println(""); 303 | if (a.hasMethodAnalyser) { 304 | for (hook f : a.getMethodAnalyser().getHooks()) { 305 | length = (a.getId().length() + f.getId().length()); 306 | if (f.getMultiplier() != 0) { 307 | printer.print(" " + a.getId() + "_" + f.getId() + ": THook = "); 308 | for (int I = 0; I < 25 - length; ++I) 309 | printer.print(" "); 310 | if (a.getId().equals("Client")) 311 | printer.println("['" + f.getOwner() + "." + f.getName() + "', " + f.getMultiplier() + "];"); 312 | else 313 | printer.println("['" + f.getName() + "', " + f.getMultiplier() + "];"); 314 | 315 | } else { 316 | printer.print(" " + a.getId() + "_" + f.getId() + ": THook = "); 317 | for (int I = 0; I < 25 - length; ++I) 318 | printer.print(" "); 319 | if (a.getId().equals("Client")) 320 | printer.println("['" + f.getOwner() + "." + f.getName() + "', 1];"); 321 | else 322 | printer.println("['" + f.getName() + "', 1];"); 323 | 324 | 325 | } 326 | } 327 | } 328 | printer.println(""); 329 | } 330 | printer.close(); 331 | } catch (IOException e) { 332 | System.out.println(e.getStackTrace()); 333 | } 334 | } 335 | 336 | public void Run() { 337 | loadClasses(); 338 | runClassAnalysers(); 339 | runMethodAnalysers(); 340 | //checkFoundFields(); 341 | if (eUpdater.findMultis) 342 | addMultis(); 343 | if (eUpdater.simbaPrint) 344 | simbaPrint(); 345 | if (eUpdater.logPrint) 346 | logPrint(); 347 | banzaiPrint(); 348 | access = this; 349 | if (eUpdater.doRefactor) 350 | refactor.run(); 351 | } 352 | } 353 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/actor.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.*; 9 | 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | import static eUpdater.misc.JarHandler.CLASSES; 14 | 15 | /** 16 | * Created by Kyle on 11/5/2015. 17 | */ 18 | public class actor extends methodAnalyserFrame { 19 | 20 | public void identify() { 21 | this.setParent("Actor", classes.myActor); 22 | this.setNeededHooks(Arrays.asList("WorldX", "WorldY", "QueueX", "QueueY", "QueueSize", 23 | "Animation", "SpokenText", "CombatCycle", "Health", "MaxHealth", "InteractingIndex")); 24 | 25 | MethodNode method; 26 | Searcher search; 27 | AbstractInsnNode[] Instructions = null; 28 | 29 | 30 | // Causes duplicates 31 | // for (classFrame c : CLASSES.values()) { 32 | // method = c.getMethod(true, "(L" + classes.myActor.getName() + ";)V"); 33 | // if (method != null) { 34 | // Instructions = method.instructions.toArray(); 35 | // search = new Searcher(method); 36 | // int L = search.find(new int[]{Opcodes.GETFIELD}, 0); 37 | // addHook(new hook("WorldX", Instructions, L)); 38 | // L = search.find(new int[]{Opcodes.GETFIELD}, 1); 39 | // addHook(new hook("WorldY", Instructions, L)); 40 | // } 41 | // } 42 | 43 | int L; 44 | out: 45 | for (classFrame c : CLASSES.values()) { 46 | List methods = c.getMethods(true, "(L" + classes.myActor.getName() + ";)V"); 47 | for (MethodNode m : methods) { 48 | if (m != null) { 49 | Instructions = m.instructions.toArray(); 50 | search = new Searcher(m); 51 | for (int I = 0; I < 1000; ++I) { 52 | L = search.find(new int[]{Opcodes.IINC}, I); 53 | if (L != -1) 54 | if ((((IincInsnNode) Instructions[L]).incr) == -2048) { 55 | L = search.find(new int[]{Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, 56 | Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.ALOAD, Opcodes.GETFIELD, 57 | Opcodes.LDC, Opcodes.IMUL, Opcodes.ICONST_1}, 0); 58 | addHook(new hook("QueueX", Instructions, L + 4)); 59 | L = search.find(new int[]{Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, 60 | Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.ALOAD, Opcodes.GETFIELD, 61 | Opcodes.LDC, Opcodes.IMUL, Opcodes.ICONST_1}, 1); 62 | addHook(new hook("QueueY", Instructions, L + 4)); 63 | addHook(new hook("QueueSize", Instructions, L + 6)); 64 | break out; 65 | } 66 | } 67 | } 68 | } 69 | } 70 | 71 | if (containsHook("QueueX")) { 72 | hook queueHook = getHook("QueueX"); 73 | for (classFrame c : CLASSES.values()) { 74 | List methods = c.getMethods(true, "(L" + classes.myActor.getName() + ";)V"); 75 | for (MethodNode m : methods) { 76 | if (m != null && (m.access & Opcodes.ACC_STATIC) != 0) { 77 | Instructions = m.instructions.toArray(); 78 | search = new Searcher(m); 79 | for (int I = 0; I < 1000; ++I) { 80 | L = search.find(new int[]{Opcodes.GETFIELD}, I); 81 | if (L != -1) { 82 | FieldInsnNode queueNode = (FieldInsnNode) Instructions[L]; 83 | if (queueNode != null && queueNode.name.equals(queueHook.getName()) 84 | && queueNode.owner.equals(queueHook.getOwner())) { 85 | int H = search.find(new int[]{Opcodes.PUTFIELD}, 0, L, L + 10); 86 | if (H != -1) { 87 | FieldInsnNode xNode = (FieldInsnNode) Instructions[H]; 88 | if (xNode != null && xNode.owner.equals(queueHook.getOwner()) 89 | && xNode.desc.equals("I")) { 90 | addHook(new hook("WorldX", Instructions, H)); 91 | } 92 | } 93 | } 94 | } 95 | } 96 | } 97 | } 98 | } 99 | } 100 | 101 | if (containsHook("QueueY")) { 102 | hook queueHook = getHook("QueueY"); 103 | for (classFrame c : CLASSES.values()) { 104 | List methods = c.getMethods(true, "(L" + classes.myActor.getName() + ";)V"); 105 | for (MethodNode m : methods) { 106 | if (m != null && (m.access & Opcodes.ACC_STATIC) != 0) { 107 | Instructions = m.instructions.toArray(); 108 | search = new Searcher(m); 109 | for (int I = 0; I < 1000; ++I) { 110 | L = search.find(new int[]{Opcodes.GETFIELD}, I); 111 | if (L != -1) { 112 | FieldInsnNode queueNode = (FieldInsnNode) Instructions[L]; 113 | if (queueNode != null && queueNode.name.equals(queueHook.getName()) 114 | && queueNode.owner.equals(queueHook.getOwner())) { 115 | int H = search.find(new int[]{Opcodes.PUTFIELD}, 0, L, L + 10); 116 | if (H != -1) { 117 | FieldInsnNode yNode = (FieldInsnNode) Instructions[H]; 118 | if (yNode != null && yNode.owner.equals(queueHook.getOwner()) 119 | && yNode.desc.equals("I")) { 120 | addHook(new hook("WorldY", Instructions, H)); 121 | } 122 | } 123 | } 124 | } 125 | } 126 | } 127 | } 128 | } 129 | } 130 | 131 | for (classFrame c : CLASSES.values()) { 132 | List methodList = c.methods; 133 | for (MethodNode m : methodList) { 134 | search = new Searcher(m); 135 | L = search.findSingleIntValue(Opcodes.SIPUSH, 13184); 136 | if (L != -1) { 137 | Instructions = m.instructions.toArray(); 138 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 25, 0); 139 | addHook(new hook("Animation", Instructions, L)); 140 | } 141 | } 142 | } 143 | 144 | 145 | /* Depreciated due to gamepack update 146 | L = 0; 147 | boolean fail = false; 148 | for (classFrame c : CLASSES.values()) { 149 | method = c.getMethod(true, "(L" + classes.myActor.getName() + ";III)V"); 150 | if (method != null) { 151 | Instructions = method.instructions.toArray(); 152 | search = new Searcher(method); 153 | for (int I = 0; L != -1; ++I) { 154 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.IFNULL}, I);//ifnull or ACONST_NULL, SEARCHER.IF 155 | if (L == -1) { 156 | if (!fail) { 157 | I = 0; 158 | fail = true; 159 | } 160 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.ACONST_NULL, Searcher.IF}, I); 161 | } 162 | if (Instructions[L + 1] instanceof FieldInsnNode && ((FieldInsnNode) Instructions[L + 1]).desc.equals("Ljava/lang/String;")) { 163 | addHook(new hook("SpokenText", Instructions, L + 1)); 164 | 165 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, 166 | Opcodes.GETSTATIC, Opcodes.LDC}, 0); 167 | addHook(new hook("CombatCycle", Instructions, L + 1)); 168 | 169 | L = search.find(new int[]{Opcodes.ILOAD, Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, 170 | Opcodes.IMUL, Opcodes.IMUL}, 0, 0); 171 | addHook(new hook("Health", Instructions, L + 2)); 172 | 173 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD}, 0, L + 5); 174 | addHook(new hook("MaxHealth", Instructions, L + 1)); 175 | 176 | L = -1; 177 | } 178 | } 179 | } 180 | } 181 | */ 182 | addHook(new hook("SpokenText", Instructions, -1)); 183 | addHook(new hook("CombatCycle", Instructions, -1)); 184 | addHook(new hook("Health", Instructions, -1)); 185 | addHook(new hook("MaxHealth", Instructions, -1)); 186 | 187 | for (classFrame c : CLASSES.values()) { 188 | L = 0; 189 | List methods = c.getMethods(true, "(L" + classes.myActor.getName() + ";)V"); 190 | for (MethodNode m : methods) { 191 | if (m != null) { 192 | Instructions = m.instructions.toArray(); 193 | search = new Searcher(m); 194 | for (int I = 0; L != -1; ++I) { 195 | L = search.find(new int[]{Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, Opcodes.LDC}, I); 196 | if (L != -1) 197 | if ((((LdcInsnNode) Instructions[L + 3]).cst.equals(32768))) { 198 | addHook(new hook("InteractingIndex", Instructions, L)); 199 | L = -1; 200 | } 201 | } 202 | } 203 | } 204 | } 205 | } 206 | } 207 | 208 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/boundaryObject.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.MethodNode; 10 | import org.objectweb.asm.tree.VarInsnNode; 11 | 12 | import java.util.Arrays; 13 | 14 | import static eUpdater.misc.JarHandler.CLASSES; 15 | 16 | /** 17 | * Created by Kyle on 11/16/2015. 18 | */ 19 | public class boundaryObject extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("BoundaryObject", classes.myBoundaryObject); 23 | this.setNeededHooks(Arrays.asList("ID", "Flags", "LocalX", "LocalY", "Plane", "Render", 24 | "Render2", "Orientation", "Height")); 25 | 26 | MethodNode method = null; 27 | for (classFrame c : CLASSES.values()) { 28 | method = c.getMethod(true, "(IIIIL" + classes.myRenderable.getName() + 29 | ";L" + classes.myRenderable.getName() + ";IIII)V"); 30 | if (method != null) 31 | break; 32 | } 33 | Searcher search = new Searcher(method); 34 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 35 | int L = 0; 36 | int S = 0; 37 | for (int I = 0; L != -1; ++I) { 38 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.ILOAD, Opcodes.LDC, Opcodes.IMUL, Opcodes.PUTFIELD}, I); 39 | if (((VarInsnNode) Instructions[L + 1]).var == 9) { 40 | S = L; 41 | L = -1; 42 | } 43 | 44 | } 45 | addHook(new hook("ID", Instructions, S + 4)); 46 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, S, 50, 1); 47 | addHook(new hook("Flags", Instructions, L)); 48 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 49 | addHook(new hook("LocalX", Instructions, L)); 50 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 51 | addHook(new hook("LocalY", Instructions, L)); 52 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 53 | addHook(new hook("Plane", Instructions, L)); 54 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 55 | addHook(new hook("Render", Instructions, L)); 56 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 57 | addHook(new hook("Render2", Instructions, L)); 58 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 59 | addHook(new hook("Orientation", Instructions, L)); 60 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 61 | addHook(new hook("Height", Instructions, L)); 62 | 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/cacheable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | import eUpdater.searchers.Searcher; 6 | import org.objectweb.asm.Opcodes; 7 | import org.objectweb.asm.tree.AbstractInsnNode; 8 | import org.objectweb.asm.tree.FieldInsnNode; 9 | import org.objectweb.asm.tree.FieldNode; 10 | import org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | /** 16 | * Created by Kyle on 10/16/2015. 17 | */ 18 | public class cacheable extends methodAnalyserFrame { 19 | 20 | public void identify() { 21 | this.setParent("Cacheable", classes.myCacheable); 22 | this.setNeededHooks(Arrays.asList("Next", "Prev")); 23 | 24 | List methodList = parentClass.methods; 25 | for (MethodNode method : methodList) { 26 | if (method.name.equals("")) 27 | continue; 28 | 29 | AbstractInsnNode[] instructions = method.instructions.toArray(); 30 | Searcher search = new Searcher(method); 31 | int L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.IFNONNULL}, 0); 32 | if (instructions[L + 1] instanceof FieldInsnNode) { 33 | addHook(new hook("Next", instructions, L + 1)); 34 | 35 | List fields = parentClass.fields; 36 | for (FieldNode field : fields) { 37 | if (field.name.contains(classes.myCacheable.getMethodAnalyser().getHook("Next").getName())) 38 | continue; 39 | addHook(new hook("Prev", field)); 40 | break; 41 | } 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/client.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.*; 9 | 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | import static eUpdater.misc.JarHandler.CLASSES; 14 | 15 | /** 16 | * Created by Kyle on 11/10/2015. 17 | */ 18 | public class client extends methodAnalyserFrame { 19 | 20 | public void identify() { 21 | this.setParent("Client", classes.myClient); 22 | this.setNeededHooks(Arrays.asList("LoopCycle", "IsMenuOpen", "MenuX", "MenuY", "MenuHeight", "MenuCount", "MenuWidth", 23 | "MenuActions", "MenuOptions", "LocalPlayers", "Region", "Plane", "DestinationY", "DestinationX", "LocalPlayer", "BaseX", 24 | "BaseY", "Widgets", "GameSettings", "CurrentLevels", "RealLevels", "Experiences", "Weight", "Energy", "CurrentWorld", 25 | "WidgetNodeCache", "TileSettings", "TileHeights", "LocalNpcs", "NpcIndices", "CrossHairColor", "MapAngle", "MapOffset", "MapScale", 26 | "Sine", "Cosine", "CameraScale", "CameraPitch", "CameraYaw", "CameraZ", "CameraY", "CameraX", "ViewportWidth", "ViewportHeight", 27 | "GroundItems", "LoginState", "PlayerIndex", "WidgetPositionX", "WidgetPositionY", "WidgetWidths", "WidgetHeights")); 28 | 29 | for (ClassNode c : CLASSES.values()) { 30 | if (c.name.equals(classes.myAnimable.getName())) { 31 | List methodList = c.methods; 32 | for (MethodNode m : methodList) { 33 | if (m.name.equals("")) { 34 | AbstractInsnNode[] Instructions = m.instructions.toArray(); 35 | Searcher search = new Searcher(m); 36 | int L = search.find(new int[]{Opcodes.IMUL, Opcodes.LDC, Opcodes.ISUB, Opcodes.PUTFIELD}, 0); 37 | L = search.find(new int[]{Opcodes.GETSTATIC}, 0, L - 3); 38 | addHook(new hook("LoopCycle", Instructions, L)); 39 | } 40 | } 41 | } 42 | } 43 | 44 | for (ClassNode c : CLASSES.values()) { 45 | List methodList = c.methods; 46 | for (MethodNode m : methodList) { 47 | if (m.desc.contains("([L" + classes.myWidget.getName() + ";IIIIII")) { 48 | AbstractInsnNode[] Instructions = m.instructions.toArray(); 49 | Searcher searcher = new Searcher(m); 50 | int L = searcher.findSingleFieldDesc(Opcodes.GETSTATIC, "[[L" + classes.myWidget.getName() + ";"); 51 | //addHook(new hook("Widgets", Instructions, L)); 52 | L = searcher.find(new int[]{Opcodes.GETSTATIC, Opcodes.ICONST_0, Opcodes.LDC, Opcodes.AASTORE}, 0); 53 | if (L != -1) 54 | addHook(new hook("MenuOptions", Instructions, L)); 55 | L = searcher.find(new int[]{Opcodes.GETSTATIC, Opcodes.ICONST_0, Opcodes.GETSTATIC, Opcodes.AASTORE}, 0); 56 | if (L != -1) 57 | addHook(new hook("MenuActions", Instructions, L)); 58 | } 59 | } 60 | } 61 | 62 | int L; 63 | AbstractInsnNode[] Instructions = null; 64 | MethodNode method = null; 65 | for (ClassNode c : CLASSES.values()) { 66 | List methodList = c.methods; 67 | for (MethodNode m : methodList) { 68 | if (!m.desc.contains("(II") || !m.desc.endsWith(")V")) 69 | continue; 70 | Searcher search = new Searcher(m); 71 | for (int I = 0; I < 100; ++I) { 72 | L = search.find(new int[]{Opcodes.IINC}, I); 73 | if (L != -1) { 74 | Instructions = m.instructions.toArray(); 75 | if (((IincInsnNode) Instructions[L]).incr == 8 && ((IincInsnNode) Instructions[L]).var == 3) { 76 | method = m; 77 | break; 78 | } 79 | } else 80 | break; 81 | } 82 | } 83 | } 84 | Searcher search = new Searcher(method); 85 | Instructions = method.instructions.toArray(); 86 | L = search.find(new int[]{Opcodes.ICONST_1, Opcodes.PUTSTATIC}, 0); 87 | if (L != -1) 88 | addHook(new hook("IsMenuOpen", Instructions, L + 1)); 89 | 90 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTSTATIC, L, 50, 1); 91 | addHook(new hook("MenuX", Instructions, L)); 92 | 93 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTSTATIC, L, 50, 1); 94 | addHook(new hook("MenuY", Instructions, L)); 95 | 96 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTSTATIC, L, 50, 1); 97 | addHook(new hook("MenuWidth", Instructions, L)); 98 | 99 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTSTATIC, L, 50, 1); 100 | addHook(new hook("MenuHeight", Instructions, L)); 101 | 102 | for (ClassNode Class : CLASSES.values()) { 103 | List methodList = Class.methods; 104 | for (MethodNode Method : methodList) { 105 | if (Method.desc.contains("(Ljava/lang/String;Ljava/lang/String;IIII")) { 106 | search = new Searcher(Method); 107 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.SIPUSH, Searcher.IF}, 0); 108 | if (L != -1) { 109 | Instructions = Method.instructions.toArray(); 110 | addHook(new hook("MenuCount", Instructions, L)); 111 | break; 112 | } 113 | } 114 | } 115 | } 116 | 117 | for (classFrame c : CLASSES.values()) { 118 | List methods = c.getMethods(false, ";)V"); 119 | for (MethodNode m : methods) { 120 | search = new Searcher(m); 121 | if (search.findSingleIntValue(Opcodes.SIPUSH, 200) != -1 && 122 | search.findSingleIntValue(Opcodes.BIPUSH, 50) != -1) 123 | method = m;//Various, m.ae Rev 98 124 | } 125 | } 126 | Instructions = method.instructions.toArray(); 127 | search = new Searcher(method); 128 | 129 | boolean found = false; 130 | for (int I = 0; I < 3; ++I) { 131 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.GETSTATIC}, I); 132 | if (((FieldInsnNode) Instructions[L]).desc.contains("[")) 133 | addHook(new hook("LocalPlayers", Instructions, L)); 134 | else { 135 | if (!found) { 136 | addHook(new hook("Region", Instructions, L)); 137 | addHook(new hook("Plane", Instructions, L + 1)); 138 | found = true; 139 | } 140 | } 141 | } 142 | 143 | L = search.find(new int[]{Opcodes.ICONST_0, Opcodes.PUTSTATIC}, 0); 144 | int S = L; 145 | for (int I = 0; I < 2; ++I) { 146 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.GETSTATIC, 147 | Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, Opcodes.BIPUSH, Opcodes.ISHR}, I); 148 | if (((FieldInsnNode) Instructions[L]).name.equals(((FieldInsnNode) Instructions[S + 1]).name)) 149 | continue; 150 | else 151 | addHook(new hook("DestinationY", Instructions, L)); 152 | addHook(new hook("DestinationX", Instructions, S + 1)); 153 | 154 | } 155 | 156 | L = search.findSingleFieldDesc(Opcodes.GETSTATIC, "L" + classes.myPlayer.getName() + ";", 0); 157 | addHook(new hook("LocalPlayer", Instructions, L)); 158 | 159 | for (classFrame c : CLASSES.values()) { 160 | List methods = c.getMethods(false, "()V"); 161 | for (MethodNode m : methods) { 162 | if (m.name.equals("")) { 163 | search = new Searcher(m); 164 | if (search.findSingleIntValue(Opcodes.SIPUSH, 2000) != -1 && 165 | !classes.myModel.getName().equals(c.name)) 166 | method = m; 167 | } 168 | } 169 | } 170 | 171 | for (classFrame c : CLASSES.values()) { 172 | List fields = c.fields; 173 | for (FieldNode f : fields) { 174 | if (f.desc.contains("[[L" + classes.myWidget.getName() + ";")) { 175 | System.out.println(c.name); 176 | addHook(new hook("Widgets", f)); 177 | } 178 | } 179 | 180 | } 181 | 182 | for (classFrame c : CLASSES.values()) { 183 | List methods = c.methods; 184 | for (MethodNode m : methods) { 185 | search = new Searcher(m); 186 | Instructions = m.instructions.toArray(); 187 | L = search.findSingleFieldDesc(Opcodes.GETSTATIC, "L" + classes.myHashTable.getName() + ";"); 188 | if (L != -1) { 189 | System.out.println(((FieldInsnNode) Instructions[L]).owner + "." + ((FieldInsnNode) Instructions[L]).name); 190 | } 191 | 192 | } 193 | } 194 | 195 | search = new Searcher(method); 196 | Instructions = method.instructions.toArray(); 197 | L = search.findSingleIntValue(Opcodes.SIPUSH, 2000); 198 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTSTATIC, L, 15, 0); 199 | addHook(new hook("GameSettings", Instructions, L)); 200 | 201 | for (classFrame c : CLASSES.values()) { 202 | List methods = c.getMethods(false, "("); 203 | for (MethodNode m : methods) { 204 | search = new Searcher(m); 205 | if (search.findSingleIntValue(Opcodes.SIPUSH, 3308) != -1 && 206 | search.findSingleIntValue(Opcodes.SIPUSH, 3305) != -1) { 207 | method = m;//am.f rev 138 208 | } 209 | } 210 | } 211 | search = new Searcher(method); 212 | Instructions = method.instructions.toArray(); 213 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3308); 214 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 15, 1); 215 | addHook(new hook("BaseX", Instructions, L)); 216 | 217 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 15, 2); 218 | addHook(new hook("BaseY", Instructions, L)); 219 | 220 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3305); 221 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 4); 222 | addHook(new hook("CurrentLevels", Instructions, L)); 223 | 224 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3306); 225 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 4); 226 | addHook(new hook("RealLevels", Instructions, L)); 227 | 228 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3307); 229 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 4); 230 | addHook(new hook("Experiences", Instructions, L)); 231 | 232 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3322); 233 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 30, 2); 234 | addHook(new hook("Weight", Instructions, L)); 235 | 236 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3321); 237 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 30, 2); 238 | addHook(new hook("Energy", Instructions, L)); 239 | 240 | L = search.findSingleIntValue(Opcodes.SIPUSH, 3318); 241 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 30, 2); 242 | addHook(new hook("CurrentWorld", Instructions, L)); 243 | 244 | 245 | for (classFrame c : CLASSES.values()) { 246 | List methods = c.getMethods(false, "("); 247 | for (MethodNode m : methods) { 248 | search = new Searcher(m); 249 | if (search.findSingleIntValue(Opcodes.SIPUSH, 2702) != -1 && 250 | search.findSingleIntValue(Opcodes.SIPUSH, 2701) != -1) { 251 | method = m;//z.c rev 138 252 | } 253 | } 254 | } 255 | search = new Searcher(method); 256 | Instructions = method.instructions.toArray(); 257 | L = search.findSingleIntValue(Opcodes.SIPUSH, 2702); 258 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 30, 2); 259 | addHook(new hook("WidgetNodeCache", Instructions, L)); 260 | 261 | out: 262 | for (classFrame c : CLASSES.values()) { 263 | List methods = c.getMethods(false, ")V"); 264 | for (MethodNode m : methods) { 265 | search = new Searcher(m); 266 | Instructions = m.instructions.toArray(); 267 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.ICONST_1, 268 | Opcodes.AALOAD}, 0); 269 | if (L != -1 && ((FieldInsnNode) Instructions[L]).desc.equals("[[[B")) { 270 | addHook(new hook("TileSettings", Instructions, L)); //TODO FIX TEH BROKE 271 | method = m; 272 | break out; 273 | } 274 | } 275 | } 276 | 277 | out: 278 | for (ClassNode Class : CLASSES.values()) { 279 | List methodList = Class.methods; 280 | for (MethodNode Method : methodList) { 281 | Instructions = Method.instructions.toArray(); 282 | search = new Searcher(Method); 283 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.ILOAD, Opcodes.AALOAD, Opcodes.ASTORE}, 0); 284 | if (L != -1) { 285 | if (((FieldInsnNode) Instructions[L]).desc.equals("[[[I")) { 286 | addHook(new hook("TileHeights", Instructions, L)); 287 | break out; 288 | } 289 | } 290 | } 291 | } 292 | 293 | for (classFrame c : CLASSES.values()) { 294 | List methods = c.getMethods(true, "(Z)V"); 295 | for (MethodNode m : methods) { 296 | search = new Searcher(m); 297 | if (search.findSingleIntValue(Opcodes.BIPUSH, 104) != -1 && 298 | search.findSingleIntValue(Opcodes.BIPUSH, 127) != -1 && m.instructions.size() < 500) 299 | method = m;// k.ai Rev 98 300 | } 301 | } 302 | 303 | search = new Searcher(method); 304 | Instructions = method.instructions.toArray(); 305 | L = search.findSingleFieldDesc(Opcodes.GETSTATIC, "[L" + classes.myNpc.getName() + ";"); 306 | addHook(new hook("LocalNpcs", Instructions, L)); 307 | L = search.findSingleFieldDesc(Opcodes.GETSTATIC, "[I", L); 308 | addHook(new hook("NpcIndices", Instructions, L)); 309 | 310 | for (classFrame c : CLASSES.values()) { 311 | List methods = c.getMethods(true, "(IIIILjava/lang/String;Ljava/lang/String;II)V"); 312 | for (MethodNode m : methods) { 313 | search = new Searcher(m); 314 | Instructions = m.instructions.toArray(); 315 | for (int I = 0; L != -1; ++I) { 316 | L = search.find(new int[]{Opcodes.ILOAD, Opcodes.BIPUSH, Opcodes.IF_ICMPNE}, I); 317 | if (L != -1 && ((IntInsnNode) Instructions[L + 1]).operand == 20) { 318 | S = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTSTATIC, L, 50, 2); 319 | addHook(new hook("CrossHairColor", Instructions, S)); 320 | L = -1; 321 | } 322 | } 323 | } 324 | } 325 | 326 | 327 | for (classFrame c : CLASSES.values()) { 328 | List methods = c.getMethods(false, "([Lfd;IIIIIIII)V"); 329 | for (MethodNode m : methods) { 330 | method = m; 331 | } 332 | } 333 | search = new Searcher(method); 334 | Instructions = method.instructions.toArray(); 335 | 336 | for (classFrame c : CLASSES.values()) { 337 | List methods = c.getMethods(false, "(IIIIL"); 338 | for (MethodNode m : methods) { 339 | search = new Searcher(m); 340 | if (search.findSingleIntValue(Opcodes.SIPUSH, 2047) != -1 && 341 | search.findSingleIntValue(Opcodes.SIPUSH, 2500) != -1) { 342 | method = m;// a.dl Rev 99, TileToMM 343 | } 344 | } 345 | } 346 | search = new Searcher(method); 347 | Instructions = method.instructions.toArray(); 348 | L = search.findSingleJump(Opcodes.IFNONNULL, Opcodes.GETSTATIC, 0, 25, 0); 349 | addHook(new hook("MapOffset", Instructions, L)); 350 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 15, 1); 351 | addHook(new hook("MapAngle", Instructions, L)); 352 | L = search.findSingleIntValue(Opcodes.SIPUSH, 256); 353 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 15, 0); 354 | addHook(new hook("MapScale", Instructions, L)); 355 | 356 | 357 | for (classFrame c : CLASSES.values()) { 358 | List methods = c.getMethods(false, "(III"); 359 | for (MethodNode m : methods) { 360 | search = new Searcher(m); 361 | if (search.findSingleIntValue(Opcodes.SIPUSH, 13056) != -1 && 362 | search.findSingleIntValue(Opcodes.SIPUSH, 128) != -1) { 363 | method = m;// client.fg Rev 99, TileToMS 364 | } 365 | } 366 | } 367 | search = new Searcher(method); 368 | Instructions = method.instructions.toArray(); 369 | for (int I = 0; I < 10; ++I) { 370 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, 371 | Opcodes.IALOAD, Opcodes.ISTORE}, I); 372 | if (L != -1 && ((VarInsnNode) Instructions[L + 5]).var == 5) { 373 | addHook(new hook("CameraPitch", Instructions, L + 1)); 374 | addHook(new hook("Sine", Instructions, L)); 375 | } 376 | if (L != -1 && ((VarInsnNode) Instructions[L + 5]).var == 7) 377 | addHook(new hook("CameraYaw", Instructions, L + 1)); 378 | if (L != -1 && ((VarInsnNode) Instructions[L + 5]).var == 6) 379 | addHook(new hook("Cosine", Instructions, L)); 380 | } 381 | for (int I = 0; I < 10; ++I) { 382 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.ISUB, Opcodes.ISTORE}, I); 383 | if (L != -1 && ((VarInsnNode) Instructions[L + 4]).var == 0) 384 | addHook(new hook("CameraX", Instructions, L)); 385 | if (L != -1 && ((VarInsnNode) Instructions[L + 4]).var == 1) 386 | addHook(new hook("CameraY", Instructions, L)); 387 | if (L != -1 && ((VarInsnNode) Instructions[L + 4]).var == 4) 388 | addHook(new hook("CameraZ", Instructions, L)); 389 | } 390 | for (int I = 0; I < 10; ++I) { 391 | L = search.find( 392 | new int[]{ 393 | Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.ICONST_2, Opcodes.IDIV, Opcodes.ILOAD, 394 | Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.IMUL, Opcodes.ILOAD, Opcodes.IDIV, 395 | Opcodes.IADD, Opcodes.LDC, Opcodes.IMUL, Opcodes.PUTSTATIC 396 | }, I); 397 | if (L != -1) { 398 | addHook(new hook("ViewportWidth", Instructions, L)); 399 | addHook(new hook("CameraScale", Instructions, L + 6)); 400 | break; 401 | } 402 | } 403 | for (int I = 0; I < 10; ++I) { 404 | L = search.find( 405 | new int[]{ 406 | Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.ILOAD, Opcodes.IMUL, Opcodes.ILOAD, 407 | Opcodes.IDIV, Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.ICONST_2, Opcodes.IDIV, 408 | Opcodes.IADD, Opcodes.IMUL, Opcodes.PUTSTATIC 409 | }, I); 410 | if (L != -1) { 411 | hook scale = getHook("CameraScale"); 412 | FieldInsnNode potential = (FieldInsnNode) Instructions[L]; 413 | if (scale != null && potential.name.equals(scale.getName()) && potential.owner.equals(scale.getOwner())) { 414 | addHook(new hook("ViewportHeight", Instructions, L + 7)); 415 | break; 416 | } 417 | } 418 | } 419 | 420 | for (classFrame c : CLASSES.values()) { 421 | if (c.getFields("[[[L" + classes.myLinkedList.getName() + ";").size() != 0) { 422 | hook temp = new hook("GroundItems", c.getFields("[[[L" + classes.myLinkedList.getName() + ";").get(0)); 423 | temp.setOwner(c.name); 424 | addHook(temp); 425 | } 426 | } 427 | 428 | for (classFrame c : CLASSES.values()) { 429 | List methods = c.getMethods(true, "(L" + classes.myGameShell.getName() + ";)V"); 430 | for (MethodNode m : methods) { 431 | search = new Searcher(m); 432 | if (search.findSingleIntValue(Opcodes.BIPUSH, 75) != -1) { 433 | L = 0; 434 | for (int I = 0; L != -1; ++I) { 435 | search = new Searcher(m); // y.f Rev 98 436 | Instructions = m.instructions.toArray(); 437 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL, Opcodes.BIPUSH, Searcher.IF}, I); 438 | if (((IntInsnNode) Instructions[L + 3]).operand == 11) { 439 | addHook(new hook("LoginState", Instructions, L)); 440 | L = -1; 441 | } 442 | } 443 | } 444 | } 445 | } 446 | 447 | for (classFrame c : CLASSES.values()) { 448 | List methods = c.getMethods(false, "(L"); 449 | for (MethodNode m : methods) { 450 | search = new Searcher(m); 451 | if (search.findSingleIntValue(Opcodes.SIPUSH, 2048) != -1 && 452 | search.findSingleIntValue(Opcodes.BIPUSH, 28) != -1) { 453 | search = new Searcher(m); // j.z Rev 98 454 | Instructions = m.instructions.toArray(); 455 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, 0, 10, 0); 456 | if (L != -1) //TODO Fix 457 | addHook(new hook("PlayerIndex", Instructions, L)); 458 | } 459 | } 460 | } 461 | 462 | for (classFrame c : CLASSES.values()) { 463 | MethodNode method1 = c.getMethod(true, "([L" + classes.myWidget.getName() + ";IIIIIIII)V"); 464 | if (method1 != null) 465 | method = method1; 466 | } 467 | search = new Searcher(method); 468 | Instructions = method.instructions.toArray(); 469 | for (int I = 0; I < 10; ++I) { 470 | L = search.find(new int[]{Opcodes.ILOAD, Opcodes.ICONST_M1, Opcodes.IF_ICMPNE}, I); 471 | if (L != -1) { 472 | if (((VarInsnNode) Instructions[L]).var == 8) { 473 | S = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 0); 474 | if (S != -1) 475 | addHook(new hook("WidgetPositionX", Instructions, S)); 476 | S = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 2); 477 | if (S != -1) 478 | addHook(new hook("WidgetPositionY", Instructions, S)); 479 | S = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 4); 480 | if (S != -1) 481 | addHook(new hook("WidgetWidths", Instructions, S)); 482 | S = search.findSingleJump(Opcodes.GOTO, Opcodes.GETSTATIC, L, 50, 6); 483 | if (S != -1) 484 | addHook(new hook("WidgetHeights", Instructions, S)); 485 | } 486 | } 487 | } 488 | } 489 | 490 | } -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/floorDecoration.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.MethodNode; 10 | import org.objectweb.asm.tree.VarInsnNode; 11 | 12 | import java.util.Arrays; 13 | 14 | import static eUpdater.misc.JarHandler.CLASSES; 15 | 16 | /** 17 | * Created by Kyle on 11/16/2015. 18 | */ 19 | public class floorDecoration extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("GameObject", classes.myGameObject); 23 | this.setNeededHooks(Arrays.asList("ID", "Flags", "Plane", "Render", "LocalX", "LocalY")); 24 | 25 | MethodNode method = null; 26 | for (classFrame c : CLASSES.values()) { 27 | method = c.getMethod(true, "(IIIIL" + classes.myRenderable.getName() + ";II)V"); 28 | if (method != null) 29 | break; 30 | } 31 | Searcher search = new Searcher(method); 32 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 33 | int L = 0; 34 | int S = 0; 35 | for (int I = 0; L != -1; ++I) { 36 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.ALOAD, Opcodes.PUTFIELD}, I); 37 | if (((VarInsnNode) Instructions[L]).var == 8 && ((VarInsnNode) Instructions[L + 1]).var == 5) { 38 | S = L; 39 | L = -1; 40 | } 41 | 42 | } 43 | addHook(new hook("Render", Instructions, S + 2)); 44 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, S, 50, 1); 45 | addHook(new hook("LocalX", Instructions, L)); 46 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 47 | addHook(new hook("LocalY", Instructions, L)); 48 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 49 | addHook(new hook("Plane", Instructions, L)); 50 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 51 | addHook(new hook("ID", Instructions, L)); 52 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 53 | addHook(new hook("Flags", Instructions, L)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/gameObject.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.MethodNode; 10 | import org.objectweb.asm.tree.VarInsnNode; 11 | 12 | import java.util.Arrays; 13 | 14 | import static eUpdater.misc.JarHandler.CLASSES; 15 | 16 | /** 17 | * Created by Kyle on 11/16/2015. 18 | */ 19 | public class gameObject extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("GameObject", classes.myGameObject); 23 | this.setNeededHooks(Arrays.asList("ID", "Flags", "Plane", "WorldX", "WorldY", "Height", 24 | "Render", "Orientation", "LocalX", "LocalY", "OffsetX", "OffsetY")); 25 | 26 | MethodNode method = null; 27 | for (classFrame c : CLASSES.values()) { 28 | method = c.getMethod(true, "(IIIIIIIIL" + classes.myRenderable.getName() + ";IZII)Z"); 29 | if (method != null) 30 | break; 31 | } 32 | Searcher search = new Searcher(method); 33 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 34 | int L = 0; 35 | int S = 0; 36 | for (int I = 0; L != -1; ++I) { 37 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.ILOAD, Opcodes.LDC, Opcodes.IMUL, Opcodes.PUTFIELD}, I); 38 | if (((VarInsnNode) Instructions[L + 1]).var == 12) { 39 | S = L; 40 | L = -1; 41 | } 42 | 43 | } 44 | addHook(new hook("ID", Instructions, S + 4)); 45 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, S, 50, 1); 46 | addHook(new hook("Flags", Instructions, L)); 47 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 48 | addHook(new hook("Plane", Instructions, L)); 49 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 50 | addHook(new hook("WorldX", Instructions, L)); 51 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 52 | addHook(new hook("WorldY", Instructions, L)); 53 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 54 | addHook(new hook("Height", Instructions, L)); 55 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 56 | addHook(new hook("Render", Instructions, L)); 57 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 58 | addHook(new hook("Orientation", Instructions, L)); 59 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 60 | addHook(new hook("LocalX", Instructions, L)); 61 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 62 | addHook(new hook("LocalY", Instructions, L)); 63 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 64 | addHook(new hook("OffsetX", Instructions, L)); 65 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 66 | addHook(new hook("OffsetY", Instructions, L)); 67 | 68 | 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/hashTable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | import eUpdater.searchers.Searcher; 6 | import org.objectweb.asm.Opcodes; 7 | import org.objectweb.asm.tree.AbstractInsnNode; 8 | import org.objectweb.asm.tree.FieldInsnNode; 9 | import org.objectweb.asm.tree.FieldNode; 10 | import org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | 16 | /** 17 | * Created by Kyle on 11/10/2015. 18 | */ 19 | public class hashTable extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("HashTable", classes.myHashTable); 23 | this.setNeededHooks(Arrays.asList("Buckets", "Size", "Index")); 24 | 25 | addHook(new hook("Buckets", parentClass.getFields("[L" + classes.myNode.getName() + ";").get(0))); 26 | 27 | List methodList = parentClass.methods; 28 | for (MethodNode m : methodList) { 29 | Searcher Search = new Searcher(m); 30 | int L = Search.find(new int[]{Opcodes.GETFIELD}, 0); 31 | if (L != -1) { 32 | AbstractInsnNode[] Instructions = m.instructions.toArray(); 33 | if (((FieldInsnNode) Instructions[L]).name.equals(methods.myHashTable.getHook("Buckets").getName())) { 34 | L = Search.find(new int[]{Opcodes.GETFIELD}, 0, L + 1); 35 | if (L != -1 && ((FieldInsnNode) Instructions[L]).desc.equals("I")) { 36 | addHook(new hook("Size", Instructions, L)); 37 | break; 38 | } 39 | } 40 | } 41 | } 42 | 43 | List fs = parentClass.getFields("I"); 44 | for (FieldNode f : fs) { 45 | if (!f.name.equals(methods.myHashTable.getHook("Size").getName())) 46 | addHook(new hook("Index", f)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/item.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.FieldInsnNode; 10 | import org.objectweb.asm.tree.MethodNode; 11 | import org.objectweb.asm.tree.VarInsnNode; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | import static eUpdater.misc.JarHandler.CLASSES; 17 | 18 | /** 19 | * Created by Kyle on 11/16/2015. 20 | */ 21 | public class item extends methodAnalyserFrame { 22 | 23 | public void identify() { 24 | this.setParent("Item", classes.myItem); 25 | this.setNeededHooks(Arrays.asList("ID", "StackSizes")); 26 | 27 | MethodNode method = null; 28 | for (classFrame c : CLASSES.values()) { 29 | List methods = c.getMethods(true, "(II)V"); 30 | for (MethodNode m : methods) { 31 | Searcher search = new Searcher(m); 32 | if (search.findSingleLdcValue(Opcodes.LDC, (long) -99999999) != -1) 33 | method = m; 34 | 35 | } 36 | } 37 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 38 | Searcher search = new Searcher(method); 39 | hook temp1 = new hook(), temp2 = new hook(); 40 | boolean run = false; 41 | int L = 0; 42 | for (int I = 0; L != -1; ++I) { 43 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL}, I); 44 | if (L != -1 && ((VarInsnNode) Instructions[L]).var == 7) { 45 | if (run && !((FieldInsnNode) Instructions[L + 1]).name.equals(temp1.getName())) 46 | temp2 = new hook("ID", Instructions, L + 1); 47 | else 48 | temp1 = new hook("StackSizes", Instructions, L + 1); 49 | run = true; 50 | } 51 | 52 | } 53 | addHook(temp1); 54 | addHook(temp2); 55 | 56 | 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/linkedList.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | import eUpdater.searchers.FieldSearcher; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | import java.util.Arrays; 9 | 10 | 11 | /** 12 | * Created by Kyle on 11/5/2015. 13 | */ 14 | public class linkedList extends methodAnalyserFrame { 15 | 16 | public void identify() { 17 | this.setParent("LinkedList", classes.myLinkedList); 18 | this.setNeededHooks(Arrays.asList("Head", "Current")); 19 | 20 | FieldSearcher FSearch = new FieldSearcher(parentClass); 21 | addHook(new hook("Head", FSearch.findAccess(Opcodes.ACC_PUBLIC))); 22 | addHook(new hook("Current", FSearch.findAccess(0))); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/methodAnalyserFrame.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.analysers.classes.classAnalyserFrame; 4 | import eUpdater.frame.classFrame; 5 | import eUpdater.frame.hook; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by Kyle on 7/26/2015. 12 | */ 13 | public abstract class methodAnalyserFrame { 14 | classFrame parentClass; 15 | private ArrayList fields = new ArrayList<>(); 16 | private List neededFields; 17 | 18 | public abstract void identify(); 19 | 20 | public void setParent(String s, classAnalyserFrame _parentClass) { 21 | 22 | this.parentClass = _parentClass.getNodes().get(0); 23 | } 24 | 25 | public classFrame getParent() { 26 | return parentClass; 27 | } 28 | 29 | public void setNeededHooks(List s) { 30 | neededFields = s; 31 | } 32 | 33 | public ArrayList getHooks() { 34 | return this.fields; 35 | } 36 | 37 | public hook getHook(String id) { 38 | ArrayList fs = this.getHooks(); 39 | for (hook f : fs) { 40 | if (f.getId().equals(id)) 41 | return f; 42 | } 43 | return null; 44 | } 45 | 46 | public boolean containsHook(String s) { 47 | ArrayList ours = this.fields; 48 | for (hook ourField : ours) 49 | if (ourField.getId().equals(s)) { 50 | return true; 51 | } 52 | return false; 53 | } 54 | 55 | private boolean duplicateHook(hook h) { 56 | ArrayList ours = this.fields; 57 | for (hook ourField : ours) 58 | if (ourField.getId().equals(h.getId()) && !ourField.getName().equals(h.getName())) { 59 | ourField.setDuplicate(true); 60 | return true; 61 | } 62 | return false; 63 | } 64 | 65 | public List getNeededHooks() { 66 | return neededFields; 67 | } 68 | 69 | public void addHook(hook f) { 70 | if (!this.containsHook(f.getId())) { 71 | this.fields.add(f); 72 | duplicateHook(f); 73 | } 74 | 75 | } 76 | 77 | public ArrayList getBrokenHooks() { 78 | ArrayList temp = new ArrayList<>(); 79 | for (String f : this.getNeededHooks()) { 80 | if (!this.containsHook(f)) { 81 | temp.add(this.getHook(f)); 82 | } 83 | } 84 | for (hook f : this.getHooks()) { 85 | if (f.getName().equals("NULL")) 86 | temp.add(f); 87 | } 88 | return temp; 89 | } 90 | 91 | public ArrayList getDuplicateHooks() { 92 | ArrayList temp = new ArrayList<>(); 93 | for (String f : this.getNeededHooks()) { 94 | if (!this.containsHook(f)) { 95 | temp.add(this.getHook(f)); 96 | } 97 | } 98 | for (hook f : this.getHooks()) { 99 | if (f.getName().equals("NULL")) 100 | temp.add(f); 101 | } 102 | return temp; 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/methods.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | /** 4 | * Created by Kyle on 8/25/2015. 5 | */ 6 | public class methods { 7 | 8 | public static nnode myNode = new nnode(); 9 | public static cacheable myCacheable = new cacheable(); 10 | public static renderable myRenderable = new renderable(); 11 | public static npcDefinition myNpcDefinition = new npcDefinition(); 12 | public static linkedList myLinkedList = new linkedList(); 13 | public static actor myActor = new actor(); 14 | public static npc myNpc = new npc(); 15 | public static objectDefinition myObjectDefinition = new objectDefinition(); 16 | public static widget myWidget = new widget(); 17 | public static widgetNode myWidgetNode = new widgetNode(); 18 | public static hashTable myHashTable = new hashTable(); 19 | public static player myPlayer = new player(); 20 | public static client myClient = new client(); 21 | public static region myRegion = new region(); 22 | public static boundaryObject myBoundaryObject = new boundaryObject(); 23 | public static gameObject myGameObject = new gameObject(); 24 | public static floorDecoration myFloorDecoration = new floorDecoration(); 25 | public static wallDecoration myWallDecoration = new wallDecoration(); 26 | public static sceneTile mySceneTile = new sceneTile(); 27 | public static item myItem = new item(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/nnode.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | import eUpdater.searchers.FieldSearcher; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.MethodNode; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | /** 15 | * Created by Kyle on 7/27/2015. 16 | */ 17 | public class nnode extends methodAnalyserFrame { 18 | 19 | public void identify() { 20 | setParent("Node", classes.myNode); 21 | this.setNeededHooks(Arrays.asList("Next", "Prev", "UID")); 22 | 23 | List methodList = parentClass.methods; 24 | for (MethodNode m : methodList) { 25 | if (m.instructions.size() < 11) { 26 | AbstractInsnNode[] Instructions = m.instructions.toArray(); 27 | Searcher search = new Searcher(m); 28 | int L = search.findSingle(Opcodes.GETFIELD, 0); 29 | if (L != -1) 30 | addHook(new hook("Prev", Instructions, L)); 31 | } 32 | } 33 | FieldSearcher fs = new FieldSearcher(parentClass); 34 | addHook(new hook("UID", fs.findDesc("J"))); 35 | 36 | for (int I = 0; I < 3; ++I) { 37 | if (getHook("Prev").getName().equals(fs.findDescInstance(String.format("L%s;", parentClass.name), I).name)) 38 | continue; 39 | addHook(new hook("Next", fs.findDescInstance(String.format("L%s;", parentClass.name), I))); 40 | break; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/npc.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.FieldInsnNode; 10 | import org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.util.Collections; 13 | 14 | import static eUpdater.misc.JarHandler.CLASSES; 15 | 16 | /** 17 | * Created by Kyle on 11/9/2015. 18 | */ 19 | public class npc extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("Npc", classes.myNpc); 23 | this.setNeededHooks(Collections.singletonList("Definition")); 24 | 25 | int L = 0; 26 | for (classFrame c : CLASSES.values()) { 27 | MethodNode method = c.getMethod(true, "(IIIILjava/lang/String;Ljava/lang/String;II)V"); 28 | if (method != null) { 29 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 30 | Searcher search = new Searcher(method); 31 | for (int I = 0; L != -1; ++I) { 32 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.ASTORE}, I); 33 | if (L != -1) 34 | if ((((FieldInsnNode) Instructions[L + 1]).desc.equals("L" + classes.myNpcDefinition.getName() + ";"))) 35 | addHook(new hook("Definition", Instructions, L + 1)); 36 | } 37 | } 38 | } 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/npcDefinition.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.FieldSearcher; 7 | import eUpdater.searchers.Searcher; 8 | import org.objectweb.asm.Opcodes; 9 | import org.objectweb.asm.tree.AbstractInsnNode; 10 | import org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.util.Arrays; 13 | 14 | import static eUpdater.misc.JarHandler.CLASSES; 15 | 16 | /** 17 | * Created by Kyle on 10/16/2015. 18 | */ 19 | public class npcDefinition extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("NpcDefinition", classes.myNpcDefinition); 23 | this.setNeededHooks(Arrays.asList("Actions", "Name", "ID", "CombatLevel")); 24 | 25 | FieldSearcher fs = new FieldSearcher(parentClass); 26 | addHook(new hook("Actions", fs.findDesc("[Ljava/lang/String;"))); 27 | addHook(new hook("Name", fs.findDesc("Ljava/lang/String;"))); 28 | 29 | MethodNode method = parentClass.getMethod(false, classes.myAnimationSequence.getName() + ";IL" + 30 | classes.myAnimationSequence.getName()); 31 | 32 | Searcher search = new Searcher(method); 33 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 34 | int L = search.find(new int[]{Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, Opcodes.I2L}, 0); 35 | if (L != -1) 36 | addHook(new hook("ID", Instructions, L)); 37 | 38 | for (classFrame c : CLASSES.values()) { 39 | method = c.getMethod(false, "L" + classes.myNpcDefinition.getName() + ";III"); 40 | if (method == null) 41 | continue; 42 | search = new Searcher(method); 43 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL, 44 | Opcodes.GETSTATIC, Opcodes.GETFIELD}, 0); 45 | Instructions = method.instructions.toArray(); 46 | if (L != -1) 47 | addHook(new hook("CombatLevel", Instructions, L + 1)); 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/objectDefinition.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | 6 | import java.util.Arrays; 7 | 8 | 9 | /** 10 | * Created by Kyle on 11/9/2015. 11 | */ 12 | public class objectDefinition extends methodAnalyserFrame { 13 | 14 | public void identify() { 15 | this.setParent("ObjectDefinition", classes.myObjectDefinition); 16 | this.setNeededHooks(Arrays.asList("Actions", "Name")); 17 | 18 | addHook(new hook("Actions", parentClass.getFields("[Ljava/lang/String;").get(0))); 19 | addHook(new hook("Name", parentClass.getFields("Ljava/lang/String;").get(0))); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/player.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.MethodNode; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | import static eUpdater.misc.JarHandler.CLASSES; 15 | 16 | /** 17 | * Created by Kyle on 11/10/2015. 18 | */ 19 | public class player extends methodAnalyserFrame { 20 | 21 | public void identify() { 22 | this.setParent("Player", classes.myPlayer); 23 | this.setNeededHooks(Arrays.asList("Name", "Definition", "CombatLevel")); 24 | 25 | addHook(new hook("Name", parentClass.getFields("Ljava/lang/String;").get(0))); 26 | 27 | List methods = parentClass.getMethods(false, "L" + classes.myModel.getName() + ";"); 28 | for (MethodNode m : methods) { 29 | Searcher search = new Searcher(m); 30 | AbstractInsnNode[] instruction = m.instructions.toArray(); 31 | int L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.ALOAD}, 0); 32 | if (L != -1) { 33 | addHook(new hook("Definition", instruction, L + 1)); 34 | break; 35 | } 36 | } 37 | 38 | for (classFrame c : CLASSES.values()) { 39 | methods = c.getMethods(true, "(L" + classes.myWidget.getName() + ";I)I"); 40 | for (MethodNode m : methods) { 41 | Searcher search = new Searcher(m); 42 | if (search.findSingleIntValue(Opcodes.BIPUSH, 100) != -1) { 43 | AbstractInsnNode[] Instructions = m.instructions.toArray(); 44 | int L = search.findSingleIntValue(Opcodes.BIPUSH, 8); 45 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.GETFIELD, L, 10, 0); 46 | addHook(new hook("CombatLevel", Instructions, L)); 47 | 48 | } 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/region.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | 6 | import java.util.Arrays; 7 | 8 | /** 9 | * Created by Kyle on 11/16/2015. 10 | */ 11 | public class region extends methodAnalyserFrame { 12 | 13 | public void identify() { 14 | this.setParent("Region", classes.myRegion); 15 | this.setNeededHooks(Arrays.asList("SceneTiles")); 16 | 17 | addHook(new hook("SceneTiles", this.parentClass.getFields("[[[L" + classes.mySceneTile.getName() + ";").get(0))); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/renderable.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | import eUpdater.searchers.FieldSearcher; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.MethodNode; 9 | 10 | import java.util.Arrays; 11 | import java.util.List; 12 | 13 | /** 14 | * Created by Kyle on 10/16/2015. 15 | */ 16 | public class renderable extends methodAnalyserFrame { 17 | 18 | public void identify() { 19 | this.setParent("Renderable", classes.myRenderable); 20 | this.setNeededHooks(Arrays.asList("ModelHeight")); 21 | 22 | List methodList = parentClass.methods; 23 | for (MethodNode method : methodList) { 24 | if (method.desc.contains("(IIIIIIII")) { 25 | Searcher Search = new Searcher(method); 26 | int L = Search.find(new int[]{Opcodes.ALOAD, Opcodes.ILOAD, Opcodes.ILOAD, Opcodes.ILOAD, Opcodes.ILOAD, Opcodes.ILOAD}, 0); 27 | if (L > 0) { 28 | FieldSearcher fs = new FieldSearcher(parentClass); 29 | Searcher search = new Searcher(method); 30 | addHook(new hook("ModelHeight", fs.findAccess(1))); 31 | } 32 | } 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/sceneTile.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.hook; 4 | import eUpdater.misc.classes; 5 | 6 | import java.util.Arrays; 7 | 8 | /** 9 | * Created by Kyle on 11/16/2015. 10 | */ 11 | public class sceneTile extends methodAnalyserFrame { 12 | 13 | public void identify() { 14 | this.setParent("SceneTile", classes.mySceneTile); 15 | this.setNeededHooks(Arrays.asList("GameObject", "BoundaryObject", "WallDecoration", 16 | "GroundDecoration")); 17 | addHook(new hook("GameObject", parentClass.getFields("[L" + classes.myGameObject.getName() + ";").get(0))); 18 | addHook(new hook("BoundaryObject", parentClass.getFields("L" + classes.myBoundaryObject.getName() + ";").get(0))); 19 | addHook(new hook("WallDecoration", parentClass.getFields("L" + classes.myWallDecoration.getName() + ";").get(0))); 20 | addHook(new hook("GroundDecoration", parentClass.getFields("L" + classes.myFloorDecoration.getName() + ";").get(0))); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/wallDecoration.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.MethodNode; 10 | 11 | import java.util.Arrays; 12 | 13 | import static eUpdater.misc.JarHandler.CLASSES; 14 | 15 | /** 16 | * Created by Kyle on 11/16/2015. 17 | */ 18 | public class wallDecoration extends methodAnalyserFrame { 19 | 20 | public void identify() { 21 | this.setParent("GameObject", classes.myGameObject); 22 | this.setNeededHooks(Arrays.asList("ID", "Flags", "LocalX", "LocalY", "Plane", "Renderable", 23 | "Renderable2", "Orientation", "Height", "RelativeX", "RelativeY")); 24 | 25 | MethodNode method = null; 26 | for (classFrame c : CLASSES.values()) { 27 | method = c.getMethod(true, "(IIIIL" + classes.myRenderable.getName() + 28 | ";L" + classes.myRenderable.getName() + ";IIIIII)V"); 29 | if (method != null) 30 | break; 31 | } 32 | Searcher search = new Searcher(method); 33 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 34 | int L = 0; 35 | L = search.find(new int[]{Opcodes.NEW, Opcodes.DUP, Opcodes.INVOKESPECIAL}, 0); 36 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 0); 37 | addHook(new hook("ID", Instructions, L)); 38 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 39 | addHook(new hook("Flags", Instructions, L)); 40 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 41 | addHook(new hook("LocalX", Instructions, L)); 42 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 43 | addHook(new hook("LocalY", Instructions, L)); 44 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 45 | addHook(new hook("Plane", Instructions, L)); 46 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 47 | addHook(new hook("Renderable", Instructions, L)); 48 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 49 | addHook(new hook("Renderable2", Instructions, L)); 50 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 51 | addHook(new hook("Orientation", Instructions, L)); 52 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 53 | addHook(new hook("Height", Instructions, L)); 54 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 55 | addHook(new hook("RelativeX", Instructions, L)); 56 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L, 50, 1); 57 | addHook(new hook("RelativeY", Instructions, L)); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/widget.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | import eUpdater.frame.classFrame; 4 | import eUpdater.frame.hook; 5 | import eUpdater.misc.classes; 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.FieldInsnNode; 10 | import org.objectweb.asm.tree.IntInsnNode; 11 | import org.objectweb.asm.tree.MethodNode; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | import static eUpdater.misc.JarHandler.CLASSES; 17 | 18 | /** 19 | * Created by Kyle on 11/9/2015. 20 | */ 21 | public class widget extends methodAnalyserFrame { 22 | 23 | public void identify() { 24 | this.setParent("Widget", classes.myWidget); 25 | this.setNeededHooks(Arrays.asList("Children", "ItemID", "ItemAmount", "WidgetID", "Name", "Text", "IsHidden", 26 | "AbsoluteY", "AbsoluteX", "RelativeX", "RelativeY", "Width", "Height", "ParentID", "ScrollY", "ScrollX", 27 | "InvIDs", "BoundsIndex", "StackSizes", "TextureID", "Parent")); 28 | 29 | addHook(new hook("Children", parentClass.getFields("[L" + classes.myWidget.getName() + ";").get(0))); 30 | 31 | MethodNode method = null; 32 | for (classFrame c : CLASSES.values()) { 33 | List methodList = c.methods; 34 | for (MethodNode m : methodList) { 35 | if (c.name.equals(classes.myWidget.getName()) && m.name.equals("")) 36 | method = m; 37 | } 38 | } 39 | 40 | AbstractInsnNode[] Instructions = method.instructions.toArray(); 41 | int L; 42 | Searcher search = new Searcher(method); 43 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, 0, 10, 1); 44 | addHook(new hook("WidgetID", Instructions, L)); 45 | 46 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 11); 47 | addHook(new hook("AbsoluteX", Instructions, L)); 48 | 49 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 50 | addHook(new hook("AbsoluteY", Instructions, L)); 51 | 52 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 53 | addHook(new hook("Width", Instructions, L)); 54 | 55 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 56 | addHook(new hook("Height", Instructions, L)); 57 | 58 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 2); 59 | addHook(new hook("ParentID", Instructions, L)); 60 | 61 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 62 | addHook(new hook("IsHidden", Instructions, L)); 63 | 64 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 65 | addHook(new hook("RelativeX", Instructions, L)); 66 | 67 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 68 | addHook(new hook("RelativeY", Instructions, L)); 69 | 70 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 12); 71 | addHook(new hook("TextureID", Instructions, L)); 72 | 73 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 150, 22); 74 | addHook(new hook("Text", Instructions, L)); 75 | 76 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 8); 77 | addHook(new hook("Name", Instructions, L)); 78 | 79 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 80 | addHook(new hook("Parent", Instructions, L)); 81 | 82 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 8); 83 | addHook(new hook("ItemID", Instructions, L)); 84 | 85 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 0); 86 | addHook(new hook("ItemAmount", Instructions, L)); 87 | 88 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, L + 1, 50, 8); 89 | addHook(new hook("BoundsIndex", Instructions, L)); 90 | 91 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, 0, 200, 21); 92 | addHook(new hook("ScrollX", Instructions, L)); 93 | 94 | L = search.findSingleJump(Opcodes.GOTO, Opcodes.PUTFIELD, 0, 200, 22); 95 | addHook(new hook("ScrollY", Instructions, L)); 96 | 97 | for (classFrame c : CLASSES.values()) { 98 | method = c.getMethod(true, "([L" + classes.myWidget.getName() + ";IIIIIIII)V"); 99 | if (method != null) { 100 | search = new Searcher(method); 101 | Instructions = method.instructions.toArray(); 102 | break; 103 | } 104 | } 105 | 106 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.ILOAD, Opcodes.IALOAD, 107 | Opcodes.ICONST_1, Opcodes.ISUB}, 0); 108 | if (L != -1) 109 | addHook(new hook("InvIDs", Instructions, L + 1)); 110 | 111 | for (int I = 0; L != -1; ++I) { 112 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, 113 | Opcodes.IMUL, Opcodes.ICONST_1}, I); 114 | 115 | if (((FieldInsnNode) Instructions[L]).desc.equals("[Z")) { 116 | addHook(new hook("BoundsIndex", Instructions, L + 2)); 117 | L = -1; 118 | } 119 | } 120 | 121 | List methodList = parentClass.methods; 122 | for (MethodNode Method : methodList) { 123 | if (!Method.desc.contains("(II") || !Method.desc.contains("V")) 124 | continue; 125 | Searcher Search = new Searcher(Method); 126 | for (int I = 0; I < 10; ++I) { 127 | L = Search.findSingle(Opcodes.GETFIELD, I); 128 | if (L != -1) { 129 | AbstractInsnNode[] instructions = Method.instructions.toArray(); 130 | if (!((FieldInsnNode) instructions[L]).name.contains(classes.myWidget.getMethodAnalyser().getHook("InvIDs").getName())) { 131 | addHook(new hook("StackSizes", instructions, L)); 132 | break; 133 | } 134 | } 135 | } 136 | } 137 | 138 | 139 | } 140 | } 141 | 142 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/analysers/methods/widgetNode.java: -------------------------------------------------------------------------------- 1 | package eUpdater.analysers.methods; 2 | 3 | /** 4 | * Created by Kyle on 11/10/2015. 5 | */ 6 | 7 | import eUpdater.frame.classFrame; 8 | import eUpdater.frame.hook; 9 | import eUpdater.misc.classes; 10 | import eUpdater.searchers.Searcher; 11 | import org.objectweb.asm.Opcodes; 12 | import org.objectweb.asm.tree.AbstractInsnNode; 13 | import org.objectweb.asm.tree.FieldInsnNode; 14 | import org.objectweb.asm.tree.MethodNode; 15 | import org.objectweb.asm.tree.VarInsnNode; 16 | 17 | import java.util.Collections; 18 | import java.util.List; 19 | 20 | import static eUpdater.misc.JarHandler.CLASSES; 21 | 22 | /** 23 | * Created by Kyle on 11/5/2015. 24 | */ 25 | public class widgetNode extends methodAnalyserFrame { 26 | 27 | public void identify() { 28 | this.setParent("WidgetNode", classes.myWidgetNode); 29 | this.setNeededHooks(Collections.singletonList("Id")); 30 | out: 31 | for (classFrame c : CLASSES.values()) { 32 | List methods = c.getMethods(true, "([L" + classes.myWidget.getName() + ";I)V"); 33 | for (MethodNode m : methods) { 34 | if (m != null) { 35 | int L = 0; 36 | for (int I = 0; L != -1; ++I) { 37 | Searcher search = new Searcher(m); 38 | AbstractInsnNode[] Instructions = m.instructions.toArray(); 39 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL}, I); 40 | if (L != -1 && ((VarInsnNode) m.instructions.get(L)).var == 5 && ((FieldInsnNode) m.instructions.get(L + 1)).owner.equals(classes.myWidgetNode.getName())) { 41 | addHook(new hook("Id", Instructions, L + 1)); 42 | break out; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/DeobFrame.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | 3 | /** 4 | * Created by Kyle on 1/12/2015. 5 | */ 6 | 7 | public abstract class DeobFrame { 8 | public abstract int Deob(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/Deobsfucate.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | /** 3 | * Created by Kyle on 1/12/2015. 4 | */ 5 | 6 | import eUpdater.misc.Misc; 7 | 8 | import java.util.ArrayList; 9 | 10 | public class Deobsfucate { 11 | private ArrayList Deobs = new ArrayList(); 12 | 13 | private void loadDeobs() { 14 | this.Deobs.add(new Method()); 15 | this.Deobs.add(new Multipliers()); 16 | this.Deobs.add(new EqualSwap()); 17 | this.Deobs.add(new RemoveExceptions()); 18 | this.Deobs.add(new OpaquePredicates()); 19 | this.Deobs.add(new MethodName()); 20 | } 21 | 22 | 23 | private void runAnalysers() { 24 | double totalTime = 0; 25 | for (DeobFrame tempDeob : this.Deobs) { 26 | long startTime = System.nanoTime(); 27 | tempDeob.Deob(); 28 | long endTime = System.nanoTime(); 29 | double tempTime = (endTime - startTime) / 1e6; 30 | System.out.println(" (" + Misc.round(tempTime, 2) + " ms)"); 31 | totalTime = totalTime + tempTime; 32 | } 33 | System.out.println("Total Deob took " + Misc.round(totalTime, 2) + " ms"); 34 | } 35 | 36 | public void Run() { 37 | System.out.println("Beginning Deob.."); 38 | this.loadDeobs(); 39 | this.runAnalysers(); 40 | System.out.println("Deob Finished..\n"); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/Method.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | /** 3 | * Created by Kyle on 1/12/2015. 4 | */ 5 | 6 | import org.objectweb.asm.ClassReader; 7 | import org.objectweb.asm.tree.AbstractInsnNode; 8 | import org.objectweb.asm.tree.ClassNode; 9 | import org.objectweb.asm.tree.MethodInsnNode; 10 | import org.objectweb.asm.tree.MethodNode; 11 | 12 | import java.lang.reflect.Modifier; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import static eUpdater.misc.JarHandler.CLASSES; 17 | 18 | public final class Method extends DeobFrame { 19 | 20 | static ArrayList totalMethods = new ArrayList(); 21 | static ArrayList goodMethods = new ArrayList(); 22 | 23 | private static void getInterfaces(ClassNode Class) { 24 | if (Class.interfaces.size() > 0) { 25 | List Interfaces = Class.interfaces; 26 | for (String Interface : Interfaces) { 27 | ClassNode interfaceClass; 28 | interfaceClass = new ClassNode(); 29 | if (!Interface.contains("java")) 30 | interfaceClass = CLASSES.get(Interface); 31 | List Methods = interfaceClass.methods; 32 | for (MethodNode Method : Methods) 33 | Add(new MethodInfo(Class.name, Method.name, Method.desc), goodMethods); 34 | } 35 | } 36 | } 37 | 38 | private static boolean isOverridden(ClassNode Class, MethodNode Method) { 39 | MethodInfo methodInfo = new MethodInfo(Class.name, Method.name, Method.desc); 40 | String superClassName = Class.superName; 41 | while (superClassName != null && !superClassName.equals("java/lang/Object")) { 42 | ClassNode superClass; 43 | if (superClassName.startsWith("java")) { 44 | superClass = new ClassNode(); 45 | try { 46 | //System.out.println(superClassName); 47 | ClassReader cr = new ClassReader(superClassName); 48 | cr.accept(superClass, 0); 49 | } catch (Exception e) { 50 | } 51 | } else 52 | superClass = CLASSES.get(superClassName); 53 | if (hasMethod(superClass, methodInfo.name, methodInfo.desc)) 54 | return true; 55 | superClassName = superClass.superName; 56 | } 57 | return false; 58 | } 59 | 60 | private static void getInvoked(ClassNode Class) { 61 | List Methods = Class.methods; 62 | for (MethodNode Method : Methods) { 63 | AbstractInsnNode[] Instructions = Method.instructions.toArray(); 64 | for (AbstractInsnNode Instruction : Instructions) { 65 | if (Instruction instanceof MethodInsnNode) { 66 | MethodInsnNode methodInstruction = (MethodInsnNode) Instruction; 67 | MethodInfo instructionInfo = new MethodInfo(methodInstruction.owner, methodInstruction.name, methodInstruction.desc); 68 | if (!instructionInfo.owner.contains("java")) { 69 | if (hasMethod(CLASSES.get(instructionInfo.owner), instructionInfo.name, instructionInfo.desc)) 70 | Add(instructionInfo, goodMethods); 71 | else { 72 | String supperClassName = CLASSES.get(instructionInfo.owner).superName; 73 | while (!supperClassName.contains("java")) { 74 | ClassNode superClass = CLASSES.get(supperClassName); 75 | if (hasMethod(superClass, instructionInfo.name, instructionInfo.desc)) { 76 | MethodInfo superMethod = new MethodInfo(superClass.name, instructionInfo.name, instructionInfo.desc); 77 | Add(superMethod, goodMethods); 78 | break; 79 | } 80 | supperClassName = superClass.superName; 81 | } 82 | } 83 | } 84 | } 85 | } 86 | } 87 | } 88 | 89 | public static ArrayList findRedundantMethods() { 90 | ArrayList methodsToRemove = new ArrayList(); 91 | for (MethodInfo mi : totalMethods) 92 | if (!goodMethods.contains(mi)) 93 | methodsToRemove.add(mi); 94 | return methodsToRemove; 95 | } 96 | 97 | private static void Add(MethodInfo info, ArrayList usedMethods) { 98 | if (!usedMethods.contains(info)) { 99 | usedMethods.add(info); 100 | } 101 | } 102 | 103 | private static boolean hasMethod(ClassNode Class, String methodName, String methodDesc) { 104 | List Methods = Class.methods; 105 | for (MethodNode Method : Methods) 106 | if (Method.name.equals(methodName) && Method.desc.equals(methodDesc)) 107 | return true; 108 | return false; 109 | } 110 | 111 | private static int removeDummyMethods() { 112 | int tempResult = 0; 113 | ArrayList removeMethods; 114 | removeMethods = Method.findRedundantMethods(); 115 | for (ClassNode classNode : CLASSES.values()) { 116 | for (int I = 0; I < removeMethods.size(); ++I) { 117 | if (classNode.name.equals(removeMethods.get(I).owner)) { 118 | for (int C = 0; C < classNode.methods.size(); ++C) { 119 | MethodNode Method = (MethodNode) classNode.methods.get(C); 120 | if (Method.name.equals(removeMethods.get(I).name)) { 121 | if (Method.desc.equals(removeMethods.get(I).desc)) { 122 | classNode.methods.remove(Method); 123 | ++tempResult; 124 | } 125 | } 126 | } 127 | } 128 | } 129 | } 130 | return tempResult; 131 | } 132 | 133 | public int Run() { 134 | for (ClassNode Class : CLASSES.values()) { 135 | getInterfaces(Class); 136 | getInvoked(Class); 137 | List Methods = Class.methods; 138 | for (MethodNode Method : Methods) { 139 | totalMethods.add(new MethodInfo(Class.name, Method.name, Method.desc)); 140 | if (Method.name.length() > 2 || Modifier.isAbstract(Method.access) || isOverridden(Class, Method)) { 141 | MethodInfo mInfo = new MethodInfo(Class.name, Method.name, Method.desc); 142 | Add(mInfo, goodMethods); 143 | } 144 | } 145 | } 146 | return removeDummyMethods(); 147 | } 148 | 149 | public int Deob() { 150 | int Total = 0; 151 | int Fixed = 10; 152 | while (Fixed != 0) { 153 | Fixed = Run(); 154 | Total = Total + Fixed; 155 | } 156 | System.out.print("Removed " + Total + " Dummy Methods"); 157 | return Total; 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/MethodInfo.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | 3 | /** 4 | * @author Kyle 5 | */ 6 | public class MethodInfo { 7 | public final String owner; 8 | public final String name; 9 | public final String desc; 10 | 11 | public MethodInfo(String owner, String name, String desc) { 12 | this.owner = owner; 13 | this.name = name; 14 | this.desc = desc; 15 | } 16 | 17 | @Override 18 | public boolean equals(Object obj) { 19 | if (obj instanceof MethodInfo) { 20 | MethodInfo info = (MethodInfo) obj; 21 | return owner.equals(info.owner) && name.equals(info.name) && desc.equals(info.desc); 22 | } 23 | return false; 24 | } 25 | 26 | @Override 27 | public String toString() { 28 | return owner + "." + name + desc; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/MethodName.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | /** 3 | * Created by Kyle on 1/12/2015. 4 | */ 5 | 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.Type; 9 | import org.objectweb.asm.tree.ClassNode; 10 | import org.objectweb.asm.tree.MethodInsnNode; 11 | import org.objectweb.asm.tree.MethodNode; 12 | import org.objectweb.asm.tree.VarInsnNode; 13 | 14 | import java.lang.reflect.Modifier; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import static eUpdater.misc.JarHandler.CLASSES; 19 | 20 | public class MethodName extends DeobFrame { 21 | public static void removeLastParam(MethodNode Method) { 22 | String Desc = Method.desc; 23 | StringBuilder descBuilder = new StringBuilder(Desc); 24 | int Index = Desc.indexOf(")"); 25 | String c = Character.toString(descBuilder.charAt(Index - 1)); 26 | if (!c.equals(";")) { 27 | descBuilder.deleteCharAt(Index - 1); 28 | Method.desc = descBuilder.toString(); 29 | } 30 | } 31 | 32 | public static void removeLastParam(MethodInsnNode Method) { 33 | String Desc = Method.desc; 34 | StringBuilder descBuilder = new StringBuilder(Desc); 35 | int Index = Desc.indexOf(")"); 36 | descBuilder.deleteCharAt(Index - 1); 37 | Method.desc = descBuilder.toString(); 38 | } 39 | 40 | public static ArrayList dummyParamMethods = new ArrayList(); 41 | 42 | public static int Run() { 43 | int fixedParams = 0; 44 | for (ClassNode classNode : CLASSES.values()) { 45 | List methodList = classNode.methods; 46 | for (MethodNode Method : methodList) { 47 | if (Method.access != Opcodes.ACC_ABSTRACT) { 48 | if (Method.name.contains("<")) 49 | continue; 50 | int paramCount; 51 | boolean hasDummy = true; 52 | Type[] types = Type.getArgumentTypes(Method.desc); 53 | paramCount = types.length; 54 | String lastParam; 55 | if (paramCount > 1) { 56 | lastParam = types[paramCount - 2].toString(); 57 | } else if (paramCount == 1) 58 | lastParam = types[paramCount - 1].toString(); 59 | else 60 | continue; 61 | if (Modifier.isStatic(Method.access)) 62 | continue; 63 | if (lastParam.equals("B") || lastParam.equals("I") || lastParam.equals("S") || lastParam.equals("Z")) { 64 | Searcher Search = new Searcher(Method); 65 | int L = Search.findMultiPatterns(new int[][]{{Opcodes.ALOAD}, {Opcodes.ILOAD}}, 0); 66 | if (L == -1) 67 | hasDummy = false; 68 | for (int I = 0; I < Method.instructions.size(); ++I) { 69 | if (Method.instructions.get(I) instanceof VarInsnNode) { 70 | if (((VarInsnNode) (Method.instructions.get(I))).var == paramCount) { 71 | hasDummy = false; 72 | } 73 | } 74 | } 75 | if (hasDummy) { 76 | dummyParamMethods.add(new MethodInfo(classNode.name, Method.name, Method.desc)); 77 | removeLastParam(Method); 78 | ++fixedParams; 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | for (ClassNode classNode : CLASSES.values()) { 86 | List methodList = classNode.methods; 87 | for (MethodNode Method : methodList) { 88 | if (Method.access != Opcodes.ACC_ABSTRACT) { 89 | int paramCount; 90 | boolean hasDummy = true; 91 | if (Method.name.contains("<")) 92 | continue; 93 | Type[] types = Type.getArgumentTypes(Method.desc); 94 | paramCount = types.length; 95 | if (paramCount > 0) { 96 | String lastParam = types[paramCount - 1].toString(); 97 | if (!Modifier.isStatic(Method.access)) 98 | continue; 99 | if (lastParam.equals("B") || lastParam.equals("I") || lastParam.equals("S")) { 100 | Searcher Search = new Searcher(Method); 101 | int L = Search.findMultiPatterns(new int[][]{{Opcodes.ALOAD}, {Opcodes.ILOAD}}, 0); 102 | if (L == -1) 103 | hasDummy = false; 104 | for (int I = 0; I < Method.instructions.size(); ++I) { 105 | if (Method.instructions.get(I) instanceof VarInsnNode) { 106 | if (((VarInsnNode) (Method.instructions.get(I))).var == paramCount - 1) { 107 | hasDummy = false; 108 | } 109 | } 110 | } 111 | if (hasDummy) { 112 | dummyParamMethods.add(new MethodInfo(classNode.name, Method.name, Method.desc)); 113 | removeLastParam(Method); 114 | ++fixedParams; 115 | } 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | for (ClassNode classNode : CLASSES.values()) { 123 | List methodList = classNode.methods; 124 | for (MethodNode Method : methodList) { 125 | for (int I = 0; I < Method.instructions.size(); ++I) { 126 | if (Method.instructions.get(I) instanceof MethodInsnNode) { 127 | MethodInfo Temp = new MethodInfo(classNode.name, ((MethodInsnNode) Method.instructions.get(I)).name, ((MethodInsnNode) Method.instructions.get(I)).desc); 128 | if (dummyParamMethods.contains(Temp)) { 129 | removeLastParam(((MethodInsnNode) Method.instructions.get(I))); 130 | Method.instructions.remove(Method.instructions.get(I - 1)); 131 | } 132 | } 133 | } 134 | } 135 | } 136 | return fixedParams; 137 | } 138 | 139 | public int Deob() { 140 | int fSafe = 0; 141 | int Total = 0; 142 | int Fixed = 10; 143 | while (Fixed != 0 && fSafe < 5) { 144 | ++fSafe; 145 | Fixed = Run(); 146 | Total = Total + Fixed; 147 | } 148 | System.out.print("Removed " + Total + " Dummy Parameters"); 149 | return Total; 150 | } 151 | 152 | } -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/Multipliers.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | /** 3 | * Created by Kyle on 1/12/2015. 4 | */ 5 | 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.AbstractInsnNode; 9 | import org.objectweb.asm.tree.ClassNode; 10 | import org.objectweb.asm.tree.FieldInsnNode; 11 | import org.objectweb.asm.tree.MethodNode; 12 | 13 | import java.util.ArrayList; 14 | import java.util.Arrays; 15 | import java.util.List; 16 | 17 | import static eUpdater.misc.JarHandler.CLASSES; 18 | 19 | public class Multipliers extends DeobFrame { 20 | 21 | public int Run() { 22 | int[][] Patterns = new int[][]{ 23 | {Opcodes.LDC, Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.IMUL}, 24 | {Opcodes.LDC, Opcodes.GETSTATIC, Opcodes.IMUL}, 25 | {Opcodes.LDC, Opcodes.GETFIELD, Opcodes.IMUL}, 26 | {Opcodes.LDC, Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LMUL}, 27 | {Opcodes.LDC, Opcodes.GETSTATIC, Opcodes.LMUL}, 28 | {Opcodes.LDC, Opcodes.GETFIELD, Opcodes.LMUL}}; 29 | int Fixed = 0; 30 | for (ClassNode Class : CLASSES.values()) { 31 | List methodList = Class.methods; 32 | for (MethodNode Method : methodList) { 33 | Searcher Search = new Searcher(Method); 34 | ArrayList Instructions = new ArrayList(Arrays.asList(Method.instructions.toArray())); 35 | 36 | for (int[] Pattern : Patterns) { 37 | int L = Search.find(Pattern, 0); 38 | int Count = 0; 39 | while (L != -1) { 40 | int afterField; 41 | if (Method.instructions.get(L + 1) instanceof FieldInsnNode) { 42 | afterField = 2; 43 | } else { 44 | afterField = 3; 45 | } 46 | Instructions.add(L + afterField, Instructions.get(L)); 47 | Instructions.remove(L); 48 | ++Count; 49 | ++Fixed; 50 | L = Search.find(Pattern, Count); 51 | } 52 | } 53 | 54 | Method.instructions.clear(); 55 | for (AbstractInsnNode n : Instructions) { 56 | Method.instructions.add(n); 57 | } 58 | } 59 | } 60 | return Fixed; 61 | } 62 | 63 | public int Deob() { 64 | int Total = 0; 65 | int Fixed = 10; 66 | while (Fixed != 0) { 67 | Fixed = Run(); 68 | Total = Total + Fixed; 69 | } 70 | System.out.print("Reordered " + Total + " Multiplier Instructions"); 71 | return Total; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/OpaquePredicates.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | /** 3 | * Created by Kyle on 1/12/2015. 4 | */ 5 | 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.ClassNode; 9 | import org.objectweb.asm.tree.JumpInsnNode; 10 | import org.objectweb.asm.tree.LabelNode; 11 | import org.objectweb.asm.tree.MethodNode; 12 | 13 | import java.util.List; 14 | 15 | import static eUpdater.misc.JarHandler.CLASSES; 16 | 17 | public class OpaquePredicates extends DeobFrame { 18 | 19 | public static int Run() { 20 | int Fixed = 0; 21 | int Patterns[][] = Patterns = new int[][]{ 22 | {Opcodes.ILOAD, Searcher.CONSTPUSH, Searcher.IF, Opcodes.RETURN}, 23 | {Opcodes.ILOAD, Opcodes.LDC, Searcher.IF, Opcodes.RETURN}, 24 | 25 | }; 26 | 27 | for (ClassNode Class : CLASSES.values()) { 28 | List methodList = Class.methods; 29 | for (MethodNode Method : methodList) { 30 | Searcher Search = new Searcher(Method); 31 | for (int[] Pattern : Patterns) { 32 | int L = Search.find(Pattern, 0); 33 | int Count = 0; 34 | while (L != -1) { 35 | LabelNode jmp = ((JumpInsnNode) Method.instructions.get(L + 2)).label; 36 | Method.instructions.insertBefore(Method.instructions.get(L), new JumpInsnNode(Opcodes.GOTO, jmp)); 37 | for (int j = 1; j < Pattern.length; ++j) 38 | Method.instructions.remove(Method.instructions.get(L + 1)); 39 | ++Count; 40 | ++Fixed; 41 | L = Search.find(Pattern, Count); 42 | } 43 | } 44 | } 45 | } 46 | return Fixed; 47 | } 48 | 49 | public int Deob() { 50 | int Total = 0; 51 | int Fixed = 10; 52 | while (Fixed != 0) { 53 | Fixed = Run(); 54 | Total = Total + Fixed; 55 | } 56 | System.out.print("Removed " + Total + " Opaque Predicates"); 57 | return Total; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/deob/RemoveExceptions.java: -------------------------------------------------------------------------------- 1 | package eUpdater.deob; 2 | /** 3 | * Created by Kyle on 1/12/2015. 4 | */ 5 | 6 | import eUpdater.searchers.Searcher; 7 | import org.objectweb.asm.Opcodes; 8 | import org.objectweb.asm.tree.*; 9 | 10 | import java.util.List; 11 | 12 | import static eUpdater.misc.JarHandler.CLASSES; 13 | 14 | public class RemoveExceptions extends DeobFrame { 15 | 16 | public static int Run() { 17 | int Patterns[][] = new int[][]{ 18 | {Opcodes.ILOAD, Opcodes.LDC, Searcher.IF, Opcodes.NEW, Opcodes.DUP, Opcodes.INVOKESPECIAL, Opcodes.ATHROW}, 19 | {Opcodes.ILOAD, Searcher.CONSTPUSH, Searcher.IF, Opcodes.NEW, Opcodes.DUP, Opcodes.INVOKESPECIAL, Opcodes.ATHROW}, 20 | {Opcodes.ILOAD, Opcodes.ICONST_0, Opcodes.IF_ICMPEQ, Opcodes.NEW, Opcodes.DUP, Opcodes.INVOKESPECIAL, Opcodes.ATHROW}, 21 | {Opcodes.ILOAD, Opcodes.ICONST_M1, Opcodes.IF_ICMPNE, Opcodes.NEW, Opcodes.DUP, Opcodes.INVOKESPECIAL, Opcodes.ATHROW}, 22 | {Opcodes.ILOAD, Opcodes.ICONST_0, Opcodes.IF_ICMPGT, Opcodes.NEW, Opcodes.DUP, Opcodes.INVOKESPECIAL, Opcodes.ATHROW}, 23 | }; 24 | int Fixed = 0; 25 | for (ClassNode Class : CLASSES.values()) { 26 | List methodList = Class.methods; 27 | for (MethodNode Method : methodList) { 28 | Searcher Search = new Searcher(Method); 29 | for (int[] Pattern : Patterns) { 30 | int L = Search.find(Pattern, 0); 31 | int Count = 0; 32 | int Check = 0; 33 | out: 34 | while (L != -1) { 35 | ++Check; 36 | if (Check > 100) 37 | break out; 38 | if (Method.instructions.get(L + 5) instanceof MethodInsnNode) { 39 | LabelNode jmp = ((JumpInsnNode) Method.instructions.get(L + 2)).label; 40 | Method.instructions.insertBefore(Method.instructions.get(L), new JumpInsnNode(Opcodes.GOTO, jmp)); 41 | for (int j = 0; j < Pattern.length; ++j) 42 | Method.instructions.remove(Method.instructions.get(L + 1)); 43 | ++Count; 44 | ++Fixed; 45 | L = Search.find(Pattern, Count); 46 | } 47 | } 48 | } 49 | } 50 | } 51 | 52 | return Fixed; 53 | } 54 | 55 | public int Deob() { 56 | int Total = 0; 57 | int Fixed = 10; 58 | while (Fixed != 0) { 59 | Fixed = Run(); 60 | Total = Total + Fixed; 61 | } 62 | System.out.print("Removed " + Total + " Exceptions"); 63 | return Total; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/frame/classFrame.java: -------------------------------------------------------------------------------- 1 | package eUpdater.frame; 2 | 3 | import org.objectweb.asm.tree.ClassNode; 4 | import org.objectweb.asm.tree.FieldNode; 5 | import org.objectweb.asm.tree.MethodNode; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by Kyle on 7/25/2015. 12 | */ 13 | public class classFrame extends ClassNode { 14 | 15 | public List getFields(String desc) { 16 | List fields = this.fields; 17 | List temp = new ArrayList(); 18 | for (FieldNode fN : fields) { 19 | if (fN.desc.equals(desc)) { 20 | temp.add(fN); 21 | } 22 | } 23 | return temp; 24 | } 25 | 26 | public List getFields(Integer nonAccess) { 27 | List fields = this.fields; 28 | List temp = new ArrayList(); 29 | for (FieldNode fN : fields) 30 | if ((fN.access & nonAccess) == 0) 31 | temp.add(fN); 32 | return temp; 33 | } 34 | 35 | public List getFields(Integer nonAccess1, Integer nonAccess2) { 36 | List fields = this.fields; 37 | List temp = new ArrayList(); 38 | for (FieldNode fN : fields) 39 | if ((fN.access & nonAccess1) == 0 && (fN.access & nonAccess2) == 0) 40 | temp.add(fN); 41 | return temp; 42 | } 43 | 44 | public List getFields(Integer none, Integer Access, Integer nonAccess2) { 45 | List fields = this.fields; 46 | List temp = new ArrayList(); 47 | for (FieldNode fN : fields) 48 | if ((fN.access & Access) != 0 && (fN.access & nonAccess2) == 0) 49 | temp.add(fN); 50 | return temp; 51 | } 52 | 53 | public void removeFields(String nonDesc) { 54 | List fields = this.fields; 55 | List temp = new ArrayList(); 56 | for (FieldNode fN : fields) { 57 | if (!fN.desc.equals(nonDesc)) { 58 | temp.remove(fN); 59 | } 60 | } 61 | } 62 | 63 | public MethodNode getMethod(boolean exact, String desc) { 64 | List methods = new ArrayList<>(); 65 | List methodList = this.methods; 66 | for (MethodNode m : methodList) { 67 | if (exact) { 68 | if (m.desc.equals(desc)) 69 | methods.add(m); 70 | } else if (m.desc.contains(desc)) 71 | methods.add(m); 72 | } 73 | if (methods.size() > 1) 74 | System.out.println(methods.get(231312312)); 75 | if (methods.size() == 0) 76 | return null; 77 | return methods.get(0); 78 | } 79 | 80 | public List getMethods(boolean exact, String desc) { 81 | List methods = new ArrayList<>(); 82 | List methodList = this.methods; 83 | for (MethodNode m : methodList) { 84 | if (exact) { 85 | if (m.desc.equals(desc)) 86 | methods.add(m); 87 | } else if (m.desc.contains(desc)) 88 | methods.add(m); 89 | } 90 | return methods; 91 | } 92 | 93 | public List getMethodsName(boolean exact, String desc) { 94 | List methods = new ArrayList<>(); 95 | List methodList = this.methods; 96 | for (MethodNode m : methodList) { 97 | if (exact) { 98 | if (m.name.equals(desc)) 99 | methods.add(m); 100 | } else if (m.name.contains(desc)) 101 | methods.add(m); 102 | } 103 | return methods; 104 | } 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/frame/hook.java: -------------------------------------------------------------------------------- 1 | package eUpdater.frame; 2 | 3 | import org.objectweb.asm.tree.AbstractInsnNode; 4 | import org.objectweb.asm.tree.FieldInsnNode; 5 | import org.objectweb.asm.tree.FieldNode; 6 | 7 | import java.util.List; 8 | 9 | import static eUpdater.misc.JarHandler.CLASSES; 10 | 11 | /** 12 | * Created by Kyle on 7/27/2015. 13 | */ 14 | public class hook { 15 | 16 | String id, name, desc, signature, owner; 17 | int access, multiplier; 18 | public boolean broken = false; 19 | public boolean duplicate = false; 20 | 21 | public void setId(String s) { 22 | 23 | id = s; 24 | } 25 | 26 | public void setName(String s) { 27 | 28 | name = s; 29 | } 30 | 31 | public void setDesc(String s) { 32 | 33 | desc = s; 34 | } 35 | 36 | public void setSignature(String s) { 37 | 38 | signature = s; 39 | } 40 | 41 | public void setAccess(int i) { 42 | 43 | access = i; 44 | } 45 | 46 | public void setMultiplier(int i) { 47 | multiplier = i; 48 | } 49 | 50 | public String getId() { 51 | 52 | return id; 53 | } 54 | 55 | public String getName() { 56 | 57 | return name; 58 | } 59 | 60 | public boolean isDuplicate() { 61 | return duplicate; 62 | } 63 | 64 | public void setDuplicate(boolean duplicate) { 65 | this.duplicate = duplicate; 66 | } 67 | 68 | public String getDesc() { 69 | 70 | return desc; 71 | } 72 | 73 | public String getSignature() { 74 | 75 | return signature; 76 | } 77 | 78 | public int getAccess() { 79 | 80 | return access; 81 | } 82 | 83 | public void setOwner(String s) { 84 | owner = s; 85 | } 86 | 87 | public String getOwner() { 88 | return owner; 89 | } 90 | 91 | public int getMultiplier() { 92 | return multiplier; 93 | } 94 | 95 | public hook() { 96 | 97 | } 98 | 99 | public hook(String id, FieldNode f) { 100 | setId(id); 101 | setName(f.name); 102 | setDesc(f.desc); 103 | setSignature(f.signature); 104 | setAccess(f.access); 105 | } 106 | 107 | public hook(String id, AbstractInsnNode[] Instructions, int L) { 108 | if (L != -1 && Instructions[L] instanceof FieldInsnNode) { 109 | for (classFrame c : CLASSES.values()) { 110 | List fields = c.fields; 111 | for (FieldNode f : fields) { 112 | if ((f.name.equals(((FieldInsnNode) Instructions[L]).name)) && (f.desc.equals(((FieldInsnNode) Instructions[L]).desc))) { 113 | setId(id); 114 | setName(f.name); 115 | setDesc(f.desc); 116 | setSignature(f.signature); 117 | setAccess(f.access); 118 | setOwner(((FieldInsnNode) Instructions[L]).owner); 119 | } 120 | } 121 | } 122 | } else { 123 | this.setId(id); 124 | this.setOwner("NULL"); 125 | this.setMultiplier(0); 126 | this.setName("NULL"); 127 | this.setDesc("NULL"); 128 | this.broken = true; 129 | } 130 | 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/frame/methodFrame.java: -------------------------------------------------------------------------------- 1 | package eUpdater.frame; 2 | 3 | import org.objectweb.asm.tree.MethodNode; 4 | 5 | /** 6 | * Created by Kyle on 8/27/2015. 7 | */ 8 | public class methodFrame extends MethodNode { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/main/eUpdater.java: -------------------------------------------------------------------------------- 1 | package eUpdater.main; 2 | 3 | import eUpdater.analysers.mainAnalyser; 4 | import eUpdater.deob.Deobsfucate; 5 | import eUpdater.misc.JarHandler; 6 | import eUpdater.misc.timer; 7 | 8 | import java.io.File; 9 | 10 | 11 | public class eUpdater { 12 | public static final int Revision = 138; 13 | public static final boolean simbaPrint = true; 14 | public static final boolean logPrint = true; 15 | 16 | static boolean forceDownload = false; 17 | static boolean forceDeob = false; 18 | 19 | public static final boolean findMultis = true; 20 | public static final boolean doRefactor = false; 21 | 22 | 23 | private static void downloadPack() { 24 | System.out.println("GamePack downloading.."); 25 | JarHandler.downloadJar("http://oldschool38.runescape.com/gamepack_2758227.jar", null, "res/Gamepacks/" + Revision + "/"); 26 | } 27 | 28 | private static void deobPack() { 29 | JarHandler.Parse("res/Gamepacks/" + Revision + "/GamePack.jar"); 30 | new Deobsfucate().Run(); 31 | JarHandler.save("res/Gamepacks/" + Revision + "/Deob.jar"); 32 | } 33 | 34 | private static void start() { 35 | timer t = new timer(true); 36 | File gamepacks = new File("res/Gamepacks/"); 37 | if (!gamepacks.exists()) 38 | gamepacks.mkdirs(); 39 | File file = new File("res/Gamepacks/" + Revision); 40 | 41 | if (!file.exists()) { 42 | file.mkdir(); 43 | downloadPack(); 44 | deobPack(); 45 | } else if (!forceDownload) 46 | System.out.println("Gamepack already downloaded..\n"); 47 | 48 | if (forceDownload) 49 | downloadPack(); 50 | 51 | if (forceDeob || forceDownload) 52 | deobPack(); 53 | 54 | JarHandler.Parse("res/Gamepacks/" + Revision + "/Deob.jar"); 55 | System.out.println(JarHandler.CLASSES.values().size() + " Classes Found \n"); 56 | 57 | mainAnalyser analyser = new mainAnalyser(); 58 | analyser.Run(); 59 | System.out.println("Total Runtime was " + t.getElapsedTime() + "ms"); 60 | 61 | } 62 | 63 | public static void main(String[] args) { 64 | eUpdater.start(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/misc/JarHandler.java: -------------------------------------------------------------------------------- 1 | package eUpdater.misc; 2 | 3 | import eUpdater.frame.classFrame; 4 | import org.objectweb.asm.ClassReader; 5 | import org.objectweb.asm.ClassWriter; 6 | import org.objectweb.asm.tree.ClassNode; 7 | 8 | import java.io.DataInputStream; 9 | import java.io.File; 10 | import java.io.FileOutputStream; 11 | import java.io.IOException; 12 | import java.net.URL; 13 | import java.net.URLConnection; 14 | import java.util.Enumeration; 15 | import java.util.HashMap; 16 | import java.util.jar.JarEntry; 17 | import java.util.jar.JarFile; 18 | import java.util.jar.JarOutputStream; 19 | 20 | 21 | public final class JarHandler { 22 | 23 | public static HashMap CLASSES = new HashMap(); 24 | 25 | public JarHandler(String theFile) { 26 | try { 27 | JarFile jar = new JarFile(theFile); 28 | 29 | CLASSES = this.parseJar(jar); 30 | } catch (IOException e) { 31 | } 32 | } 33 | 34 | public static void Parse(String File) { 35 | new JarHandler(File); 36 | } 37 | 38 | public HashMap parseJar(JarFile jar) { 39 | HashMap classes = new HashMap<>(); 40 | try { 41 | Enumeration enumeration = jar.entries(); 42 | while (enumeration.hasMoreElements()) { 43 | JarEntry entry = (JarEntry) enumeration.nextElement(); 44 | if (entry.getName().endsWith(".class")) { 45 | ClassReader classReader = new ClassReader(jar.getInputStream(entry)); 46 | classFrame classNode = new classFrame(); 47 | classReader.accept(classNode, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); 48 | classes.put(classNode.name, classNode); 49 | } 50 | } 51 | jar.close(); 52 | return classes; 53 | } catch (Exception e) { 54 | return null; 55 | } 56 | } 57 | 58 | public static void downloadJar(String Address, String UserAgent, String Location) { 59 | try { 60 | URLConnection Connection = new URL(Address).openConnection(); 61 | Connection.addRequestProperty("Protocol", "HTTP/1.1"); 62 | Connection.addRequestProperty("Connection", "keep-alive"); 63 | Connection.addRequestProperty("Keep-Alive", "300"); 64 | if (UserAgent != null) { 65 | Connection.addRequestProperty("User-Agent", UserAgent); 66 | } else { 67 | Connection.addRequestProperty("User-Agent", "Mozilla/5.0 (" + System.getProperty("os.name") + " " + System.getProperty("os.version") + ") Java/" + System.getProperty("java.version")); 68 | } 69 | byte[] Buffer = new byte[Connection.getContentLength()]; 70 | try (DataInputStream Stream = new DataInputStream(Connection.getInputStream())) { 71 | Stream.readFully(Buffer); 72 | } 73 | try (FileOutputStream fos = new FileOutputStream(Location + "GamePack.jar")) { 74 | fos.write(Buffer); 75 | } 76 | } catch (Exception Ex) { 77 | Ex.printStackTrace(); 78 | } 79 | } 80 | 81 | public static void save(final String name) { 82 | final File file = new File(name); 83 | try (final JarOutputStream out = new JarOutputStream(new FileOutputStream(file))) { 84 | for (final ClassNode c : JarHandler.CLASSES.values()) { 85 | out.putNextEntry(new JarEntry(c.name + ".class")); 86 | final ClassWriter cw = new ClassWriter(0); 87 | c.accept(cw); 88 | //System.out.println(c.name); 89 | //c.accept(new CheckClassAdapter(cw, true)); 90 | out.write(cw.toByteArray()); 91 | out.closeEntry(); 92 | } 93 | out.flush(); 94 | out.close(); 95 | } catch (final IOException e) { 96 | e.printStackTrace(); 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/misc/Misc.java: -------------------------------------------------------------------------------- 1 | package eUpdater.misc; 2 | 3 | import eUpdater.frame.classFrame; 4 | import org.objectweb.asm.Opcodes; 5 | import org.objectweb.asm.tree.*; 6 | 7 | import java.util.List; 8 | 9 | public class Misc { 10 | 11 | public static int mode(int a[]) { 12 | int maxValue = 0, maxCount = 0; 13 | 14 | for (int i = 0; i < a.length; ++i) { 15 | int count = 0; 16 | for (int j = 0; j < a.length; ++j) { 17 | if (a[j] == a[i]) ++count; 18 | } 19 | if (count > maxCount) { 20 | maxCount = count; 21 | maxValue = a[i]; 22 | } 23 | } 24 | return maxValue; 25 | } 26 | 27 | public static double round(double value, int places) { 28 | if (places < 0) throw new IllegalArgumentException(); 29 | long factor = (long) Math.pow(10, places); 30 | value = value * factor; 31 | long tmp = Math.round(value); 32 | return (double) tmp / factor; 33 | } 34 | 35 | public static FieldNode getField(String id, classFrame c) { 36 | List fields = c.fields; 37 | for (FieldNode f : fields) { 38 | if (f.name.equals(id)) 39 | return f; 40 | } 41 | return null; 42 | } 43 | 44 | public static String get(int opcode) { 45 | return org.objectweb.asm.util.Printer.OPCODES[opcode]; 46 | } 47 | 48 | public static void printMethod(MethodNode method) { 49 | System.out.println("METHOD: " + method.name + method.desc + "\n"); 50 | AbstractInsnNode[] instructions = method.instructions.toArray(); 51 | for (int I = 0; I < instructions.length; ++I) { 52 | AbstractInsnNode instruction = instructions[I]; 53 | if (instruction == null) 54 | System.out.println("Null Opcode"); 55 | else { 56 | if (instruction.getOpcode() != -1) { 57 | String value = null; 58 | switch (instruction.getOpcode()) { 59 | case Opcodes.ILOAD: 60 | case Opcodes.ALOAD: 61 | if (instruction instanceof VarInsnNode) { 62 | value = '_' + String.valueOf(((VarInsnNode) instruction).var); 63 | } 64 | break; 65 | case Opcodes.BIPUSH: 66 | case Opcodes.SIPUSH: 67 | value = " " + String.valueOf(((IntInsnNode) instruction).operand); 68 | break; 69 | case Opcodes.LDC: 70 | if (((LdcInsnNode) instruction).cst instanceof String) { 71 | value = " \"" + String.valueOf(((LdcInsnNode) instruction).cst) + "\""; 72 | } else { 73 | value = " " + String.valueOf(((LdcInsnNode) instruction).cst); 74 | } 75 | break; 76 | case Opcodes.GOTO: 77 | value = " " + method.instructions.indexOf(((JumpInsnNode) instruction).label); 78 | break; 79 | } 80 | if (value != null) { 81 | System.out.println(" -> " + get(instruction.getOpcode()) + value); 82 | } else { 83 | if (instruction instanceof MethodInsnNode) { 84 | MethodInsnNode m = (MethodInsnNode) instruction; 85 | System.out.println(" -> " + get(instruction.getOpcode()) + " " + m.owner + "/" + m.name + m.desc); 86 | } else if (instruction instanceof FieldInsnNode) { 87 | FieldInsnNode f = (FieldInsnNode) instruction; 88 | System.out.println(" -> " + get(instruction.getOpcode()) + " " + f.owner + "/" + f.name + " " + f.desc); 89 | } else { 90 | System.out.println(" -> " + get(instruction.getOpcode())); 91 | } 92 | } 93 | } else { 94 | System.out.println("-1"); 95 | } 96 | } 97 | } 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/misc/Printer.java: -------------------------------------------------------------------------------- 1 | package eUpdater.misc; 2 | 3 | public class Printer { 4 | 5 | /* 6 | public static void Log() { 7 | for (Map.Entry entry : myFields.entrySet()) { 8 | Clazz key = entry.getKey(); 9 | for (Map.Entry _entry : myFields.entrySet()) { 10 | Clazz _key = _entry.getKey(); 11 | if (key.superName.equals(_key.name)) 12 | key.superName = _key.ID; 13 | 14 | } 15 | } 16 | 17 | 18 | int theLength = 0; 19 | int secondLength = 0; 20 | int Broken = 0; 21 | int goodFields = 0; 22 | int goodClasses = 0; 23 | ArrayList brokenFields = new ArrayList<>(); 24 | for (Map.Entry entry : myFields.entrySet()) { 25 | Clazz key = entry.getKey(); 26 | System.out.println("|>" + key.ID + " = " + key.name + " -> Extends " + key.superName); 27 | ++ goodClasses; 28 | int tempBroken = 0; 29 | for (int I = 0; I < entry.getValue().length; ++I) { 30 | Field f = entry.getValue()[I]; 31 | if (f.name == null) { 32 | brokenFields.add(new String[] {key.ID, f.ID}); 33 | ++ Broken; 34 | ++ tempBroken; 35 | continue; 36 | } 37 | ++ goodFields; 38 | theLength = f.ID.length(); 39 | System.out.print(" ^ " + f.ID); 40 | for (int C = 0; C < 19 - theLength; ++C) 41 | System.out.print("."); 42 | if (key.name.equals("client")) 43 | System.out.print(f.owner + "." + f.name); 44 | else 45 | System.out.print(key.name + "." + f.name); 46 | if (f.multi != 0) { 47 | System.out.print(" * " + f.multi); 48 | secondLength = String.valueOf(f.multi).length(); 49 | if (!key.name.equals("client")) { 50 | for (int C = 0; C < 21 - (secondLength + f.name.length() + key.name.length()); ++C) 51 | System.out.print(" "); 52 | System.out.println(" -> " + f.desc); 53 | } else { 54 | for (int C = 0; C < 21 - (secondLength + f.name.length() + f.owner.length()); ++C) 55 | System.out.print(" "); 56 | System.out.println(" -> " + f.desc); 57 | } 58 | } else { 59 | if (!key.name.equals("client")) { 60 | for (int C = 0; C < 24 - (f.name.length() + key.name.length()); ++C) 61 | System.out.print(" "); 62 | System.out.println(" -> " + f.desc); 63 | } else { 64 | for (int C = 0; C < 24 - (f.name.length() + f.owner.length()); ++C) 65 | System.out.print(" "); 66 | System.out.println(" -> " + f.desc); 67 | } 68 | } 69 | } 70 | if (entry.getValue().length != 0) 71 | System.out.println(" Identified " + (entry.getValue().length - tempBroken) + " / " + entry.getValue().length + " Fields \n"); 72 | else 73 | System.out.println(""); 74 | } 75 | System.out.println("Identified " + goodClasses + " / " + goodClasses + " Classes.. \nIdentified " + goodFields + " / " + (Broken + goodFields) + " Fields..\n"); 76 | if (Broken > 0) { 77 | System.out.println("Broken Fields: "); 78 | for (int I = 0; I < Broken; ++ I) 79 | System.out.println(" -> " + brokenFields.get(I)[0] + "." + brokenFields.get(I)[1]); 80 | } 81 | } 82 | 83 | public static void simbaLape() { 84 | int theLength = 0; 85 | int miss = 0; 86 | try { 87 | for (Map.Entry entry : myFields.entrySet()) { 88 | Clazz key = entry.getKey(); 89 | System.out.println("{" + key.ID + " = " + key.name + "}"); 90 | for (int I = 0; I < entry.getValue().length; ++I) { 91 | try { 92 | Field f = entry.getValue()[I]; 93 | theLength = f.ID.length() + key.ID.length(); 94 | System.out.print(" " + key.ID + "_" + f.ID + ": THook = "); 95 | for (int C = 0; C < 25 - theLength; ++C) { 96 | System.out.print(" "); 97 | } 98 | if (key.name.equals("client")) 99 | System.out.print(" ['" + f.owner + "." + f.name + "', "); 100 | else 101 | System.out.print(" ['" + f.name + "', "); 102 | if (f.multi != 0) { 103 | System.out.println(f.multi + "];"); 104 | } else { 105 | System.out.println("1];"); 106 | } 107 | } catch (Exception e){ 108 | ++miss; 109 | System.out.println("//Broken"); 110 | } 111 | } 112 | System.out.println(""); 113 | } 114 | } catch (Exception e) { e.printStackTrace(); } 115 | if (miss > 0) 116 | System.out.println("Lost " + miss + " Fields"); 117 | } 118 | 119 | public static void simbaPascal() { 120 | int miss = 0; 121 | try { 122 | for (Map.Entry entry : myFields.entrySet()) { 123 | Clazz key = entry.getKey(); 124 | System.out.println("{" + key.ID + " = " + key.name + "}"); 125 | for (int I = 0; I < entry.getValue().length; ++I) { 126 | try { 127 | Field f = entry.getValue()[I]; 128 | System.out.print(" " + key.ID + "_" + f.ID + " = "); 129 | if (key.name.equals("client")) { 130 | System.out.println(" '" + f.owner + "." + f.name + "'" + ";"); 131 | if (f.multi != 0) 132 | System.out.println(" " + "Client" + "_" + f.ID + "_Multiplier" + " = " + f.multi + ";"); 133 | } 134 | else { 135 | System.out.println(" '" + f.name + "'" + ";"); 136 | if (f.multi != 0) 137 | System.out.println(" " + key.ID + "_" + f.ID + "_Multiplier" + " = " + f.multi + ";"); 138 | } 139 | 140 | } catch (Exception e){ 141 | ++miss; 142 | System.out.println("//Broken"); 143 | } 144 | } 145 | System.out.println(""); 146 | } 147 | } catch (Exception e) { e.printStackTrace(); } 148 | if (miss > 0) 149 | System.out.println("Lost " + miss + " Fields"); 150 | } 151 | */ 152 | } 153 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/misc/classes.java: -------------------------------------------------------------------------------- 1 | package eUpdater.misc; 2 | 3 | import eUpdater.analysers.classes.*; 4 | 5 | /** 6 | * Created by Kyle on 7/22/2015. 7 | */ 8 | public class classes { 9 | public static nnode myNode = new nnode(); 10 | public static cacheable myCacheable = new cacheable(); 11 | public static renderable myRenderable = new renderable(); 12 | public static animable myAnimable = new animable(); 13 | public static model myModel = new model(); 14 | public static animationSequence myAnimationSequence = new animationSequence(); 15 | public static npcDefinition myNpcDefinition = new npcDefinition(); 16 | public static linkedList myLinkedList = new linkedList(); 17 | public static actor myActor = new actor(); 18 | public static npc myNpc = new npc(); 19 | public static objectDefinition myObjectDefinition = new objectDefinition(); 20 | public static buffer myBuffer = new buffer(); 21 | public static widget myWidget = new widget(); 22 | public static widgetNode myWidgetNode = new widgetNode(); 23 | public static hashTable myHashTable = new hashTable(); 24 | public static gameShell myGameShell = new gameShell(); 25 | public static player myPlayer = new player(); 26 | public static client myClient = new client(); 27 | public static region myRegion = new region(); 28 | public static boundaryObject myBoundaryObject = new boundaryObject(); 29 | public static gameObject myGameObject = new gameObject(); 30 | public static floorDecoration myFloorDecoration = new floorDecoration(); 31 | public static wallDecoration myWallDecoration = new wallDecoration(); 32 | public static sceneTile mySceneTile = new sceneTile(); 33 | public static item myItem = new item(); 34 | 35 | // public List getClassData() { 36 | 37 | // } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/misc/myException.java: -------------------------------------------------------------------------------- 1 | package eUpdater.misc; 2 | 3 | /** 4 | * Created by Kyle on 11/5/2015. 5 | */ 6 | public class myException extends Exception { 7 | public myException(String message) { 8 | super(message); 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/java/eUpdater/misc/timer.java: -------------------------------------------------------------------------------- 1 | package eUpdater.misc; 2 | 3 | /** 4 | * Created by Kyle on 11/16/2015. 5 | */ 6 | public class timer { 7 | private long startTime; 8 | 9 | public timer() { 10 | } 11 | 12 | public timer(boolean startTime) { 13 | if (startTime) 14 | startTime(); 15 | } 16 | 17 | public void startTime() { 18 | startTime = System.nanoTime() / 1000000; 19 | } 20 | 21 | public long getElapsedTime() { 22 | return (System.nanoTime() / 1000000) - startTime; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/refactor/refactor.java: -------------------------------------------------------------------------------- 1 | package eUpdater.refactor; 2 | 3 | import eUpdater.analysers.classes.classAnalyserFrame; 4 | import eUpdater.analysers.mainAnalyser; 5 | import eUpdater.frame.classFrame; 6 | import eUpdater.frame.hook; 7 | import eUpdater.main.eUpdater; 8 | import eUpdater.misc.JarHandler; 9 | import org.objectweb.asm.tree.AbstractInsnNode; 10 | import org.objectweb.asm.tree.FieldInsnNode; 11 | import org.objectweb.asm.tree.FieldNode; 12 | import org.objectweb.asm.tree.MethodNode; 13 | 14 | import java.util.List; 15 | 16 | import static eUpdater.misc.JarHandler.CLASSES; 17 | 18 | /** 19 | * Created by Kyle on 12/5/2015. 20 | */ 21 | public class refactor { 22 | 23 | public static void run() { 24 | 25 | for (classFrame c : CLASSES.values()) { 26 | List fieldNodes = c.fields; 27 | for (FieldNode f : fieldNodes) { 28 | for (classAnalyserFrame cf : mainAnalyser.access.getClassAnalysers()) { 29 | if (f.desc.contains("L" + cf.getName())) { 30 | String original = f.desc; 31 | f.desc = original.replace(cf.getName(), cf.getId()); 32 | } 33 | } 34 | } 35 | } 36 | 37 | for (classAnalyserFrame cf : mainAnalyser.access.getClassAnalysers()) { 38 | for (classFrame c : CLASSES.values()) { 39 | if (c.name.equals(cf.getName())) { 40 | c.name = cf.getId(); 41 | if (cf.hasMethodAnalyser) { 42 | for (hook h : cf.getMethodAnalyser().getHooks()) { 43 | List fieldNodes = c.fields; 44 | for (FieldNode f : fieldNodes) { 45 | if (f.name.equals(h.getName())) { 46 | f.name = h.getId(); 47 | } 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | 55 | for (classAnalyserFrame cf : mainAnalyser.access.getClassAnalysers()) { 56 | if (cf.hasMethodAnalyser) { 57 | for (hook h : cf.getMethodAnalyser().getHooks()) { 58 | for (classFrame c : CLASSES.values()) { 59 | List fieldNodes = c.fields; 60 | for (FieldNode f : fieldNodes) { 61 | if (h.getName().equals(f.name) && h.getOwner() != null && h.getOwner().equals(c.name)) 62 | f.name = h.getId(); 63 | } 64 | } 65 | } 66 | } 67 | } 68 | 69 | for (classFrame c : CLASSES.values()) { 70 | for (MethodNode m : (List) c.methods) { 71 | AbstractInsnNode[] instructions = m.instructions.toArray(); 72 | for (AbstractInsnNode instruction : instructions) { 73 | if (instruction instanceof FieldInsnNode) { 74 | for (classAnalyserFrame cf : mainAnalyser.access.getClassAnalysers()) { 75 | if (((FieldInsnNode) instruction).owner.equals(cf.getName())) { 76 | ((FieldInsnNode) instruction).owner = (cf.getId()); 77 | if (cf.hasMethodAnalyser) { 78 | for (hook h : cf.getMethodAnalyser().getHooks()) { 79 | if (((FieldInsnNode) instruction).name.equals(h.getName())) 80 | ((FieldInsnNode) instruction).name = (h.getId()); 81 | } 82 | } 83 | } 84 | } 85 | } 86 | } 87 | 88 | } 89 | 90 | } 91 | 92 | JarHandler.save("H:/Documents/Updaters/Current/IDE Version/eUpdater/res/Gamepacks/" + eUpdater.Revision + "/Refactor.jar"); 93 | } 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/searchers/FieldSearcher.java: -------------------------------------------------------------------------------- 1 | package eUpdater.searchers; 2 | 3 | import org.objectweb.asm.tree.ClassNode; 4 | import org.objectweb.asm.tree.FieldNode; 5 | 6 | import java.util.List; 7 | 8 | public class FieldSearcher { 9 | 10 | private final List Fields; 11 | 12 | public FieldSearcher(ClassNode Node) { 13 | 14 | Fields = Node.fields; 15 | } 16 | 17 | public FieldNode findDesc(String desc) { 18 | 19 | for (FieldNode Field : Fields) { 20 | if (Field.desc.equals(desc)) { 21 | return Field; 22 | } 23 | } 24 | return null; 25 | } 26 | 27 | public int countDesc(String desc) { 28 | 29 | int Count = 0; 30 | for (FieldNode Field : Fields) { 31 | if (Field.desc.equals(desc)) { 32 | ++Count; 33 | } 34 | } 35 | return Count; 36 | } 37 | 38 | public FieldNode findContainsDesc(String desc) { 39 | 40 | for (FieldNode Field : Fields) { 41 | if (Field.desc.contains(desc)) { 42 | return Field; 43 | } 44 | } 45 | return null; 46 | } 47 | 48 | public FieldNode findAccess(int Acc) { 49 | 50 | for (FieldNode Field : Fields) { 51 | if (Field.access == Acc) { 52 | return Field; 53 | } 54 | } 55 | return null; 56 | } 57 | 58 | public int countContainsDesc(String desc) { 59 | 60 | int Count = 0; 61 | for (FieldNode Field : Fields) { 62 | if (Field.desc.contains(desc)) { 63 | ++Count; 64 | } 65 | } 66 | return Count; 67 | } 68 | 69 | public boolean findValue(int Acc) { 70 | 71 | for (FieldNode Field : Fields) { 72 | if (Field.value != null) { 73 | if (((int) Field.value) == Acc) { 74 | return true; 75 | } 76 | } 77 | } 78 | return false; 79 | } 80 | 81 | public FieldNode findDescInstance(String desc, int Instance) { 82 | int Count = 0; 83 | for (FieldNode Field : Fields) { 84 | if (Field.desc.equals(desc)) { 85 | if (Count == Instance) 86 | return Field; 87 | else 88 | ++Count; 89 | } 90 | } 91 | return null; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/searchers/Modulo.java: -------------------------------------------------------------------------------- 1 | package eUpdater.searchers; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * Created by Kyle on 11/21/2015. 7 | */ 8 | public class Modulo { 9 | public final BigInteger quotient; 10 | public final int bits; 11 | 12 | public Modulo(BigInteger quotient, int bits) { 13 | this.quotient = quotient; 14 | this.bits = bits; 15 | } 16 | 17 | public BigInteger compute() { 18 | try { 19 | BigInteger shift = BigInteger.ONE.shiftLeft(bits); 20 | return quotient.modInverse(shift); 21 | } catch (ArithmeticException e) { 22 | return null; 23 | } 24 | } 25 | 26 | public boolean isValid() { 27 | return compute() != null; 28 | } 29 | 30 | @Override 31 | public boolean equals(Object object) { 32 | if (!(object instanceof Modulo)) 33 | return false; 34 | Modulo mod = (Modulo) object; 35 | return mod.quotient.intValue() == quotient.intValue(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/searchers/Searcher.java: -------------------------------------------------------------------------------- 1 | package eUpdater.searchers; 2 | 3 | import org.objectweb.asm.tree.*; 4 | 5 | public class Searcher { 6 | 7 | public static int WILDCARD = -1337; 8 | public static int IF = -13377; 9 | public static int CONSTPUSH = -133777; 10 | public static int SHORTIF = -133433; 11 | 12 | 13 | private final InsnList instructions; 14 | AbstractInsnNode[] instruction; 15 | 16 | public Searcher(MethodNode method) { 17 | instructions = method.instructions; 18 | instruction = instructions.toArray(); 19 | //System.out.println("Method Name: " + method.name + " Desc: " + method.desc) 20 | } 21 | 22 | public int findSingle(int pattern, int Instance) { 23 | int C = 0; 24 | //AbstractInsnNode[] instruction = instructions.toArray(); 25 | for (int I = 0; I < instruction.length; ++I) { 26 | if (instruction[I].getOpcode() == pattern) { 27 | if (C == Instance) { 28 | return I; 29 | } 30 | ++C; 31 | } 32 | } 33 | return -1; 34 | } 35 | 36 | public int findSingleFieldDesc(int pattern, String value) { 37 | int L = 0; 38 | for (int I = 0; L != -1; ++I) { 39 | L = findSingle(pattern, I); 40 | if (L != -1) 41 | if (((FieldInsnNode) instruction[L]).desc.equals(value)) 42 | return L; 43 | } 44 | return -1; 45 | } 46 | 47 | public int findSingleFieldDesc(int pattern, String value, int startLine) { 48 | int L = 0; 49 | //AbstractInsnNode[] instruction = instructions.toArray(); 50 | for (int I = 0; L != -1; ++I) { 51 | L = find(new int[]{pattern}, I, startLine); 52 | if (L != -1) { 53 | if (((FieldInsnNode) instruction[L]).desc.equals(value)) 54 | return L; 55 | } 56 | } 57 | return -1; 58 | } 59 | 60 | public int findSingleIntValue(int pattern, int value) { 61 | int L = 0; 62 | //AbstractInsnNode[] instruction = instructions.toArray(); 63 | for (int I = 0; L != -1; ++I) { 64 | L = findSingle(pattern, I); 65 | if (L != -1) 66 | if (((IntInsnNode) instruction[L]).operand == value) 67 | return L; 68 | } 69 | return -1; 70 | } 71 | 72 | public int findSingleLdcValue(int pattern, int value) { 73 | int L = 0; 74 | //AbstractInsnNode[] instruction = instructions.toArray(); 75 | for (int I = 0; L != -1; ++I) { 76 | L = findSingle(pattern, I); 77 | if (L != -1) { 78 | if (((LdcInsnNode) instruction[L]).cst.equals(value)) 79 | return L; 80 | } 81 | } 82 | return -1; 83 | } 84 | 85 | public int findSingleLdcValue(int pattern, long value) { 86 | int L = 0; 87 | //AbstractInsnNode[] instruction = instructions.toArray(); 88 | for (int I = 0; L != -1; ++I) { 89 | L = findSingle(pattern, I); 90 | if (L != -1) { 91 | if (((LdcInsnNode) instruction[L]).cst.equals(value)) 92 | return L; 93 | } 94 | } 95 | return -1; 96 | } 97 | 98 | public int findSingleIntValue(int pattern, int value, int startLine) { 99 | int L = 0; 100 | //AbstractInsnNode[] instruction = instructions.toArray(); 101 | for (int I = 0; L != -1; ++I) { 102 | L = find(new int[]{pattern}, I, startLine); 103 | if (L != -1) 104 | if (((IntInsnNode) instruction[L]).operand == value) 105 | return L; 106 | } 107 | return -1; 108 | } 109 | 110 | public int findSingleJump(int Jump, int Pattern, int startLine, int linesUp, int Instance) { 111 | int C = 0; 112 | int Counter = 0; 113 | if (startLine == -1) 114 | return -1; 115 | for (int I = startLine; Counter < linesUp; ++I) { 116 | ++Counter; 117 | if (instruction[I].getOpcode() == Jump) { 118 | I = instructions.indexOf(((JumpInsnNode) instruction[I]).label); 119 | } 120 | if (instruction[I].getOpcode() == Pattern) { 121 | if (C == Instance) 122 | return I; 123 | ++C; 124 | } 125 | } 126 | return -1; 127 | } 128 | 129 | public int findSingleLines(int pattern, int startLine, int linesUp, int Instance) { 130 | int C = 0; 131 | if (startLine == -1) 132 | return -1; 133 | for (int I = startLine; I < startLine + linesUp; ++I) { 134 | if (instruction[I].getOpcode() == pattern) { 135 | if (C == Instance) { 136 | return I; 137 | } 138 | ++C; 139 | } 140 | } 141 | return -1; 142 | } 143 | 144 | public int amount(int Code) { 145 | //AbstractInsnNode[] instruction = instructions.toArray(); 146 | int Count = 0; 147 | for (int I = 0; I < instruction.length; ++I) { 148 | if (instruction[I].getOpcode() == Code) { 149 | ++Count; 150 | } 151 | 152 | } 153 | return Count; 154 | } 155 | 156 | public int find(int Pattern[], int instance) { 157 | AbstractInsnNode Instructions[] = instructions.toArray(); 158 | int Count = 0; 159 | for (int i = 0, j = 0; i < Instructions.length; ++i) { 160 | int k = i, l = j; 161 | while ((Instructions[k].getOpcode() == Pattern[l] || WILDCARD == Pattern[l]) 162 | || (IF == Pattern[l] && Instructions[k].getOpcode() > 158 && Instructions[k].getOpcode() < 167) || 163 | (CONSTPUSH == Pattern[l] && Instructions[k].getOpcode() > 0 && Instructions[k].getOpcode() < 18) || 164 | (SHORTIF == Pattern[l] && Instructions[k].getOpcode() > 152 && Instructions[k].getOpcode() < 159)) { 165 | ++k; 166 | ++l; 167 | 168 | if (k >= Instructions.length) 169 | break; 170 | 171 | if (Instructions[k].getOpcode() == -1) 172 | ++k; 173 | 174 | if (l == Pattern.length) { 175 | if (Count == instance) 176 | return i; 177 | else { 178 | ++Count; 179 | break; 180 | } 181 | } 182 | 183 | if (k == Instructions.length) { 184 | if (Count == instance) 185 | return j; 186 | else { 187 | ++Count; 188 | break; 189 | } 190 | } 191 | } 192 | } 193 | return -1; 194 | } 195 | 196 | public int find(int Pattern[], int instance, int startLine) { 197 | if (startLine == -1) 198 | return -1; 199 | AbstractInsnNode Instructions[] = instructions.toArray(); 200 | int Count = 0; 201 | for (int i = startLine, j = 0; i < Instructions.length; ++i) { 202 | int k = i, l = j; 203 | 204 | while ((Instructions[k].getOpcode() == Pattern[l] || WILDCARD == Pattern[l]) 205 | || (IF == Pattern[l] && Instructions[k].getOpcode() > 158 && Instructions[k].getOpcode() < 167) || 206 | (CONSTPUSH == Pattern[l] && Instructions[k].getOpcode() > 0 && Instructions[k].getOpcode() < 18) || 207 | (SHORTIF == Pattern[l] && Instructions[k].getOpcode() > 152 && Instructions[k].getOpcode() < 159)) { 208 | ++k; 209 | ++l; 210 | 211 | if (Instructions[k].getOpcode() == -1) 212 | ++k; 213 | 214 | if (l == Pattern.length) { 215 | if (Count == instance) 216 | return i; 217 | else { 218 | ++Count; 219 | break; 220 | } 221 | } 222 | 223 | if (k == Instructions.length) { 224 | if (Count == instance) 225 | return j; 226 | else { 227 | ++Count; 228 | break; 229 | } 230 | } 231 | } 232 | } 233 | return -1; 234 | } 235 | 236 | public int find(int[] Pattern, int instance, int startLine, int endLine) { 237 | if (startLine == -1 || endLine < startLine) { 238 | return -1; 239 | } 240 | AbstractInsnNode Instructions[] = instructions.toArray(); 241 | if (endLine == -1) 242 | endLine = Instructions.length - 1; 243 | 244 | int Count = 0; 245 | for (int i = startLine, j = 0; i < Instructions.length && i <= endLine; ++i) { 246 | int k = i, l = j; 247 | 248 | while ((Instructions[k].getOpcode() == Pattern[l] || WILDCARD == Pattern[l]) 249 | || (IF == Pattern[l] && Instructions[k].getOpcode() > 158 && Instructions[k].getOpcode() < 167) || 250 | (CONSTPUSH == Pattern[l] && Instructions[k].getOpcode() > 0 && Instructions[k].getOpcode() < 18) || 251 | (SHORTIF == Pattern[l] && Instructions[k].getOpcode() > 152 && Instructions[k].getOpcode() < 159)) { 252 | ++k; 253 | ++l; 254 | 255 | if (Instructions[k].getOpcode() == -1) 256 | ++k; 257 | 258 | if (l == Pattern.length) { 259 | if (Count == instance) 260 | return i; 261 | else { 262 | ++Count; 263 | break; 264 | } 265 | } 266 | 267 | if (k == Instructions.length) { 268 | if (Count == instance) 269 | return j; 270 | else { 271 | ++Count; 272 | break; 273 | } 274 | } 275 | } 276 | } 277 | return -1; 278 | } 279 | 280 | public int findMultiPatterns(int[][] Patterns, int instance) { 281 | for (int I = 0; I < Patterns.length; ++I) { 282 | int L = find(Patterns[I], instance); 283 | if (L != -1) { 284 | return L; 285 | } 286 | } 287 | return -1; 288 | } 289 | 290 | /*public int findPatterns(int sub[], int sub1[], int instance) { 291 | int L = find(sub, instance); 292 | if (L != -1) 293 | return L; 294 | else { 295 | L = find(sub1, instance); 296 | if (L != -1) 297 | return L; 298 | else 299 | return -1; 300 | } 301 | } 302 | public int findMulti(String field, String Owner, boolean Static) { 303 | int L; 304 | int[] aR = new int[100]; 305 | int Count = 0; 306 | for (ClassNode classNode : CLASSES.values()) { 307 | List methodList = classNode.methods; 308 | for (MethodNode Method : methodList) { 309 | Searcher search = new Searcher(Method); 310 | AbstractInsnNode[] instruction = Method.instructions.toArray(); 311 | try { 312 | if (Static == false) { 313 | for (int I = 0; I < 100; ++I) { 314 | L = search.find(new int[]{Opcodes.ALOAD, Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL}, I); 315 | if (L == -1) { 316 | break; 317 | } 318 | if (((FieldInsnNode) instruction[L + 1]).name.equals(field) && ((FieldInsnNode) instruction[L + 1]).owner.equals(Owner)) { 319 | aR[Count] = (int) ((LdcInsnNode) instruction[L + 2]).cst; 320 | ++Count; 321 | } 322 | 323 | } 324 | for (int I = 0; I < 100; ++I) { 325 | L = search.find(new int[]{Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL}, I); 326 | if (L == -1) { 327 | break; 328 | } 329 | if (((FieldInsnNode) instruction[L]).name.equals(field) && ((FieldInsnNode) instruction[L]).owner.equals(Owner)) { 330 | aR[Count] = (int) ((LdcInsnNode) instruction[L + 1]).cst; 331 | ++Count; 332 | } 333 | 334 | } 335 | } else { 336 | 337 | for (int I = 0; I < 100; ++I) { 338 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL}, I); 339 | if (L == -1) { 340 | break; 341 | } 342 | if (((FieldInsnNode) instruction[L]).name.equals(field) && ((FieldInsnNode) instruction[L]).owner.equals(Owner)) { 343 | aR[Count] = (int) ((LdcInsnNode) instruction[L + 1]).cst; 344 | ++Count; 345 | } 346 | 347 | } 348 | 349 | } 350 | 351 | } catch (Exception e) { 352 | } 353 | } 354 | 355 | } 356 | int[] b = Arrays.copyOf(aR, Count); 357 | int finalMult = Misc.mode(b); 358 | return finalMult; 359 | } 360 | public int findSingleBackwards(int pattern, int startLine, int Instance) { 361 | int C = 0; 362 | AbstractInsnNode[] instruction = instructions.toArray(); 363 | for (int I = startLine; I >= 0; --I) { 364 | if (instruction[I].getOpcode() == pattern) { 365 | if (C == Instance) { 366 | return I; 367 | } 368 | ++C; 369 | } 370 | } 371 | return -1; 372 | } 373 | 374 | public int findSingleBackwardsSpec(int pattern, int startLine, int Instance, int linesBack) { 375 | int C = 0; 376 | int back = startLine - linesBack; 377 | if (back < 0) { 378 | back = 0; 379 | } 380 | AbstractInsnNode[] instruction = instructions.toArray(); 381 | for (int I = startLine; I >= back; --I) { 382 | if (instruction[I].getOpcode() == pattern) { 383 | if (C == Instance) { 384 | return I; 385 | } 386 | ++C; 387 | } 388 | } 389 | return -1; 390 | } 391 | */ 392 | 393 | } 394 | 395 | -------------------------------------------------------------------------------- /src/main/java/eUpdater/searchers/mutltiplierSearcher.java: -------------------------------------------------------------------------------- 1 | package eUpdater.searchers; 2 | 3 | import eUpdater.misc.Misc; 4 | import org.objectweb.asm.Opcodes; 5 | import org.objectweb.asm.tree.*; 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | import static eUpdater.misc.JarHandler.CLASSES; 11 | 12 | /** 13 | * Created by Kyle on 11/5/2015. 14 | */ 15 | public class mutltiplierSearcher { 16 | 17 | public static int get(String field, String Owner, boolean Static) { 18 | int L; 19 | int[] aR = new int[100]; 20 | int Count = 0; 21 | for (ClassNode classNode : CLASSES.values()) { 22 | if (classNode.name.equals("client")) 23 | continue; 24 | List methodList = classNode.methods; 25 | for (MethodNode Method : methodList) { 26 | Searcher search = new Searcher(Method); 27 | AbstractInsnNode[] instruction = Method.instructions.toArray(); 28 | try { 29 | if (!Static) { 30 | for (int I = 0; I < 100; ++I) { 31 | L = search.find(new int[]{Opcodes.GETFIELD, Opcodes.LDC, Opcodes.IMUL}, I); 32 | if (L == -1) { 33 | break; 34 | } 35 | if (((FieldInsnNode) instruction[L]).name.equals(field) && ((FieldInsnNode) instruction[L]).owner.equals(Owner)) { 36 | aR[Count] = (int) ((LdcInsnNode) instruction[L + 1]).cst; 37 | ++Count; 38 | } 39 | 40 | } 41 | } else { 42 | for (int I = 0; I < 100; ++I) { 43 | L = search.find(new int[]{Opcodes.GETSTATIC, Opcodes.LDC, Opcodes.IMUL}, I); 44 | if (L == -1) { 45 | break; 46 | } 47 | if (((FieldInsnNode) instruction[L]).name.equals(field) && ((FieldInsnNode) instruction[L]).owner.equals(Owner)) { 48 | aR[Count] = (int) ((LdcInsnNode) instruction[L + 1]).cst; 49 | ++Count; 50 | } 51 | 52 | } 53 | 54 | } 55 | 56 | } catch (Exception e) { 57 | } 58 | } 59 | 60 | 61 | } 62 | int[] b = Arrays.copyOf(aR, Count); 63 | int finalMult = Misc.mode(b); 64 | return finalMult; 65 | } 66 | } 67 | --------------------------------------------------------------------------------