From 49afdf7dc791b090c4113854b4f780b7d82cff59 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 8 Jun 2019 09:33:50 +0200 Subject: [PATCH] Injector, deob, mixins --- deobfuscator/pom.xml | 173 + .../main/java/net/runelite/asm/ClassFile.java | 420 + .../java/net/runelite/asm/ClassGroup.java | 110 + .../src/main/java/net/runelite/asm/Field.java | 163 + .../java/net/runelite/asm/Interfaces.java | 92 + .../main/java/net/runelite/asm/Method.java | 314 + .../src/main/java/net/runelite/asm/Type.java | 228 + .../runelite/asm/attributes/Annotations.java | 85 + .../net/runelite/asm/attributes/Code.java | 113 + .../runelite/asm/attributes/Exceptions.java | 48 +- .../asm/attributes/annotation/Annotation.java | 82 + .../asm/attributes/annotation/Element.java | 68 + .../asm/attributes/code/Exception.java | 111 + .../asm/attributes/code/Exceptions.java | 73 + .../asm/attributes/code/Instruction.java | 144 + .../asm/attributes/code/InstructionType.java | 348 + .../asm/attributes/code/Instructions.java | 189 + .../runelite/asm/attributes/code/Label.java | 128 + .../asm/attributes/code/LocalVariable.java | 77 + .../asm/attributes/code/Parameter.java | 58 + .../types/AdditionInstruction.java | 121 + .../code/instruction/types/ArrayLoad.java | 84 + .../types/ArrayStoreInstruction.java | 31 + .../types/ComparisonInstruction.java | 31 + .../types/ConversionInstruction.java | 31 + .../types/DivisionInstruction.java | 86 + .../instruction/types/DupInstruction.java | 51 + .../instruction/types/FieldInstruction.java | 36 + .../types/GetFieldInstruction.java | 30 + .../instruction/types/IntInstruction.java | 33 + .../instruction/types/InvokeInstruction.java | 39 + .../instruction/types/JumpingInstruction.java | 37 + .../instruction/types/LVTInstruction.java | 38 + .../instruction/types/LVTInstructionType.java | 46 + .../types/MappableInstruction.java | 38 + .../types/PushConstantInstruction.java | 34 + .../instruction/types/ReturnInstruction.java | 31 + .../types/SetFieldInstruction.java | 30 + .../types/SubtractionInstruction.java | 136 + .../instruction/types/TypeInstruction.java | 34 + .../attributes/code/instructions/AALoad.java | 75 + .../attributes/code/instructions/AAStore.java | 59 + .../code/instructions/AConstNull.java | 63 + .../attributes/code/instructions/ALoad.java | 104 + .../code/instructions/ANewArray.java | 103 + .../attributes/code/instructions/AStore.java | 102 + .../attributes/code/instructions/AThrow.java | 63 + .../code/instructions/ArrayLength.java | 62 + .../code/instructions/ArrayStore.java | 140 + .../attributes/code/instructions/BALoad.java | 63 + .../attributes/code/instructions/BAStore.java | 58 + .../attributes/code/instructions/BiPush.java | 106 + .../attributes/code/instructions/CALoad.java | 63 + .../attributes/code/instructions/CAStore.java | 58 + .../code/instructions/CheckCast.java | 110 + .../asm/attributes/code/instructions/D2F.java | 63 + .../asm/attributes/code/instructions/D2I.java | 63 + .../asm/attributes/code/instructions/D2L.java | 63 + .../attributes/code/instructions/DALoad.java | 63 + .../attributes/code/instructions/DAStore.java | 58 + .../attributes/code/instructions/DAdd.java | 73 + .../attributes/code/instructions/DCmpG.java | 77 + .../attributes/code/instructions/DCmpL.java | 77 + .../attributes/code/instructions/DDiv.java | 74 + .../attributes/code/instructions/DLoad.java | 107 + .../attributes/code/instructions/DMul.java | 72 + .../attributes/code/instructions/DNeg.java | 69 + .../attributes/code/instructions/DRem.java | 73 + .../attributes/code/instructions/DStore.java | 102 + .../attributes/code/instructions/DSub.java | 73 + .../asm/attributes/code/instructions/Dup.java | 127 + .../attributes/code/instructions/Dup2.java | 142 + .../attributes/code/instructions/Dup2_X1.java | 262 + .../attributes/code/instructions/Dup2_X2.java | 138 + .../attributes/code/instructions/Dup_X1.java | 152 + .../attributes/code/instructions/Dup_X2.java | 155 + .../asm/attributes/code/instructions/F2D.java | 62 + .../asm/attributes/code/instructions/F2I.java | 62 + .../asm/attributes/code/instructions/F2L.java | 62 + .../attributes/code/instructions/FALoad.java | 63 + .../attributes/code/instructions/FAStore.java | 58 + .../attributes/code/instructions/FAdd.java | 73 + .../attributes/code/instructions/FCmpG.java | 77 + .../attributes/code/instructions/FCmpL.java | 77 + .../attributes/code/instructions/FDiv.java | 74 + .../attributes/code/instructions/FLoad.java | 107 + .../attributes/code/instructions/FMul.java | 72 + .../attributes/code/instructions/FNeg.java | 69 + .../attributes/code/instructions/FRem.java | 73 + .../attributes/code/instructions/FStore.java | 102 + .../attributes/code/instructions/FSub.java | 73 + .../code/instructions/GetField.java | 145 + .../code/instructions/GetStatic.java | 139 + .../attributes/code/instructions/Goto.java | 124 + .../attributes/code/instructions/GotoW.java | 99 + .../asm/attributes/code/instructions/I2B.java | 62 + .../asm/attributes/code/instructions/I2C.java | 62 + .../asm/attributes/code/instructions/I2D.java | 62 + .../asm/attributes/code/instructions/I2F.java | 62 + .../asm/attributes/code/instructions/I2L.java | 67 + .../asm/attributes/code/instructions/I2S.java | 62 + .../attributes/code/instructions/IALoad.java | 63 + .../attributes/code/instructions/IAStore.java | 58 + .../attributes/code/instructions/IAdd.java | 78 + .../attributes/code/instructions/IAnd.java | 78 + .../attributes/code/instructions/IDiv.java | 79 + .../attributes/code/instructions/IInc.java | 110 + .../attributes/code/instructions/ILoad.java | 113 + .../attributes/code/instructions/IMul.java | 77 + .../attributes/code/instructions/INeg.java | 69 + .../asm/attributes/code/instructions/IOr.java | 72 + .../attributes/code/instructions/IRem.java | 73 + .../attributes/code/instructions/IShL.java | 72 + .../attributes/code/instructions/IShR.java | 72 + .../attributes/code/instructions/IStore.java | 102 + .../attributes/code/instructions/ISub.java | 73 + .../attributes/code/instructions/IUShR.java | 72 + .../attributes/code/instructions/IXor.java | 72 + .../asm/attributes/code/instructions/If.java | 341 + .../asm/attributes/code/instructions/If0.java | 230 + .../code/instructions/IfACmpEq.java | 90 + .../code/instructions/IfACmpNe.java | 90 + .../attributes/code/instructions/IfCmpGe.java | 69 + .../attributes/code/instructions/IfCmpGt.java | 69 + .../attributes/code/instructions/IfCmpLe.java | 69 + .../attributes/code/instructions/IfCmpLt.java | 69 + .../attributes/code/instructions/IfEq.java | 110 + .../attributes/code/instructions/IfGe.java | 69 + .../attributes/code/instructions/IfGt.java | 69 + .../code/instructions/IfICmpEq.java | 135 + .../code/instructions/IfICmpNe.java | 143 + .../attributes/code/instructions/IfLe.java | 69 + .../attributes/code/instructions/IfLt.java | 69 + .../attributes/code/instructions/IfNe.java | 117 + .../code/instructions/IfNonNull.java | 84 + .../attributes/code/instructions/IfNull.java | 84 + .../code/instructions/InstanceOf.java | 102 + .../code/instructions/InvokeDynamic.java | 114 + .../code/instructions/InvokeInterface.java | 331 + .../code/instructions/InvokeSpecial.java | 296 + .../code/instructions/InvokeStatic.java | 293 + .../code/instructions/InvokeVirtual.java | 414 + .../asm/attributes/code/instructions/L2D.java | 62 + .../asm/attributes/code/instructions/L2F.java | 62 + .../asm/attributes/code/instructions/L2I.java | 62 + .../attributes/code/instructions/LALoad.java | 63 + .../attributes/code/instructions/LAStore.java | 58 + .../attributes/code/instructions/LAdd.java | 73 + .../attributes/code/instructions/LAnd.java | 72 + .../attributes/code/instructions/LCmp.java | 176 + .../asm/attributes/code/instructions/LDC.java | 184 + .../attributes/code/instructions/LDiv.java | 74 + .../attributes/code/instructions/LLoad.java | 107 + .../attributes/code/instructions/LMul.java | 78 + .../attributes/code/instructions/LNeg.java | 69 + .../asm/attributes/code/instructions/LOr.java | 72 + .../attributes/code/instructions/LRem.java | 73 + .../attributes/code/instructions/LShL.java | 72 + .../attributes/code/instructions/LShR.java | 72 + .../attributes/code/instructions/LStore.java | 104 + .../attributes/code/instructions/LSub.java | 73 + .../attributes/code/instructions/LUShR.java | 72 + .../attributes/code/instructions/LXor.java | 72 + .../code/instructions/LookupSwitch.java | 153 + .../code/instructions/MonitorEnter.java | 54 + .../code/instructions/MonitorExit.java | 54 + .../code/instructions/MultiANewArray.java | 115 + .../asm/attributes/code/instructions/NOP.java | 56 + .../asm/attributes/code/instructions/New.java | 115 + .../code/instructions/NewArray.java | 120 + .../asm/attributes/code/instructions/Pop.java | 58 + .../attributes/code/instructions/Pop2.java | 66 + .../code/instructions/PutField.java | 275 + .../code/instructions/PutStatic.java | 200 + .../attributes/code/instructions/Return.java | 109 + .../attributes/code/instructions/SALoad.java | 63 + .../attributes/code/instructions/SAStore.java | 58 + .../attributes/code/instructions/SiPush.java | 106 + .../attributes/code/instructions/Swap.java | 89 + .../code/instructions/TableSwitch.java | 210 + .../attributes/code/instructions/VReturn.java | 63 + .../net/runelite/asm/execution/Execution.java | 345 + .../asm/execution/ExecutionVisitor.java | 31 + .../net/runelite/asm/execution/Frame.java | 432 + .../runelite/asm/execution/FrameVisitor.java | 31 + .../asm/execution/InstructionContext.java | 260 + .../runelite/asm/execution/MethodContext.java | 83 + .../asm/execution/MethodContextVisitor.java | 31 + .../execution/ParallellMappingExecutor.java | 254 + .../net/runelite/asm/execution/Stack.java | 93 + .../runelite/asm/execution/StackContext.java | 100 + .../runelite/asm/execution/StaticStep.java | 209 + .../net/runelite/asm/execution/Value.java | 164 + .../asm/execution/VariableContext.java | 112 + .../net/runelite/asm/execution/Variables.java | 56 + .../asm/execution/WeakInstructionContext.java | 83 + .../objectwebasm/NonloadingClassWriter.java | 100 + .../java/net/runelite/asm/pool/Class.java | 78 + .../java/net/runelite/asm/pool/Field.java | 106 + .../java/net/runelite/asm/pool/Method.java | 104 + .../net/runelite/asm/signature/Signature.java | 177 + .../asm/signature/util/VirtualMethods.java | 97 + .../asm/visitors/ClassAnnotationVisitor.java | 68 + .../asm/visitors/ClassFieldVisitor.java | 70 + .../asm/visitors/ClassFileVisitor.java | 87 + .../runelite/asm/visitors/CodeVisitor.java | 449 + .../asm/visitors/FieldAnnotationVisitor.java | 68 + .../asm/visitors/MethodAnnotationVisitor.java | 68 + .../src/main/java/net/runelite/deob/Deob.java | 225 + .../net/runelite/deob/DeobAnnotations.java | 144 + .../net/runelite/deob/DeobProperties.java | 41 + .../java/net/runelite/deob/Deobfuscator.java | 33 + .../java/net/runelite/deob/Transformer.java | 33 + .../runelite/deob/c2s/IsaacCipherFinder.java | 121 + .../net/runelite/deob/c2s/RWOpcodeFinder.java | 116 + .../deob/clientver/ClientVersion.java | 67 + .../deob/clientver/ClientVersionMain.java | 39 + .../deob/clientver/VersionClassVisitor.java | 58 + .../deob/clientver/VersionMethodVisitor.java | 46 +- .../runelite/deob/deobfuscators/CastNull.java | 93 + .../deob/deobfuscators/EnumDeobfuscator.java | 262 + .../deob/deobfuscators/FieldInliner.java | 178 + .../deobfuscators/IllegalStateExceptions.java | 165 + .../net/runelite/deob/deobfuscators/Lvt.java | 99 + .../runelite/deob/deobfuscators/Order.java | 206 + .../deobfuscators/PacketHandlerOrder.java | 693 + .../deob/deobfuscators/RenameUnique.java | 109 + .../runelite/deob/deobfuscators/Renamer.java | 339 + .../deob/deobfuscators/RuntimeExceptions.java | 81 + .../deob/deobfuscators/UnreachedCode.java | 113 + .../deob/deobfuscators/UnusedClass.java | 77 + .../deob/deobfuscators/UnusedFields.java | 85 + .../deob/deobfuscators/UnusedMethods.java | 119 + .../deob/deobfuscators/UnusedParameters.java | 316 + .../arithmetic/AssociatedConstant.java | 35 + .../deob/deobfuscators/arithmetic/DMath.java | 147 + .../arithmetic/DupDeobfuscator.java | 275 + .../deobfuscators/arithmetic/Encryption.java | 57 + .../deobfuscators/arithmetic/FieldInfo.java | 165 + .../deobfuscators/arithmetic/ModArith.java | 795 + .../MultiplicationDeobfuscator.java | 401 + .../arithmetic/MultiplicationExpression.java | 134 + .../arithmetic/MultiplyOneDeobfuscator.java | 129 + .../arithmetic/MultiplyZeroDeobfuscator.java | 142 + .../deob/deobfuscators/arithmetic/Pair.java | 56 + .../deob/deobfuscators/cfg/Block.java | 164 + .../cfg/ControlFlowDeobfuscator.java | 267 + .../deobfuscators/cfg/ControlFlowGraph.java | 160 + .../constparam/ConstantMethodParameter.java | 74 + .../constparam/ConstantParameter.java | 483 + .../exprargorder/ExprArgOrder.java | 544 + .../exprargorder/Expression.java | 100 + .../deob/deobfuscators/lvt/LVTType.java | 32 + .../deob/deobfuscators/lvt/MapKey.java | 75 + .../deob/deobfuscators/lvt/Mappings.java | 92 + .../mapping/AnnotationIntegrityChecker.java | 356 + .../mapping/AnnotationMapper.java | 161 + .../mapping/ClassGroupMapper.java | 69 + .../deobfuscators/mapping/ClassMapper.java | 85 + .../mapping/ConstructorMapper.java | 131 + .../mapping/ExecutionMapper.java | 69 + .../deob/deobfuscators/mapping/Mapper.java | 239 + .../deob/deobfuscators/mapping/Mapping.java | 99 + .../mapping/MappingExecutorUtil.java | 311 + .../mapping/MethodSignatureMapper.java | 72 + .../mapping/ParallelExecutorMapping.java | 420 + .../mapping/StaticInitializerIndexer.java | 92 + .../mapping/StaticMethodSignatureMapper.java | 87 + .../deobfuscators/menuaction/Comparison.java | 83 + .../menuaction/MenuActionDeobfuscator.java | 257 + .../packethandler/PacketLengthFinder.java | 155 + .../packethandler/PacketRead.java | 114 + .../packethandler/PacketTypeFinder.java | 115 + .../packetwrite/OpcodeReplacer.java | 99 + .../packetwrite/PacketWrite.java | 53 + .../packetwrite/PacketWriteDeobfuscator.java | 337 + .../transformers/ClientErrorTransformer.java | 105 + .../transformers/GetPathTransformer.java | 98 + .../transformers/MaxMemoryTransformer.java | 115 + .../transformers/OpcodesTransformer.java | 74 + .../transformers/ReflectionTransformer.java | 254 + .../RuneliteBufferTransformer.java | 217 + .../transformers/buffer/BufferFinder.java | 115 + .../buffer/BufferMethodInjector.java | 140 + .../buffer/BufferPayloadFinder.java | 73 + .../buffer/PacketFlushFinder.java | 119 + .../transformers/buffer/RuneliteBuffer.java | 198 + .../net/runelite/deob/s2c/HandlerFinder.java | 309 + .../net/runelite/deob/s2c/PacketHandler.java | 176 + .../net/runelite/deob/s2c/PacketHandlers.java | 70 + .../deob/updater/AnnotationCopier.java | 120 + .../deob/updater/AnnotationRenamer.java | 92 + .../deob/updater/ParameterRenamer.java | 59 + .../runelite/deob/updater/UpdateMappings.java | 96 + .../java/net/runelite/deob/util/IdGen.java | 36 + .../java/net/runelite/deob/util/JarUtil.java | 127 + .../net/runelite/deob/util/NameMappings.java | 74 + .../runelite/deob/util/PrimitiveUtils.java | 73 + .../test/java/net/runelite/asm/ClassUtil.java | 44 + .../asm/annotations/AnnotationTest.java | 81 + .../asm/annotations/MyAnnotation.java | 35 + .../runelite/asm/annotations/TestClass.java | 35 + .../code/instructions/IfEqTest.java | 117 + .../code/instructions/IfICmpEqTest.java | 74 + .../code/instructions/LCmpTest.java | 66 + .../runelite/asm/execution/ExecutionTest.java | 47 + .../ParallelMappingExecutorTest.java | 63 + .../ParallellMappingExecutorTest.java | 69 + .../asm/execution/mapper/StaticStepTest.java | 49 + .../asm/execution/tests/TableSwitch.java | 49 + .../runelite/asm/signature/SignatureTest.java | 40 + .../asm/visitors/ClassFileVisitorTest.java | 53 + .../net/runelite/deob/ClassGroupFactory.java | 91 + .../net/runelite/deob/DeobTestProperties.java | 63 + .../runelite/deob/TemporyFolderLocation.java | 48 + .../deob/clientver/ClientVersionTest.java | 46 + .../deob/deobfuscators/CastNullTest.java | 83 + .../deobfuscators/EnumDeobfuscatorTest.java | 68 + .../deob/deobfuscators/FieldInlinerTest.java | 68 + .../IllegalStateExceptionsTest.java | 68 + .../runelite/deob/deobfuscators/LvtTest.java | 111 + .../deob/deobfuscators/OrderTest.java | 69 + .../deobfuscators/PacketHandlerOrderTest.java | 69 + .../deob/deobfuscators/RenameUniqueTest.java | 118 + .../deobfuscators/RuntimeExceptionsTest.java | 68 + .../deob/deobfuscators/UnreachedCodeTest.java | 92 + .../deob/deobfuscators/UnusedClassTest.java | 91 + .../deob/deobfuscators/UnusedFieldsTest.java | 68 + .../deob/deobfuscators/UnusedMethodsTest.java | 68 + .../deobfuscators/UnusedParametersTest.java | 95 + .../arithmetic/DupDeobfuscatorTest.java | 177 + .../arithmetic/ModArithTest.java | 87 + .../MultiplicationDeobfuscatorTest.java | 919 + .../MultiplyOneDeobfuscatorTest.java | 253 + .../MultiplyZeroDeobfuscatorTest.java | 70 + .../arithmetic/SimpleModArithTest.java | 173 + .../cfg/ControlFlowDeobfuscatorTest.java | 68 + .../constparam/ConstantParameterTest.java | 69 + .../exprargorder/ExprArgOrderTest.java | 391 + .../deobfuscators/mapping/MappingDumper.java | 315 + .../MenuActionDeobfuscatorTest.java | 68 + .../packethandler/PacketTypeFinderTest.java | 62 + .../PacketWriteDeobfuscatorTest.java | 72 + .../ClientErrorTransformerTest.java | 75 + .../transformers/buffer/BufferFinderTest.java | 62 + .../buffer/RuneliteBufferTest.java | 61 + .../unreachedcode/UnreachableTest.java | 56 + .../deobfuscators/unusedclass/ClassA.java | 33 + .../deobfuscators/unusedclass/EmptyClass.java | 30 + .../unusedclass/EmptyInterface.java | 30 + .../deob/injection/TestingClassLoader.java | 68 + .../deob/updater/AnnotationCopierTest.java | 67 + .../deob/updater/AnnotationRenamerTest.java | 62 + .../deob/updater/UpdateMappingsTest.java | 221 + .../java/net/runelite/osb/HookImporter.java | 331 + .../net/runelite/osb/inject/ClassHook.java | 59 + .../net/runelite/osb/inject/FieldHook.java | 42 + .../net/runelite/osb/inject/MethodHook.java | 48 + .../net/runelite/runeloader/CheckExports.java | 129 + .../runelite/runeloader/CheckMappings.java | 150 + .../runelite/runeloader/MappingImporter.java | 210 + .../java/net/runelite/runeloader/Utils.java | 43 + .../inject/AddFieldInstruction.java | 17 + .../inject/AddInterfaceInstruction.java | 23 + .../inject/AddMethodInstruction.java | 25 + .../inject/GetterInjectInstruction.java | 64 + .../runelite/runeloader/inject/Injection.java | 19 + .../runeloader/inject/InjectionModscript.java | 62 + .../inject/InstructionDeserializer.java | 82 + .../inject/MethodModInstruction.java | 64 + .../inject/ReplaceNodeInstruction.java | 19 + .../inject/SuperChangeInstruction.java | 35 + .../TableJumpInstruction$TableJump.java | 18 + .../inject/TableJumpInstruction.java | 32 + .../net/runelite/runesuite/HookClass.java | 14 + .../net/runelite/runesuite/HookField.java | 15 + .../net/runelite/runesuite/HookImporter.java | 280 + .../net/runelite/runesuite/HookMethod.java | 19 + .../java/net/runelite/runesuite/hooks.json | 32344 ++++++++++++++++ .../src/test/resources/deob-test.properties | 3 + injected-client/pom.xml | 88 + injector-plugin/pom.xml | 104 + .../java/net/runelite/injector/Inject.java | 629 + .../runelite/injector/InjectConstruct.java | 171 + .../net/runelite/injector/InjectGetter.java | 155 + .../net/runelite/injector/InjectHook.java | 384 + .../runelite/injector/InjectHookMethod.java | 251 + .../net/runelite/injector/InjectInvoker.java | 291 + .../net/runelite/injector/InjectMojo.java | 155 + .../net/runelite/injector/InjectSetter.java | 159 + .../runelite/injector/InjectionException.java | 44 + .../java/net/runelite/injector/Injector.java | 76 + .../runelite/injector/InjectorValidator.java | 196 + .../net/runelite/injector/MixinInjector.java | 982 + .../injector/raw/ClearColorBuffer.java | 93 + .../injector/raw/DrawAfterWidgets.java | 287 + .../net/runelite/injector/raw/DrawMenu.java | 193 + .../runelite/injector/raw/RasterizerHook.java | 400 + .../net/runelite/injector/raw/RenderDraw.java | 92 + .../net/runelite/injector/raw/ScriptVM.java | 353 + .../injector/InjectConstructTest.java | 63 + .../injector/InjectHookMethodTest.java | 123 + .../runelite/injector/InjectSetterTest.java | 116 + .../net/runelite/injector/InjectTest.java | 74 + .../runelite/injector/MixinInjectorTest.java | 268 + .../injector/raw/DrawAfterWidgetsTest.java | 80 + pom.xml | 6 +- rs-client/pom.xml | 13 +- .../src/main/java/net/runelite/api/Actor.java | 4 +- .../main/java/net/runelite/api/Client.java | 4 +- .../java/net/runelite/api/CollisionData.java | 2 +- .../net/runelite/api/DecorativeObject.java | 2 +- .../runelite/api/EquipmentInventorySlot.java | 2 +- .../java/net/runelite/api/GameObject.java | 2 +- .../main/java/net/runelite/api/GraphicID.java | 1 + .../java/net/runelite/api/Perspective.java | 4 +- .../java/net/runelite/api/ScriptEvent.java | 4 +- .../java/net/runelite/api/WidgetNode.java | 2 +- .../java/net/runelite/api/coords/Angle.java | 8 +- .../net/runelite/api/coords/WorldArea.java | 2 +- .../net/runelite/api/coords/WorldPoint.java | 2 +- .../runelite/api/events/AnimationChanged.java | 2 +- .../api/events/BoostedLevelChanged.java | 2 +- .../api/events/ItemContainerChanged.java | 2 +- .../api/events/MenuOptionClicked.java | 2 +- .../api/events/SpotAnimationChanged.java | 2 +- .../net/runelite/api/events/WidgetLoaded.java | 2 +- .../api/events/WidgetMenuOptionClicked.java | 2 +- .../runelite/api/events/WidgetPositioned.java | 2 +- .../net/runelite/api/hooks/Callbacks.java | 2 +- .../java/net/runelite/api/kit/KitType.java | 4 +- .../java/net/runelite/api/widgets/Widget.java | 8 +- .../net/runelite/api/widgets/WidgetInfo.java | 2 +- .../net/runelite/api/widgets/WidgetItem.java | 2 +- .../net/runelite/client/game/ItemManager.java | 36 +- .../net/runelite/client/game/LootManager.java | 2 +- .../runelite/client/game/SpriteManager.java | 10 +- .../client/graphics/ModelOutlineRenderer.java | 4 +- .../runelite/client/menus/MenuManager.java | 14 +- .../client/plugins/ammo/AmmoPlugin.java | 8 +- .../plugins/banktags/BankTagsPlugin.java | 6 +- .../plugins/banktags/tabs/TabInterface.java | 10 +- .../plugins/barrows/BarrowsOverlay.java | 12 +- .../chatcommands/ChatCommandsPlugin.java | 4 +- .../plugins/cluescrolls/ClueScrollPlugin.java | 10 +- .../cluescrolls/clues/CrypticClue.java | 4 +- .../plugins/cluescrolls/clues/MapClue.java | 4 +- .../clues/emote/SingleItemRequirement.java | 4 +- .../plugins/combatcounter/CombatCounter.java | 6 +- .../client/plugins/cooking/CookingPlugin.java | 6 +- .../client/plugins/coxhelper/CoxOverlay.java | 14 +- .../client/plugins/coxhelper/CoxPlugin.java | 6 +- .../demonicgorilla/DemonicGorilla.java | 4 +- .../plugins/devtools/DevToolsOverlay.java | 12 +- .../plugins/devtools/DevToolsPlugin.java | 10 +- .../EquipmentInspectorPanel.java | 4 +- .../EquipmentInspectorPlugin.java | 8 +- .../plugins/equipmentinspector/ItemPanel.java | 4 +- .../client/plugins/examine/ExaminePlugin.java | 8 +- .../plugins/fightcave/NPCContainer.java | 4 +- .../plugins/fightcave/TimersOverlay.java | 4 +- .../fishing/FishingSpotMinimapOverlay.java | 2 +- .../plugins/fishing/FishingSpotOverlay.java | 2 +- .../freezetimers/FreezeTimersOverlay.java | 2 +- .../freezetimers/FreezeTimersPlugin.java | 10 +- .../plugins/freezetimers/PrayerTracker.java | 2 +- .../grandexchange/GrandExchangeOfferSlot.java | 4 +- .../GrandExchangeOffersPanel.java | 4 +- .../grandexchange/GrandExchangePlugin.java | 4 +- .../GrandExchangeSearchPanel.java | 4 +- .../grounditems/GroundItemsPlugin.java | 16 +- .../highalchemy/HighAlchemyOverlay.java | 4 +- .../idlenotifier/IdleNotifierPlugin.java | 12 +- .../plugins/implings/ImplingsOverlay.java | 8 +- .../instancemap/InstanceMapOverlay.java | 6 +- .../InterfaceStylesPlugin.java | 22 +- .../inventorygrid/InventoryGridOverlay.java | 116 - .../inventorysetups/InventorySetupPlugin.java | 6 +- .../InventoryViewerOverlay.java | 4 +- .../plugins/itemcharges/ItemChargePlugin.java | 8 +- .../plugins/itemprices/ItemPricesOverlay.java | 6 +- .../plugins/itemstats/ItemStatPlugin.java | 2 +- .../keptondeath/ActuallyTradeableItem.java | 2 +- .../keptondeath/KeptOnDeathPlugin.java | 14 +- .../loottracker/LootTrackerPlugin.java | 4 +- .../MenuEntrySwapperPlugin.java | 24 +- .../client/plugins/minimap/MinimapDot.java | 6 +- .../client/plugins/minimap/MinimapPlugin.java | 10 +- .../MultiIndicatorsPlugin.java | 4 +- .../musicindicator/MusicIndicatorPlugin.java | 6 +- .../plugins/npchighlight/MemorizedNpc.java | 4 +- .../plugins/npchighlight/NpcSceneOverlay.java | 4 +- .../npcunaggroarea/NpcAggroAreaPlugin.java | 4 +- .../ObjectIndicatorsPlugin.java | 8 +- .../PlayerIndicatorsOverlay.java | 12 +- .../client/plugins/poison/PoisonPlugin.java | 2 +- .../PrayAgainstPlayerOverlay.java | 6 +- .../plugins/prayagainstplayer/WeaponType.java | 6 +- .../plugins/pvptools/PvpToolsPlugin.java | 8 +- .../pyramidplunder/PyramidPlunderOverlay.java | 6 +- .../SkillCalculatorPlugin.java | 2 +- .../skillcalculator/banked/CriticalItem.java | 10 +- .../banked/ui/CriticalItemPanel.java | 12 +- .../client/plugins/slayer/SlayerPlugin.java | 10 +- .../plugins/slayer/TargetClickboxOverlay.java | 6 +- .../specialcounter/SpecialCounterPlugin.java | 4 +- .../plugins/statusbars/StatusBarsPlugin.java | 4 +- .../StonedLootTrackerPlugin.java | 8 +- .../SuppliesTrackerPlugin.java | 8 +- .../client/plugins/theatre/RoomHandler.java | 2 +- .../client/plugins/timers/TimersPlugin.java | 18 +- .../client/plugins/tmorph/TMorph.java | 76 +- .../whalewatchers/WhaleWatchersPlugin.java | 2 +- .../client/plugins/wiki/WikiPlugin.java | 10 +- .../net/runelite/client/rs/ClientLoader.java | 5 - .../client/ui/overlay/arrow/ArrowUtil.java | 6 +- .../net/runelite/client/util/ImageUtil.java | 6 +- .../net/runelite/client/util/PvPUtil.java | 4 +- .../plugins/bank/BankCalculationTest.java | 6 +- .../plugins/cooking/CookingPluginTest.java | 10 +- .../plugins/examine/ExaminePluginTest.java | 2 +- .../GrandExchangeOfferSlotTest.java | 4 +- .../idlenotifier/IdleNotifierPluginTest.java | 10 +- .../java/net/runelite/mixins/CameraMixin.java | 2 +- .../net/runelite/mixins/ClickboxMixin.java | 10 +- .../net/runelite/mixins/EntityHiderMixin.java | 16 +- .../java/net/runelite/mixins/MenuMixin.java | 42 +- .../net/runelite/mixins/MinimapMixin.java | 8 +- .../mixins/ProcessClientErrorMixin.java | 24 +- ...in.java => RSAbstractIndexCacheMixin.java} | 44 +- .../net/runelite/mixins/RSActorMixin.java | 106 +- .../mixins/RSBoundaryObjectMixin.java | 100 + .../net/runelite/mixins/RSCanvasMixin.java | 68 + ...fferMixin.java => RSChatChannelMixin.java} | 10 +- .../net/runelite/mixins/RSClanChatMixin.java | 47 + .../net/runelite/mixins/RSClanMateMixin.java | 24 + .../net/runelite/mixins/RSClientMixin.java | 177 +- .../runelite/mixins/RSDynamicObjectMixin.java | 4 +- .../mixins/RSEnumDefinitionMixin.java | 51 + .../mixins/RSFloorDecorationMixin.java | 61 + .../net/runelite/mixins/RSFriendMixin.java | 4 +- .../runelite/mixins/RSFriendSystemMixin.java | 24 + .../runelite/mixins/RSGameCanvasMixin.java | 93 - .../runelite/mixins/RSGameObjectMixin.java | 10 +- ...EngineMixin.java => RSGameShellMixin.java} | 12 +- .../mixins/RSGraphicsObjectMixin.java | 30 + ...SItemMixin.java => RSGroundItemMixin.java} | 34 +- .../mixins/RSGroundItemPileMixin.java | 34 + .../mixins/RSHealthBarDefinitionMixin.java | 89 + .../net/runelite/mixins/RSHealthBarMixin.java | 113 - .../net/runelite/mixins/RSIgnoredMixin.java | 25 + .../mixins/RSItemCompositionMixin.java | 92 - .../runelite/mixins/RSItemContainerMixin.java | 8 +- .../mixins/RSItemDefinitionMixin.java | 67 + .../runelite/mixins/RSKeyHandlerMixin.java | 71 + .../net/runelite/mixins/RSMessageMixin.java | 73 + .../net/runelite/mixins/RSModelDataMixin.java | 7 +- .../net/runelite/mixins/RSModelMixin.java | 38 +- ...putMixin.java => RSMouseHandlerMixin.java} | 32 +- .../mixins/RSMouseWheelHandlerMixin.java | 4 +- .../runelite/mixins/RSNPCDefinitionMixin.java | 50 + .../java/net/runelite/mixins/RSNPCMixin.java | 30 +- .../runelite/mixins/RSNodeHashTableMixin.java | 38 + .../java/net/runelite/mixins/RSNodeMixin.java | 2 +- .../mixins/RSPlayerAppearanceMixin.java | 34 + .../net/runelite/mixins/RSPlayerMixin.java | 64 +- .../runelite/mixins/RSProjectileMixin.java | 4 +- ...rMixin.java => RSRasterProviderMixin.java} | 34 +- ...r2DMixin.java => RSRasterizer2DMixin.java} | 28 +- .../net/runelite/mixins/RSSceneMixin.java | 42 +- ...in.java => RSSequenceDefinitionMixin.java} | 58 +- .../net/runelite/mixins/RSSpriteMixin.java | 112 + .../net/runelite/mixins/RSTextureMixin.java | 6 +- .../mixins/RSTextureProviderMixin.java | 4 +- .../java/net/runelite/mixins/RSTileMixin.java | 139 +- .../net/runelite/mixins/RSTileModelMixin.java | 60 + .../runelite/mixins/RSTileObjectMixin.java | 89 + .../net/runelite/mixins/RSTilePaintMixin.java | 60 + .../net/runelite/mixins/RSUserListMixin.java | 47 + .../net/runelite/mixins/RSVarcsMixin.java | 6 +- ...tMixin.java => RSWallDecorationMixin.java} | 42 +- .../net/runelite/mixins/RSWidgetMixin.java | 41 +- .../mixins/RSWorldMapManagerMixin.java | 34 + .../net/runelite/mixins/RSWorldMapMixin.java | 29 + .../net/runelite/mixins/RSWorldMixin.java | 6 +- .../net/runelite/mixins/ScriptVMMixin.java | 16 +- .../java/net/runelite/mixins/SpriteMixin.java | 51 +- .../mixins/StretchedModeMaxSizeMixin.java | 33 +- .../runelite/mixins/StretchedModeMixin.java | 27 +- .../net/runelite/mixins/TileObjectMixin.java | 113 - .../java/net/runelite/mixins/VarbitMixin.java | 50 +- .../runelite/mixins/WidgetSpriteMixin.java | 43 +- .../runelite/mixins/WorldHoppingMixin.java | 30 +- .../java/net/runelite/mapping/Export.java | 40 + .../java/net/runelite/mapping/Implements.java | 37 + .../runelite/mapping/ObfuscatedGetter.java | 39 + .../net/runelite/mapping/ObfuscatedName.java | 40 + .../runelite/mapping/ObfuscatedSignature.java | 42 + .../java/net/runelite/rs/api/RSClient.java | 2 +- 599 files changed, 84012 insertions(+), 1821 deletions(-) create mode 100644 deobfuscator/pom.xml create mode 100644 deobfuscator/src/main/java/net/runelite/asm/ClassFile.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/Field.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/Interfaces.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/Method.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/Type.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java rename runelite-mixins/src/main/java/net/runelite/mixins/RSHashTableMixin.java => deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java (65%) create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/LVTInstructionType.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/MappableInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/PushConstantInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ReturnInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SetFieldInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/SubtractionInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/TypeInstruction.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AConstNull.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ANewArray.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/AThrow.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayLength.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ArrayStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/BiPush.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/CheckCast.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2F.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2I.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/D2L.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DAdd.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpG.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DCmpL.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DDiv.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DLoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DMul.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DNeg.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DRem.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/DSub.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X1.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup2_X2.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X1.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Dup_X2.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2D.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2I.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/F2L.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FAdd.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpG.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FCmpL.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FDiv.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FLoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FMul.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FNeg.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FRem.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/FSub.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetField.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GetStatic.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Goto.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/GotoW.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2B.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2C.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2D.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2F.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2L.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/I2S.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAdd.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IAnd.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IDiv.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IInc.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ILoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IMul.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/INeg.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IOr.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IRem.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShL.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IShR.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/ISub.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IUShR.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IXor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/If0.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpEq.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfACmpNe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpGt.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfCmpLt.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfEq.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfGt.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpEq.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfICmpNe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfLt.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNe.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNonNull.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/IfNull.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InstanceOf.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeDynamic.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeInterface.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeSpecial.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeStatic.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/InvokeVirtual.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2D.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2F.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/L2I.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAdd.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LAnd.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LCmp.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDC.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LDiv.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LLoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LMul.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LNeg.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LOr.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LRem.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShL.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LShR.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LSub.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LUShR.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LXor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/LookupSwitch.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorEnter.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MonitorExit.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/MultiANewArray.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NOP.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/New.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/NewArray.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Pop.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Pop2.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/PutField.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/PutStatic.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Return.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/SALoad.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/SAStore.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/SiPush.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/Swap.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/TableSwitch.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/attributes/code/instructions/VReturn.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/Execution.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/ExecutionVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/Frame.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/FrameVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/InstructionContext.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/MethodContext.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/MethodContextVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/ParallellMappingExecutor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/Stack.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/StackContext.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/StaticStep.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/Value.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/VariableContext.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/Variables.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/execution/WeakInstructionContext.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/objectwebasm/NonloadingClassWriter.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/pool/Class.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/pool/Field.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/pool/Method.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/signature/Signature.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/signature/util/VirtualMethods.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/visitors/ClassAnnotationVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/visitors/ClassFieldVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/visitors/ClassFileVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/visitors/CodeVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/visitors/FieldAnnotationVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/asm/visitors/MethodAnnotationVisitor.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/Deob.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/DeobAnnotations.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/DeobProperties.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/Deobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/Transformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/c2s/IsaacCipherFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/c2s/RWOpcodeFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/clientver/ClientVersion.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/clientver/ClientVersionMain.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/clientver/VersionClassVisitor.java rename runelite-mixins/src/main/java/net/runelite/mixins/RSPlayerCompositionMixin.java => deobfuscator/src/main/java/net/runelite/deob/clientver/VersionMethodVisitor.java (69%) create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/CastNull.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/EnumDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/FieldInliner.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/IllegalStateExceptions.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Lvt.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Order.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/PacketHandlerOrder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/RenameUnique.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/Renamer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/RuntimeExceptions.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/UnreachedCode.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/UnusedClass.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/UnusedFields.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/UnusedMethods.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/UnusedParameters.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/AssociatedConstant.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/DMath.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/DupDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/Encryption.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/FieldInfo.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/ModArith.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplicationDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplicationExpression.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyZeroDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/arithmetic/Pair.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/cfg/Block.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/cfg/ControlFlowDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/cfg/ControlFlowGraph.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/constparam/ConstantMethodParameter.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/constparam/ConstantParameter.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/exprargorder/ExprArgOrder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/exprargorder/Expression.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/lvt/LVTType.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/lvt/MapKey.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/lvt/Mappings.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/AnnotationIntegrityChecker.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/AnnotationMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/ClassGroupMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/ClassMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/ConstructorMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/ExecutionMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/Mapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/Mapping.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/MappingExecutorUtil.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/MethodSignatureMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/ParallelExecutorMapping.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/StaticInitializerIndexer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/mapping/StaticMethodSignatureMapper.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/menuaction/Comparison.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/menuaction/MenuActionDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/packethandler/PacketLengthFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/packethandler/PacketRead.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/packethandler/PacketTypeFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/packetwrite/OpcodeReplacer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/packetwrite/PacketWrite.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/packetwrite/PacketWriteDeobfuscator.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/ClientErrorTransformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/GetPathTransformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/MaxMemoryTransformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/OpcodesTransformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/ReflectionTransformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/RuneliteBufferTransformer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/buffer/BufferFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/buffer/BufferMethodInjector.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/buffer/BufferPayloadFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/buffer/PacketFlushFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/deobfuscators/transformers/buffer/RuneliteBuffer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/s2c/HandlerFinder.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/s2c/PacketHandler.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/s2c/PacketHandlers.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/updater/AnnotationCopier.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/updater/AnnotationRenamer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/updater/ParameterRenamer.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/updater/UpdateMappings.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/util/IdGen.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/util/JarUtil.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/util/NameMappings.java create mode 100644 deobfuscator/src/main/java/net/runelite/deob/util/PrimitiveUtils.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/ClassUtil.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/annotations/AnnotationTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/annotations/MyAnnotation.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/annotations/TestClass.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/attributes/code/instructions/IfEqTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/attributes/code/instructions/IfICmpEqTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/attributes/code/instructions/LCmpTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/execution/ExecutionTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/execution/ParallelMappingExecutorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/execution/ParallellMappingExecutorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/execution/mapper/StaticStepTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/execution/tests/TableSwitch.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/signature/SignatureTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/asm/visitors/ClassFileVisitorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/ClassGroupFactory.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/DeobTestProperties.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/TemporyFolderLocation.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/clientver/ClientVersionTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/CastNullTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/EnumDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/FieldInlinerTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/IllegalStateExceptionsTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/LvtTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/OrderTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/PacketHandlerOrderTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/RenameUniqueTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/RuntimeExceptionsTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/UnreachedCodeTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/UnusedClassTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/UnusedFieldsTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/UnusedMethodsTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/UnusedParametersTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/arithmetic/DupDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/arithmetic/ModArithTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplicationDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyOneDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/arithmetic/MultiplyZeroDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/arithmetic/SimpleModArithTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/cfg/ControlFlowDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/constparam/ConstantParameterTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/exprargorder/ExprArgOrderTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/mapping/MappingDumper.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/menuaction/MenuActionDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/packethandler/PacketTypeFinderTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/packetwrite/PacketWriteDeobfuscatorTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/transformers/ClientErrorTransformerTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/transformers/buffer/BufferFinderTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/transformers/buffer/RuneliteBufferTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/unreachedcode/UnreachableTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/unusedclass/ClassA.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/unusedclass/EmptyClass.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/deobfuscators/unusedclass/EmptyInterface.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/injection/TestingClassLoader.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/updater/AnnotationCopierTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/updater/AnnotationRenamerTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/deob/updater/UpdateMappingsTest.java create mode 100644 deobfuscator/src/test/java/net/runelite/osb/HookImporter.java create mode 100644 deobfuscator/src/test/java/net/runelite/osb/inject/ClassHook.java create mode 100644 deobfuscator/src/test/java/net/runelite/osb/inject/FieldHook.java create mode 100644 deobfuscator/src/test/java/net/runelite/osb/inject/MethodHook.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/CheckExports.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/CheckMappings.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/MappingImporter.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/Utils.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/AddFieldInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/AddInterfaceInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/AddMethodInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/GetterInjectInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/Injection.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/InjectionModscript.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/InstructionDeserializer.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/MethodModInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/ReplaceNodeInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/SuperChangeInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/TableJumpInstruction$TableJump.java create mode 100644 deobfuscator/src/test/java/net/runelite/runeloader/inject/TableJumpInstruction.java create mode 100644 deobfuscator/src/test/java/net/runelite/runesuite/HookClass.java create mode 100644 deobfuscator/src/test/java/net/runelite/runesuite/HookField.java create mode 100644 deobfuscator/src/test/java/net/runelite/runesuite/HookImporter.java create mode 100644 deobfuscator/src/test/java/net/runelite/runesuite/HookMethod.java create mode 100644 deobfuscator/src/test/java/net/runelite/runesuite/hooks.json create mode 100644 deobfuscator/src/test/resources/deob-test.properties create mode 100644 injected-client/pom.xml create mode 100644 injector-plugin/pom.xml create mode 100644 injector-plugin/src/main/java/net/runelite/injector/Inject.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectConstruct.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectGetter.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectHook.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectHookMethod.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectInvoker.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectMojo.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectSetter.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectionException.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/Injector.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/InjectorValidator.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/MixinInjector.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/ClearColorBuffer.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/DrawAfterWidgets.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/DrawMenu.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/RasterizerHook.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/RenderDraw.java create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/ScriptVM.java create mode 100644 injector-plugin/src/test/java/net/runelite/injector/InjectConstructTest.java create mode 100644 injector-plugin/src/test/java/net/runelite/injector/InjectHookMethodTest.java create mode 100644 injector-plugin/src/test/java/net/runelite/injector/InjectSetterTest.java create mode 100644 injector-plugin/src/test/java/net/runelite/injector/InjectTest.java create mode 100644 injector-plugin/src/test/java/net/runelite/injector/MixinInjectorTest.java create mode 100644 injector-plugin/src/test/java/net/runelite/injector/raw/DrawAfterWidgetsTest.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridOverlay.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSIndexDataBaseMixin.java => RSAbstractIndexCacheMixin.java} (60%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSBoundaryObjectMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSCanvasMixin.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSChatLineBufferMixin.java => RSChatChannelMixin.java} (89%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSClanChatMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSClanMateMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSEnumDefinitionMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSFloorDecorationMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSFriendSystemMixin.java delete mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSGameCanvasMixin.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSGameEngineMixin.java => RSGameShellMixin.java} (93%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSGraphicsObjectMixin.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSItemMixin.java => RSGroundItemMixin.java} (52%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSGroundItemPileMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java delete mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSIgnoredMixin.java delete mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSItemCompositionMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSItemDefinitionMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSKeyHandlerMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSMessageMixin.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSMouseInputMixin.java => RSMouseHandlerMixin.java} (67%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSNPCDefinitionMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSNodeHashTableMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSPlayerAppearanceMixin.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSMainBufferProviderMixin.java => RSRasterProviderMixin.java} (54%) rename runelite-mixins/src/main/java/net/runelite/mixins/{Rasterizer2DMixin.java => RSRasterizer2DMixin.java} (78%) rename runelite-mixins/src/main/java/net/runelite/mixins/{RSSequenceMixin.java => RSSequenceDefinitionMixin.java} (72%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSSpriteMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSTileModelMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSTileObjectMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSTilePaintMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java rename runelite-mixins/src/main/java/net/runelite/mixins/{RSDecorativeObjectMixin.java => RSWallDecorationMixin.java} (57%) create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMapManagerMixin.java create mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSWorldMapMixin.java delete mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/TileObjectMixin.java create mode 100644 runescape-api/src/main/java/net/runelite/mapping/Export.java create mode 100644 runescape-api/src/main/java/net/runelite/mapping/Implements.java create mode 100644 runescape-api/src/main/java/net/runelite/mapping/ObfuscatedGetter.java create mode 100644 runescape-api/src/main/java/net/runelite/mapping/ObfuscatedName.java create mode 100644 runescape-api/src/main/java/net/runelite/mapping/ObfuscatedSignature.java diff --git a/deobfuscator/pom.xml b/deobfuscator/pom.xml new file mode 100644 index 0000000000..a4e14d1261 --- /dev/null +++ b/deobfuscator/pom.xml @@ -0,0 +1,173 @@ + + + + 4.0.0 + + + net.runelite + runelite-parent + 1.5.27-SNAPSHOT + + + deobfuscator + Deobfuscator + + + + net.runelite + runelite-api + 1.5.27-SNAPSHOT + + + net.runelite + fernflower + 20171017 + + + + com.google.guava + guava + 27.1-jre + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + 1.7.12 + + + com.google.code.gson + gson + 2.8.5 + + + org.ow2.asm + asm-debug-all + 5.2 + + + + net.runelite.rs + rs-client + 1.5.27-SNAPSHOT + test + + + net.runelite.rs + runescape-api + 1.5.27-SNAPSHOT + + + net.runelite.rs + vanilla + ${rs.version} + test + + + junit + junit + 4.12 + test + + + org.mockito + mockito-all + 1.10.19 + test + + + + + + + src/main/resources + true + + + + + src/test/resources + true + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.3 + + + generate-sources + + + properties + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + true + -Xmx2048m + + + + maven-assembly-plugin + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + diff --git a/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java b/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java new file mode 100644 index 0000000000..dcbbd91bac --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/ClassFile.java @@ -0,0 +1,420 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm; + +import java.util.ArrayList; +import java.util.List; +import net.runelite.asm.attributes.Annotations; +import net.runelite.asm.attributes.annotation.Annotation; +import net.runelite.asm.pool.Class; +import net.runelite.asm.signature.Signature; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +public class ClassFile +{ + private ClassGroup group; + + private ClassFile parent; // super class + private final List children = new ArrayList<>(); // classes which inherit from this + + private int version; + private int access; + private Class name; + private Class super_class; + private String source; + private final Interfaces interfaces; + private final List fields = new ArrayList<>(); + private final List methods = new ArrayList<>(); + private final Annotations annotations; + + public ClassFile(ClassGroup group) + { + this.group = group; + + interfaces = new Interfaces(this); + annotations = new Annotations(); + } + + public ClassFile() + { + this(null); + } + + @Override + public String toString() + { + return "ClassFile{" + "name=" + name + '}'; + } + + public int getVersion() + { + return version; + } + + public void setVersion(int version) + { + this.version = version; + } + + public int getAccess() + { + return access; + } + + public void setAccess(int access) + { + this.access = access; + } + + public void accept(ClassVisitor visitor) + { + String[] ints = interfaces.getInterfaces().stream().map(i -> i.getName()).toArray(String[]::new); + + visitor.visit(version, access, name.getName(), null, super_class.getName(), ints); + visitor.visitSource(source, null); + + for (Annotation annotation : annotations.getAnnotations()) + { + AnnotationVisitor av = visitor.visitAnnotation(annotation.getType().toString(), true); + annotation.accept(av); + } + + for (Field field : fields) + { + FieldVisitor fv = visitor.visitField(field.getAccessFlags(), field.getName(), field.getType().toString(), null, field.getValue()); + field.accept(fv); + } + + for (Method method : methods) + { + String[] exceptions = method.getExceptions().getExceptions().stream().map(cl -> cl.getName()).toArray(String[]::new); + if (exceptions.length == 0) + { + exceptions = null; + } + + MethodVisitor mv = visitor.visitMethod(method.getAccessFlags(), method.getName(), method.getDescriptor().toString(), null, exceptions); + method.accept(mv); + } + + visitor.visitEnd(); + } + + public ClassGroup getGroup() + { + return group; + } + + public void setGroup(ClassGroup group) + { + this.group = group; + } + + public Interfaces getInterfaces() + { + return interfaces; + } + + public List getFields() + { + return fields; + } + + public void addField(Field field) + { + fields.add(field); + } + + public void removeField(Field field) + { + fields.remove(field); + } + + public List getMethods() + { + return methods; + } + + public void addMethod(Method method) + { + methods.add(method); + } + + public void removeMethod(Method method) + { + methods.remove(method); + } + + public Annotations getAnnotations() + { + return annotations; + } + + public String getName() + { + return name.getName(); + } + + public void setName(String name) + { + // Must be removed from the class group map first + assert group == null || this.name == null || group.findClass(this.name.getName()) == null; + + this.name = new Class(name); + } + + public String getClassName() + { + String n = getName(); + int i = n.lastIndexOf('/'); + return n.substring(i + 1); + } + + public String getSuperName() + { + return super_class.getName(); + } + + public void setSuperName(String name) + { + super_class = new Class(name); + } + + public String getSource() + { + return source; + } + + public void setSource(String source) + { + this.source = source; + } + + public Class getParentClass() + { + return this.super_class; + } + + public void setParentClass(Class c) + { + super_class = c; + } + + public ClassFile getParent() + { + return parent; + } + + public List getChildren() + { + return children; + } + + public Field findField(String name, Type type) + { + for (Field f : fields) + { + if (f.getName().equals(name) && f.getType().equals(type)) + { + return f; + } + } + return null; + } + + public Field findField(String name) + { + for (Field f : fields) + { + if (f.getName().equals(name)) + { + return f; + } + } + return null; + } + + public Class getPoolClass() + { + return name; + } + + public Field findFieldDeep(String name, Type type) + { + Field f = findField(name, type); + if (f != null) + { + return f; + } + + ClassFile parent = getParent(); + if (parent != null) + { + return parent.findFieldDeep(name, type); + } + + return null; + } + + public Method findMethod(String name, Signature type) + { + for (Method m : methods) + { + if (m.getName().equals(name) && m.getDescriptor().equals(type)) + { + return m; + } + } + return null; + } + + public Method findMethod(String name) + { + for (Method m : methods) + { + if (m.getName().equals(name)) + { + return m; + } + } + return null; + } + + public Method findMethodDeep(String name, Signature type) + { + Method m = findMethod(name, type); + if (m != null) + { + return m; + } + + ClassFile parent = getParent(); + if (parent != null) + { + return parent.findMethodDeep(name, type); + } + + return null; + } + + public Method findMethodDeepStatic(String name, Signature type) + { + Method m = findMethod(name, type); + if (m != null && m.isStatic()) + { + return m; + } + + ClassFile parent = getParent(); + if (parent != null) + { + return parent.findMethodDeepStatic(name, type); + } + + return null; + } + + public Method findMethodDeep(String name) + { + Method m = findMethod(name); + if (m != null) + { + return m; + } + + ClassFile parent = getParent(); + if (parent != null) + { + return parent.findMethodDeep(name); + } + + return null; + } + + public void clearClassGraph() + { + parent = null; + children.clear(); + } + + public void buildClassGraph() + { + ClassFile other = group.findClass(super_class.getName()); + if (other != null) + { + this.parent = other; + parent.children.add(this); + } + + for (ClassFile i : interfaces.getMyInterfaces()) + { + i.children.add(this); + } + } + + public boolean instanceOf(ClassFile other) + { + return this == other || interfaces.instanceOf(other) || (getParent() != null && getParent().instanceOf(other)); + } + + public boolean isAbstract() + { + return (this.access & Opcodes.ACC_ABSTRACT) != 0; + } + + public boolean isFinal() + { + return (this.access & Opcodes.ACC_FINAL) != 0; + } + + public boolean isInterface() + { + return (this.access & Opcodes.ACC_INTERFACE) != 0; + } + + public boolean isEnum() + { + return (this.access & Opcodes.ACC_ENUM) != 0; + } + + public void setEnum() + { + this.access |= Opcodes.ACC_ENUM; + } + + public void clearFinal() + { + this.access &= ~Opcodes.ACC_FINAL; + } + + public void clearAbstract() + { + this.access &= ~Opcodes.ACC_ABSTRACT; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java b/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java new file mode 100644 index 0000000000..2c6ba531a5 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/ClassGroup.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.runelite.asm.attributes.Code; + +public class ClassGroup +{ + private final List classes = new ArrayList<>(); // to keep order + private final Map classMap = new HashMap<>(); + + public void addClass(ClassFile cf) + { + assert cf.getGroup() == this || cf.getGroup() == null; + cf.setGroup(this); + + classes.add(cf); + classMap.put(cf.getName(), cf); + } + + public void removeClass(ClassFile cf) + { + classes.remove(cf); + classMap.remove(cf.getName()); + } + + public void renameClass(ClassFile cf, String newName) + { + assert classes.contains(cf); + assert classMap.get(cf.getName()) == cf; + + classMap.remove(cf.getName()); + cf.setName(newName); + classMap.put(cf.getName(), cf); + } + + public List getClasses() + { + return Collections.unmodifiableList(classes); + } + + public ClassFile findClass(String name) + { + return classMap.get(name); + } + + public void initialize() + { + buildClassGraph(); + lookup(); + } + + public void buildClassGraph() + { + for (ClassFile c : classes) + { + c.clearClassGraph(); + } + + for (ClassFile c : classes) + { + c.buildClassGraph(); + } + } + + public void lookup() + { + for (ClassFile cf : this.getClasses()) + { + for (Method m : cf.getMethods()) + { + Code code = m.getCode(); + + if (code == null) + { + continue; + } + + code.getInstructions().lookup(); + } + } + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/Field.java b/deobfuscator/src/main/java/net/runelite/asm/Field.java new file mode 100644 index 0000000000..8d70053adb --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/Field.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm; + +import net.runelite.asm.attributes.Annotations; +import net.runelite.asm.attributes.annotation.Annotation; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.FieldVisitor; +import org.objectweb.asm.Opcodes; + +import static org.objectweb.asm.Opcodes.ACC_PRIVATE; +import static org.objectweb.asm.Opcodes.ACC_PROTECTED; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; + +public class Field +{ + public static final int ACCESS_MODIFIERS = ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED; + + private final ClassFile classFile; + + private int accessFlags; + private String name; + private Type type; + private Object value; // ConstantValue + private final Annotations annotations; + + public Field(ClassFile classFile, String name, Type type) + { + this.classFile = classFile; + this.name = name; + this.type = type; + + annotations = new Annotations(); + } + + public void accept(FieldVisitor visitor) + { + for (Annotation annotation : annotations.getAnnotations()) + { + AnnotationVisitor av = visitor.visitAnnotation(annotation.getType().toString(), true); + annotation.accept(av); + } + + visitor.visitEnd(); + } + + public ClassFile getClassFile() + { + return classFile; + } + + public int getAccessFlags() + { + return accessFlags; + } + + public void setAccessFlags(int accessFlags) + { + this.accessFlags = accessFlags; + } + + public boolean isPublic() + { + return (accessFlags & Opcodes.ACC_PUBLIC) != 0; + } + + public void setPublic() + { + accessFlags = (short) ((accessFlags & ~ACCESS_MODIFIERS) | ACC_PUBLIC); + } + + public boolean isStatic() + { + return (accessFlags & Opcodes.ACC_STATIC) != 0; + } + + public void setStatic() + { + accessFlags |= Opcodes.ACC_STATIC; + } + + public boolean isSynthetic() + { + return (accessFlags & Opcodes.ACC_SYNTHETIC) != 0; + } + + public void setEnum() + { + accessFlags |= Opcodes.ACC_ENUM; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Type getType() + { + return type; + } + + public void setType(Type type) + { + this.type = type; + } + + public Object getValue() + { + return value; + } + + public void setValue(Object value) + { + this.value = value; + } + + public Annotations getAnnotations() + { + return annotations; + } + + public net.runelite.asm.pool.Field getPoolField() + { + return new net.runelite.asm.pool.Field( + new net.runelite.asm.pool.Class(classFile.getName()), + this.getName(), + this.getType() + ); + } + + @Override + public String toString() + { + return (this.isStatic() ? "static " : "") + this.type + " " + classFile.getName() + "." + this.getName(); + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/Interfaces.java b/deobfuscator/src/main/java/net/runelite/asm/Interfaces.java new file mode 100644 index 0000000000..a372f9d68c --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/Interfaces.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import net.runelite.asm.pool.Class; + +public class Interfaces +{ + private final ClassFile classFile; + + private final List interfaces = new ArrayList<>(); + + Interfaces(ClassFile c) + { + classFile = c; + } + + public void addInterface(Class clazz) + { + if (!interfaces.contains(clazz)) + { + interfaces.add(clazz); + } + } + + public List getInterfaces() + { + return interfaces; + } + + public void clear() + { + interfaces.clear(); + } + + public List getMyInterfaces() + { + List l = new ArrayList<>(); + for (Class clazz : interfaces) + { + ClassFile iface = classFile.getGroup().findClass(clazz.getName()); + if (iface != null) + { + l.add(iface); + } + } + return l; + } + + public List getNonMyInterfaces() + { + return interfaces.stream().filter(clazz -> classFile.getGroup().findClass(clazz.getName()) == null).collect(Collectors.toList()); + } + + public boolean instanceOf(ClassFile cf) + { + for (Class clazz : interfaces) + { + ClassFile iface = classFile.getGroup().findClass(clazz.getName()); + if (iface.instanceOf(cf)) + { + return true; + } + } + return false; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/Method.java b/deobfuscator/src/main/java/net/runelite/asm/Method.java new file mode 100644 index 0000000000..bc2c8b305b --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/Method.java @@ -0,0 +1,314 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm; + +import java.util.ArrayList; +import java.util.List; +import net.runelite.asm.attributes.Annotations; +import net.runelite.asm.attributes.Code; +import net.runelite.asm.attributes.Exceptions; +import net.runelite.asm.attributes.annotation.Annotation; +import net.runelite.asm.attributes.code.Instruction; +import net.runelite.asm.attributes.code.LocalVariable; +import net.runelite.asm.attributes.code.Parameter; +import net.runelite.asm.attributes.code.instruction.types.LVTInstruction; +import net.runelite.asm.signature.Signature; +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; +import static org.objectweb.asm.Opcodes.ACC_FINAL; +import static org.objectweb.asm.Opcodes.ACC_NATIVE; +import static org.objectweb.asm.Opcodes.ACC_PRIVATE; +import static org.objectweb.asm.Opcodes.ACC_PROTECTED; +import static org.objectweb.asm.Opcodes.ACC_PUBLIC; +import static org.objectweb.asm.Opcodes.ACC_STATIC; +import static org.objectweb.asm.Opcodes.ACC_SYNCHRONIZED; + +public class Method +{ + public static final int ACCESS_MODIFIERS = ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED; + + private final ClassFile classFile; + + private int accessFlags; + private String name; + private Signature arguments; + private Exceptions exceptions; + private Annotations annotations; + private List parameters; + private Code code; + + public Method(ClassFile classFile, String name, Signature signature) + { + this.classFile = classFile; + this.name = name; + this.arguments = signature; + exceptions = new Exceptions(); + annotations = new Annotations(); + parameters = new ArrayList<>(); + } + + public ClassFile getClassFile() + { + return classFile; + } + + @Override + public String toString() + { + return (this.isStatic() ? "static " : "") + classFile.getName() + "." + this.name + this.arguments; + } + + public void accept(MethodVisitor visitor) + { + //This is required to name unused parameters + for (Parameter p : parameters) + { + visitor.visitParameter(p.getName(), p.getAccess()); + } + + for (Annotation annotation : annotations.getAnnotations()) + { + AnnotationVisitor av = visitor.visitAnnotation(annotation.getType().toString(), true); + annotation.accept(av); + } + + if (code != null) + { + code.getInstructions().rebuildLabels(); + + visitor.visitCode(); + + net.runelite.asm.attributes.code.Exceptions exceptions = code.getExceptions(); + for (net.runelite.asm.attributes.code.Exception exception : exceptions.getExceptions()) + { + assert exception.getStart().getLabel() != null; + assert exception.getEnd().getLabel() != null; + assert exception.getHandler().getLabel() != null; + + int idxStart = code.getInstructions().getInstructions().indexOf(exception.getStart()); + int idxEnd = code.getInstructions().getInstructions().indexOf(exception.getEnd()); + + assert idxStart != -1; + assert idxEnd != -1; + assert code.getInstructions().getInstructions().contains(exception.getHandler()); + + assert idxEnd > idxStart; + + visitor.visitTryCatchBlock( + exception.getStart().getLabel(), + exception.getEnd().getLabel(), + exception.getHandler().getLabel(), + exception.getCatchType() != null ? exception.getCatchType().getName() : null + ); + } + + for (Instruction i : code.getInstructions().getInstructions()) + { + i.accept(visitor); + } + + //Find first and last label for this method + if (parameters.size() > 0) + { + Label startLabel = null; + Label endLabel = null; + for (Instruction i : code.getInstructions().getInstructions()) + { + if (i instanceof net.runelite.asm.attributes.code.Label) + { + if (startLabel == null) + { + startLabel = ((net.runelite.asm.attributes.code.Label) i).getLabel(); + } + endLabel = ((net.runelite.asm.attributes.code.Label) i).getLabel(); + } + } + + for (Parameter p : parameters) + { + LocalVariable lv = p.getLocalVariable(); + if (lv != null) + { + visitor.visitLocalVariable(lv.getName(), lv.getDesc(), lv.getSignature(), startLabel, endLabel, lv.getIndex()); + } + } + } + + visitor.visitMaxs(code.getMaxStack(), code.getMaxLocals()); + } + + visitor.visitEnd(); + } + + public int getAccessFlags() + { + return accessFlags; + } + + public void setAccessFlags(int accessFlags) + { + this.accessFlags = accessFlags; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Signature getDescriptor() + { + return arguments; + } + + public void setDescriptor(Signature signature) + { + this.arguments = signature; + } + + public boolean isNative() + { + return (accessFlags & ACC_NATIVE) != 0; + } + + public boolean isStatic() + { + return (accessFlags & ACC_STATIC) != 0; + } + + public void setStatic() + { + accessFlags |= ACC_STATIC; + } + + public boolean isSynchronized() + { + return (accessFlags & ACC_SYNCHRONIZED) != 0; + } + + public boolean isFinal() + { + return (accessFlags & ACC_FINAL) != 0; + } + + public void setFinal(boolean f) + { + if (f) + { + accessFlags |= ACC_FINAL; + } + else + { + accessFlags &= ~ACC_FINAL; + } + } + + public boolean isPrivate() + { + return (accessFlags & ACC_PRIVATE) != 0; + } + + public void setPrivate() + { + accessFlags = (short) ((accessFlags & ~ACCESS_MODIFIERS) | ACC_PRIVATE); + } + + public void setPublic() + { + accessFlags = (short) ((accessFlags & ~ACCESS_MODIFIERS) | ACC_PUBLIC); + } + + public Exceptions getExceptions() + { + return exceptions; + } + + public Code getCode() + { + return code; + } + + public void setCode(Code code) + { + this.code = code; + } + + public Annotations getAnnotations() + { + return annotations; + } + + @SuppressWarnings("unchecked") + public List findLVTInstructionsForVariable(int index) + { + List list = new ArrayList<>(); + + if (getCode() == null) + { + return null; + } + + for (Instruction ins : getCode().getInstructions().getInstructions()) + { + if (ins instanceof LVTInstruction) + { + LVTInstruction lv = (LVTInstruction) ins; + + if (lv.getVariableIndex() != index) + { + continue; + } + + list.add((T) ins); + } + } + + return list; + } + + public net.runelite.asm.pool.Method getPoolMethod() + { + return new net.runelite.asm.pool.Method( + new net.runelite.asm.pool.Class(classFile.getName()), + name, + arguments + ); + } + + public List getParameters() + { + return parameters; + } + + public void setParameters(List parameters) + { + this.parameters = parameters; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/Type.java b/deobfuscator/src/main/java/net/runelite/asm/Type.java new file mode 100644 index 0000000000..68ba6960d4 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/Type.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm; + +import net.runelite.asm.pool.Class; + +/** + * Created by Kyle Fricilone on 8/20/2017 + */ +public class Type +{ + + public static final Type VOID = new Type("V"); + public static final Type BOOLEAN = new Type("Z"); + public static final Type CHAR = new Type("C"); + public static final Type BYTE = new Type("B"); + public static final Type SHORT = new Type("S"); + public static final Type INT = new Type("I"); + public static final Type FLOAT = new Type("F"); + public static final Type LONG = new Type("J"); + public static final Type DOUBLE = new Type("D"); + public static final Type OBJECT = new Type("Ljava/lang/Object;"); + public static final Type STRING = new Type("Ljava/lang/String;"); + public static final Type THROWABLE = new Type("Ljava/lang/Throwable;"); + public static final Type EXCEPTION = new Type("Ljava/lang/Exception;"); + + private final String type; + + public Type(String type) + { + this.type = type; + } + + public boolean isPrimitive() + { + return this.equals(BOOLEAN) || this.equals(BYTE) || this.equals(SHORT) || this.equals(CHAR) || this.equals(INT) + || this.equals(VOID) || this.equals(LONG) || this.equals(FLOAT) || this.equals(DOUBLE); + } + + public boolean isObject() + { + return this.equals(OBJECT); + } + + public boolean isArray() + { + return getDimensions() > 0; + } + + public boolean isStackInt() + { + return this.equals(BOOLEAN) || this.equals(BYTE) || this.equals(SHORT) || this.equals(CHAR) || this.equals(INT); + } + + public int getSize() + { + if (this.equals(LONG) || this.equals(DOUBLE)) + { + return 2; + } + + if (this.equals(VOID)) + { + return 0; + } + + return 1; + } + + public int getDimensions() + { + return getDimensions(type); + } + + public Type getSubtype() + { + if (!type.startsWith("[")) + { + throw new IllegalStateException(type + " is not an array"); + } + return new Type(type.substring(1)); + } + + public String getInternalName() + { + String s = type; + while (s.startsWith("[")) + { + s = s.substring(1); + } + if (s.startsWith("L")) + { + return s.substring(1, s.length() - 1); + } + else + { + return s; + } + } + + @Override + public boolean equals(Object o) + { + if (!(o instanceof Type)) + { + return false; + } + + Type other = (Type) o; + return type.equals(other.type); + } + + @Override + public int hashCode() + { + return type.hashCode(); + } + + @Override + public String toString() + { + return type; + } + + public String toAsmString() + { + if (type.startsWith("L") && type.endsWith(";")) + { + return type.substring(1, type.length() - 1); + } + else + { + return type; + } + } + + public static Type fromAsmString(String str) + { + if (str.startsWith("[")) + { + // array type + return new Type(str); + } + else + { + // object type + return new Type("L" + str + ";"); + } + } + + private static int getDimensions(String type) + { + if (!type.startsWith("[")) + { + return 0; + } + + return (int) type.chars().filter(i -> i == '[').count(); + } + + public static Type getType(String type, int dims) + { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < dims; i++) + { + builder.append('['); + } + return new Type(builder.append(type).toString()); + } + + public static Type getType(Object object) + { + Type type; + + if (object instanceof Double) + { + type = DOUBLE; + } + else if (object instanceof Float) + { + type = FLOAT; + } + else if (object instanceof Integer) + { + type = INT; + } + else if (object instanceof Long) + { + type = LONG; + } + else if (object instanceof String) + { + type = STRING; + } + else if (object instanceof Class) + { + type = new Type("L" + ((Class) object).getName() + ";"); + } + else + { + throw new IllegalArgumentException("Unexpected object type: " + object.getClass()); + } + + return type; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java new file mode 100644 index 0000000000..b14d761c28 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/Annotations.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes; + +import java.util.ArrayList; +import java.util.List; + +import net.runelite.asm.Type; +import net.runelite.asm.attributes.annotation.Annotation; +import net.runelite.asm.attributes.annotation.Element; + +public class Annotations +{ + private final List annotations = new ArrayList<>(); + + public List getAnnotations() + { + return annotations; + } + + public void addAnnotation(Annotation annotation) + { + annotations.add(annotation); + } + + public void removeAnnotation(Annotation annotation) + { + annotations.remove(annotation); + } + + public void clearAnnotations() + { + annotations.clear(); + } + + public Annotation find(Type type) + { + for (Annotation a : annotations) + if (a.getType().equals(type)) + return a; + return null; + } + + public int size() + { + return annotations.size(); + } + + public Annotation addAnnotation(Type type, String name, Object value) + { + Annotation annotation = new Annotation(this); + annotation.setType(type); + addAnnotation(annotation); + + Element element = new Element(annotation); + element.setName(name); + element.setValue(value); + annotation.addElement(element); + + return annotation; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java new file mode 100644 index 0000000000..2a3f08126c --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/Code.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes; + +import net.runelite.asm.Method; +import net.runelite.asm.attributes.code.Exceptions; +import net.runelite.asm.attributes.code.Instruction; +import net.runelite.asm.attributes.code.Instructions; +import net.runelite.asm.attributes.code.instruction.types.LVTInstruction; +import net.runelite.asm.signature.Signature; + +public class Code +{ + private Method method; + private int maxStack; + private Instructions instructions; + private final Exceptions exceptions; + + public Code(Method method) + { + this.method = method; + + exceptions = new Exceptions(this); + instructions = new Instructions(this); + } + + public Method getMethod() + { + return method; + } + + public int getMaxStack() + { + return maxStack; + } + + public void setMaxStack(int maxStack) + { + this.maxStack = maxStack; + } + + private int getMaxLocalsFromSig() + { + Method m = getMethod(); + int num = m.isStatic() ? 0 : 1; + Signature sig = m.getDescriptor(); + for (int i = 0; i < sig.size(); ++i) + num += sig.getTypeOfArg(i).getSize(); + return num; + } + + /** + * calculates the size of the lvt required for this method + * @return + */ + public int getMaxLocals() + { + int max = -1; + + for (Instruction ins : instructions.getInstructions()) + { + if (ins instanceof LVTInstruction) + { + LVTInstruction lvt = (LVTInstruction) ins; + + int sizeRequired = lvt.getVariableIndex() + lvt.type().getSlots(); + if (sizeRequired > max) + { + max = sizeRequired; + } + } + } + + int fromSig = getMaxLocalsFromSig(); + if (fromSig > max) + max = fromSig; + + return max; + } + + public Exceptions getExceptions() + { + return exceptions; + } + + public Instructions getInstructions() + { + return instructions; + } +} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSHashTableMixin.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java similarity index 65% rename from runelite-mixins/src/main/java/net/runelite/mixins/RSHashTableMixin.java rename to deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java index ae82420438..0b12c513fd 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSHashTableMixin.java +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/Exceptions.java @@ -22,42 +22,38 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.mixins; + +package net.runelite.asm.attributes; import java.util.ArrayList; -import java.util.Collection; import java.util.List; -import net.runelite.api.Node; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.Mixin; -import net.runelite.rs.api.RSHashTable; -import net.runelite.rs.api.RSNode; +import net.runelite.asm.ClassFile; +import net.runelite.asm.pool.Class; -@Mixin(RSHashTable.class) -public abstract class RSHashTableMixin implements RSHashTable +public class Exceptions { - @Inject - @Override - public Collection getNodes() + private final List classes = new ArrayList<>(); + + public void addException(Class cl) { - // Copied in RSWidgetMixin.getParentId to reduce allocations - List nodes = new ArrayList(); + classes.add(cl); + } - RSNode[] buckets = getBuckets(); - for (int i = 0; i < buckets.length; ++i) + public List getExceptions() + { + return classes; + } + + public void renameClass(ClassFile cf, String name) + { + for (Class c : new ArrayList<>(classes)) { - Node node = buckets[i]; - - // It looks like the first node in the bucket is always - // a sentinel - Node cur = node.getNext(); - while (cur != node) + if (c.getName().equals(cf.getName())) { - nodes.add(cur); - cur = cur.getNext(); + int idx = classes.indexOf(c); + classes.remove(idx); + classes.add(idx, new Class(name)); } } - - return nodes; } } diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java new file mode 100644 index 0000000000..7c727eb788 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Annotation.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.annotation; + +import java.util.ArrayList; +import java.util.List; + +import net.runelite.asm.Type; +import net.runelite.asm.attributes.Annotations; +import org.objectweb.asm.AnnotationVisitor; + +public class Annotation +{ + private final Annotations annotations; + private Type type; + private final List elements = new ArrayList<>(); + + public Annotation(Annotations annotations) + { + this.annotations = annotations; + } + + public Annotations getAnnotations() + { + return annotations; + } + + public void setType(Type type) + { + this.type = type; + } + + public Type getType() + { + return type; + } + + public List getElements() + { + return elements; + } + + public Element getElement() + { + return elements.get(0); + } + + public void addElement(Element element) + { + elements.add(element); + } + + public void accept(AnnotationVisitor visitor) + { + for (Element element : elements) + visitor.visit(element.getName(), element.getValue()); + visitor.visitEnd(); + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java new file mode 100644 index 0000000000..18fdfa33f4 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/annotation/Element.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.annotation; + +public class Element +{ + private final Annotation annotation; + private String name; + private Object value; + + public Element(Annotation annotation) + { + this.annotation = annotation; + } + + public Annotation getAnnotation() + { + return annotation; + } + + public String getName() + { + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public Object getValue() + { + return value; + } + + public void setValue(Object value) + { + this.value = value; + } + + public String getString() + { + return value.toString(); + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java new file mode 100644 index 0000000000..b1209a6631 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exception.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code; + +import net.runelite.asm.ClassFile; +import net.runelite.asm.pool.Class; + +public class Exception implements Cloneable +{ + private Exceptions exceptions; + + private Label start, end, handler; + private Class catchType; + + public Exception(Exceptions exceptions) + { + this.exceptions = exceptions; + } + + @Override + public Exception clone() + { + try + { + return (Exception) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(); + } + } + + public Exceptions getExceptions() + { + return exceptions; + } + + public void setExceptions(Exceptions exceptions) + { + this.exceptions = exceptions; + } + + public Label getStart() + { + return start; + } + + public void setStart(Label ins) + { + start = ins; + } + + public Label getEnd() + { + return end; + } + + public void setEnd(Label end) + { + this.end = end; + } + + public Label getHandler() + { + return handler; + } + + public void setHandler(Label handler) + { + this.handler = handler; + } + + public Class getCatchType() + { + return catchType; + } + + public void setCatchType(Class catchType) + { + this.catchType = catchType; + } + + public void renameClass(ClassFile cf, String name) + { + if (catchType != null && cf.getName().equals(catchType.getName())) + catchType = new Class(name); + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java new file mode 100644 index 0000000000..30b00a0115 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Exceptions.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code; + +import java.util.ArrayList; +import java.util.List; +import net.runelite.asm.ClassFile; +import net.runelite.asm.attributes.Code; + +public class Exceptions +{ + private Code code; + private List exceptions = new ArrayList(); + + public Exceptions(Code code) + { + this.code = code; + } + + public void add(Exception e) + { + exceptions.add(e); + } + + public void remove(Exception e) + { + exceptions.remove(e); + } + + public void clear() + { + exceptions.clear(); + } + + public Code getCode() + { + return code; + } + + public List getExceptions() + { + return exceptions; + } + + public void renameClass(ClassFile cf, String name) + { + for (Exception e : exceptions) + e.renameClass(cf, name); + } +} \ No newline at end of file diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java new file mode 100644 index 0000000000..bf8e64535e --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instruction.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code; + +import net.runelite.asm.Method; +import net.runelite.asm.execution.Frame; +import net.runelite.asm.execution.InstructionContext; +import org.objectweb.asm.MethodVisitor; + +public abstract class Instruction implements Cloneable +{ + private Instructions instructions; + private InstructionType type; + + public Instruction(Instructions instructions, InstructionType type) + { + this.instructions = instructions; + this.type = type; + } + + @Override + public String toString() + { + if (this.getInstructions() != null) + { + Method m = this.getInstructions().getCode().getMethod(); + return super.toString() + " in " + m;// + " at pc 0x" + Integer.toHexString(this.getPc()); + } + else + { + return super.toString() + " "; + } + } + + @Override + public Instruction clone() + { + Instruction i; + try + { + i = (Instruction) super.clone(); + } + catch (CloneNotSupportedException ex) + { + throw new RuntimeException(ex); + } + + return i; + } + + protected void remove() + { + Exceptions exceptions = instructions.getCode().getExceptions(); + for (Exception e : exceptions.getExceptions()) + { + assert this != e.getStart(); + assert this != e.getEnd(); + assert this != e.getHandler(); + } + } + + public boolean removeStack() + { + assert instructions != null; + + this.getInstructions().remove(this); // calls remove() + + return true; + } + + // resolve jumps + public void resolve() + { + } + + public void accept(MethodVisitor visitor) + { + visitor.visitInsn(this.getType().getCode()); + } + + public Instructions getInstructions() + { + return instructions; + } + + public void setInstructions(Instructions instructions) + { + this.instructions = instructions; + } + + public InstructionType getType() + { + return type; + } + + protected void setType(InstructionType type) + { + this.type = type; + } + + public abstract InstructionContext execute(Frame e); + + /* does this terminate a block? */ + public boolean isTerminal() + { + return false; + } + + // look up symbols from pool + public void lookup() + { + } + + // instructions keep resolved method/field/class names, this updates the pool value (if the underlying resolved object changes) + public void regeneratePool() + { + } + + public void renameClass(String oldName, String newName) + { + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java new file mode 100644 index 0000000000..0c347d4809 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/InstructionType.java @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code; + +import net.runelite.asm.attributes.code.instructions.AALoad; +import net.runelite.asm.attributes.code.instructions.AAStore; +import net.runelite.asm.attributes.code.instructions.AConstNull; +import net.runelite.asm.attributes.code.instructions.ALoad; +import net.runelite.asm.attributes.code.instructions.ANewArray; +import net.runelite.asm.attributes.code.instructions.AStore; +import net.runelite.asm.attributes.code.instructions.AThrow; +import net.runelite.asm.attributes.code.instructions.ArrayLength; +import net.runelite.asm.attributes.code.instructions.BALoad; +import net.runelite.asm.attributes.code.instructions.BAStore; +import net.runelite.asm.attributes.code.instructions.BiPush; +import net.runelite.asm.attributes.code.instructions.CALoad; +import net.runelite.asm.attributes.code.instructions.CAStore; +import net.runelite.asm.attributes.code.instructions.CheckCast; +import net.runelite.asm.attributes.code.instructions.D2F; +import net.runelite.asm.attributes.code.instructions.D2I; +import net.runelite.asm.attributes.code.instructions.D2L; +import net.runelite.asm.attributes.code.instructions.DALoad; +import net.runelite.asm.attributes.code.instructions.DAStore; +import net.runelite.asm.attributes.code.instructions.DAdd; +import net.runelite.asm.attributes.code.instructions.DCmpG; +import net.runelite.asm.attributes.code.instructions.DCmpL; +import net.runelite.asm.attributes.code.instructions.DDiv; +import net.runelite.asm.attributes.code.instructions.DLoad; +import net.runelite.asm.attributes.code.instructions.DMul; +import net.runelite.asm.attributes.code.instructions.DNeg; +import net.runelite.asm.attributes.code.instructions.DRem; +import net.runelite.asm.attributes.code.instructions.DStore; +import net.runelite.asm.attributes.code.instructions.DSub; +import net.runelite.asm.attributes.code.instructions.Dup; +import net.runelite.asm.attributes.code.instructions.Dup2; +import net.runelite.asm.attributes.code.instructions.Dup2_X1; +import net.runelite.asm.attributes.code.instructions.Dup2_X2; +import net.runelite.asm.attributes.code.instructions.Dup_X1; +import net.runelite.asm.attributes.code.instructions.Dup_X2; +import net.runelite.asm.attributes.code.instructions.F2D; +import net.runelite.asm.attributes.code.instructions.F2I; +import net.runelite.asm.attributes.code.instructions.F2L; +import net.runelite.asm.attributes.code.instructions.FALoad; +import net.runelite.asm.attributes.code.instructions.FAStore; +import net.runelite.asm.attributes.code.instructions.FAdd; +import net.runelite.asm.attributes.code.instructions.FCmpG; +import net.runelite.asm.attributes.code.instructions.FCmpL; +import net.runelite.asm.attributes.code.instructions.FDiv; +import net.runelite.asm.attributes.code.instructions.FLoad; +import net.runelite.asm.attributes.code.instructions.FMul; +import net.runelite.asm.attributes.code.instructions.FNeg; +import net.runelite.asm.attributes.code.instructions.FRem; +import net.runelite.asm.attributes.code.instructions.FStore; +import net.runelite.asm.attributes.code.instructions.FSub; +import net.runelite.asm.attributes.code.instructions.GetField; +import net.runelite.asm.attributes.code.instructions.GetStatic; +import net.runelite.asm.attributes.code.instructions.Goto; +import net.runelite.asm.attributes.code.instructions.GotoW; +import net.runelite.asm.attributes.code.instructions.I2B; +import net.runelite.asm.attributes.code.instructions.I2C; +import net.runelite.asm.attributes.code.instructions.I2D; +import net.runelite.asm.attributes.code.instructions.I2F; +import net.runelite.asm.attributes.code.instructions.I2L; +import net.runelite.asm.attributes.code.instructions.I2S; +import net.runelite.asm.attributes.code.instructions.IALoad; +import net.runelite.asm.attributes.code.instructions.IAStore; +import net.runelite.asm.attributes.code.instructions.IAdd; +import net.runelite.asm.attributes.code.instructions.IAnd; +import net.runelite.asm.attributes.code.instructions.IDiv; +import net.runelite.asm.attributes.code.instructions.IInc; +import net.runelite.asm.attributes.code.instructions.ILoad; +import net.runelite.asm.attributes.code.instructions.IMul; +import net.runelite.asm.attributes.code.instructions.INeg; +import net.runelite.asm.attributes.code.instructions.IOr; +import net.runelite.asm.attributes.code.instructions.IRem; +import net.runelite.asm.attributes.code.instructions.IShL; +import net.runelite.asm.attributes.code.instructions.IShR; +import net.runelite.asm.attributes.code.instructions.IStore; +import net.runelite.asm.attributes.code.instructions.ISub; +import net.runelite.asm.attributes.code.instructions.IUShR; +import net.runelite.asm.attributes.code.instructions.IXor; +import net.runelite.asm.attributes.code.instructions.IfACmpEq; +import net.runelite.asm.attributes.code.instructions.IfACmpNe; +import net.runelite.asm.attributes.code.instructions.IfCmpGe; +import net.runelite.asm.attributes.code.instructions.IfCmpGt; +import net.runelite.asm.attributes.code.instructions.IfCmpLe; +import net.runelite.asm.attributes.code.instructions.IfCmpLt; +import net.runelite.asm.attributes.code.instructions.IfEq; +import net.runelite.asm.attributes.code.instructions.IfGe; +import net.runelite.asm.attributes.code.instructions.IfGt; +import net.runelite.asm.attributes.code.instructions.IfICmpEq; +import net.runelite.asm.attributes.code.instructions.IfICmpNe; +import net.runelite.asm.attributes.code.instructions.IfLe; +import net.runelite.asm.attributes.code.instructions.IfLt; +import net.runelite.asm.attributes.code.instructions.IfNe; +import net.runelite.asm.attributes.code.instructions.IfNonNull; +import net.runelite.asm.attributes.code.instructions.IfNull; +import net.runelite.asm.attributes.code.instructions.InstanceOf; +import net.runelite.asm.attributes.code.instructions.InvokeDynamic; +import net.runelite.asm.attributes.code.instructions.InvokeInterface; +import net.runelite.asm.attributes.code.instructions.InvokeSpecial; +import net.runelite.asm.attributes.code.instructions.InvokeStatic; +import net.runelite.asm.attributes.code.instructions.InvokeVirtual; +import net.runelite.asm.attributes.code.instructions.L2D; +import net.runelite.asm.attributes.code.instructions.L2F; +import net.runelite.asm.attributes.code.instructions.L2I; +import net.runelite.asm.attributes.code.instructions.LALoad; +import net.runelite.asm.attributes.code.instructions.LAStore; +import net.runelite.asm.attributes.code.instructions.LAdd; +import net.runelite.asm.attributes.code.instructions.LAnd; +import net.runelite.asm.attributes.code.instructions.LCmp; +import net.runelite.asm.attributes.code.instructions.LDC; +import net.runelite.asm.attributes.code.instructions.LDiv; +import net.runelite.asm.attributes.code.instructions.LLoad; +import net.runelite.asm.attributes.code.instructions.LMul; +import net.runelite.asm.attributes.code.instructions.LNeg; +import net.runelite.asm.attributes.code.instructions.LOr; +import net.runelite.asm.attributes.code.instructions.LRem; +import net.runelite.asm.attributes.code.instructions.LShL; +import net.runelite.asm.attributes.code.instructions.LShR; +import net.runelite.asm.attributes.code.instructions.LStore; +import net.runelite.asm.attributes.code.instructions.LSub; +import net.runelite.asm.attributes.code.instructions.LUShR; +import net.runelite.asm.attributes.code.instructions.LXor; +import net.runelite.asm.attributes.code.instructions.LookupSwitch; +import net.runelite.asm.attributes.code.instructions.MonitorEnter; +import net.runelite.asm.attributes.code.instructions.MonitorExit; +import net.runelite.asm.attributes.code.instructions.MultiANewArray; +import net.runelite.asm.attributes.code.instructions.NOP; +import net.runelite.asm.attributes.code.instructions.New; +import net.runelite.asm.attributes.code.instructions.NewArray; +import net.runelite.asm.attributes.code.instructions.Pop; +import net.runelite.asm.attributes.code.instructions.Pop2; +import net.runelite.asm.attributes.code.instructions.PutField; +import net.runelite.asm.attributes.code.instructions.PutStatic; +import net.runelite.asm.attributes.code.instructions.Return; +import net.runelite.asm.attributes.code.instructions.SALoad; +import net.runelite.asm.attributes.code.instructions.SAStore; +import net.runelite.asm.attributes.code.instructions.SiPush; +import net.runelite.asm.attributes.code.instructions.Swap; +import net.runelite.asm.attributes.code.instructions.TableSwitch; +import net.runelite.asm.attributes.code.instructions.VReturn; + +public enum InstructionType +{ + NOP(0x00, "nop", NOP.class), + ACONST_NULL(0x01, "aconst_null", AConstNull.class), + BIPUSH(0x10, "bipush", BiPush.class), + SIPUSH(0x11, "sipush", SiPush.class), + LDC(-1, "ldc", LDC.class), + ILOAD(0x15, "iload", ILoad.class), + LLOAD(0x16, "lload", LLoad.class), + FLOAD(0x17, "fload", FLoad.class), + DLOAD(0x18, "dload", DLoad.class), + ALOAD(0x19, "aload", ALoad.class), + IALOAD(0x2e, "iaload", IALoad.class), + LALOAD(0x2f, "laload", LALoad.class), + FALOAD(0x30, "faload", FALoad.class), + DALOAD(0x31, "daload", DALoad.class), + AALOAD(0x32, "aaload", AALoad.class), + BALOAD(0x33, "baload", BALoad.class), + CALOAD(0x34, "caload", CALoad.class), + SALOAD(0x35, "saload", SALoad.class), + ISTORE(0x36, "istore", IStore.class), + LSTORE(0x37, "lstore", LStore.class), + FSTORE(0x38, "fstore", FStore.class), + DSTORE(0x39, "dstore", DStore.class), + ASTORE(0x3a, "astore", AStore.class), + IASTORE(0x4f, "iastore", IAStore.class), + LASTORE(0x50, "lastore", LAStore.class), + FASTORE(0x51, "fastore", FAStore.class), + DASTORE(0x52, "dastore", DAStore.class), + AASTORE(0x53, "aastore", AAStore.class), + BASTORE(0x54, "bastore", BAStore.class), + CASTORE(0x55, "castore", CAStore.class), + SASTORE(0x56, "sastore", SAStore.class), + POP(0x57, "pop", Pop.class), + POP2(0x58, "pop2", Pop2.class), + DUP(0x59, "dup", Dup.class), + DUP_X1(0x5a, "dup_x1", Dup_X1.class), + DUP_X2(0x5b, "dup_x2", Dup_X2.class), + DUP2(0x5c, "dup2", Dup2.class), + DUP2_X1(0x5d, "dup2_x1", Dup2_X1.class), + DUP2_X2(0x5e, "dup2_x2", Dup2_X2.class), + SWAP(0x5f, "swap", Swap.class), + IADD(0x60, "iadd", IAdd.class), + LADD(0x61, "ladd", LAdd.class), + FADD(0x62, "fadd", FAdd.class), + DADD(0x63, "dadd", DAdd.class), + ISUB(0x64, "isub", ISub.class), + LSUB(0x65, "lsub", LSub.class), + FSUB(0x66, "fsub", FSub.class), + DSUB(0x67, "dsub", DSub.class), + IMUL(0x68, "imul", IMul.class), + LMUL(0x69, "lmul", LMul.class), + FMUL(0x6a, "fmul", FMul.class), + DMUL(0x6b, "dmul", DMul.class), + IDIV(0x6c, "idiv", IDiv.class), + LDIV(0x6d, "ldiv", LDiv.class), + FDIV(0x6e, "fdiv", FDiv.class), + DDIV(0x6f, "ddiv", DDiv.class), + IREM(0x70, "irem", IRem.class), + LREM(0x71, "lrem", LRem.class), + FREM(0x72, "frem", FRem.class), + DREM(0x73, "drem", DRem.class), + INEG(0x74, "ineg", INeg.class), + LNEG(0x75, "lneg", LNeg.class), + FNEG(0x76, "fneg", FNeg.class), + DNEG(0x77, "dneg", DNeg.class), + ISHL(0x78, "ishl", IShL.class), + LSHL(0x79, "lshl", LShL.class), + ISHR(0x7a, "ishr", IShR.class), + LSHR(0x7b, "lshr", LShR.class), + IUSHR(0x7c, "iushr", IUShR.class), + LUSHR(0x7d, "lushr", LUShR.class), + IAND(0x7e, "iand", IAnd.class), + LAND(0x7f, "land", LAnd.class), + IOR(0x80, "ior", IOr.class), + LOR(0x81, "lor", LOr.class), + IXOR(0x82, "ixor", IXor.class), + LXOR(0x83, "lxor", LXor.class), + IINC(0x84, "iinc", IInc.class), + I2L(0x85, "i2l", I2L.class), + I2F(0x86, "i2f", I2F.class), + I2D(0x87, "i2d", I2D.class), + L2I(0x88, "l2i", L2I.class), + L2F(0x89, "l2f", L2F.class), + L2D(0x8a, "l2d", L2D.class), + F2I(0x8b, "f2i", F2I.class), + F2L(0x8c, "f2l", F2L.class), + F2D(0x8d, "f2d", F2D.class), + D2I(0x8e, "d2i", D2I.class), + D2L(0x8f, "d2l", D2L.class), + D2F(0x90, "d2f", D2F.class), + I2B(0x91, "i2b", I2B.class), + I2C(0x92, "i2c", I2C.class), + I2S(0x93, "i2s", I2S.class), + LCMP(0x94, "lcmp", LCmp.class), + FCMPL(0x95, "fcmpl", FCmpL.class), + FCMPG(0x96, "fcmpg", FCmpG.class), + DCMPL(0x97, "dcmpl", DCmpL.class), + DCMPG(0x98, "dcmpg", DCmpG.class), + IFEQ(0x99, "ifeq", IfEq.class), + IFNE(0x9a, "ifne", IfNe.class), + IFLT(0x9b, "iflt", IfLt.class), + IFGE(0x9c, "ifge", IfGe.class), + IFGT(0x9d, "ifgt", IfGt.class), + IFLE(0x9e, "ifle", IfLe.class), + IF_ICMPEQ(0x9f, "if_icmpeq", IfICmpEq.class), + IF_ICMPNE(0xa0, "if_icmpne", IfICmpNe.class), + IF_ICMPLT(0xa1, "if_cmplt", IfCmpLt.class), + IF_ICMPGE(0xa2, "if_icmpge", IfCmpGe.class), + IF_ICMPGT(0xa3, "if_icmpgt", IfCmpGt.class), + IF_ICMPLE(0xa4, "if_icmple", IfCmpLe.class), + IF_ACMPEQ(0xa5, "if_acmpeq", IfACmpEq.class), + IF_ACMPNE(0xa6, "if_acmpne", IfACmpNe.class), + GOTO(0xa7, "goto", Goto.class), + TABLESWITCH(0xaa, "tableswitch", TableSwitch.class), + LOOKUPSWITCH(0xab, "lookupswitch", LookupSwitch.class), + IRETURN(0xac, "ireturn", Return.class), + LRETURN(0xad, "lreturn", Return.class), + FRETURN(0xae, "freturn", Return.class), + DRETURN(0xaf, "dreturn", Return.class), + ARETURN(0xb0, "areturn", Return.class), + RETURN(0xb1, "return", VReturn.class), + GETSTATIC(0xb2, "getstatic", GetStatic.class), + PUTSTATIC(0xb3, "putstatic", PutStatic.class), + GETFIELD(0xb4, "getfield", GetField.class), + PUTFIELD(0xb5, "putfield", PutField.class), + INVOKEVIRTUAL(0xb6, "invokevirtual", InvokeVirtual.class), + INVOKESPECIAL(0xb7, "invokespecial", InvokeSpecial.class), + INVOKESTATIC(0xb8, "invokestatic", InvokeStatic.class), + INVOKEINTERFACE(0xb9, "invokeinterface", InvokeInterface.class), + INVOKEDYNAMIC(0xba, "invokedynamic", InvokeDynamic.class), + NEW(0xbb, "new", New.class), + NEWARRAY(0xbc, "newarray", NewArray.class), + ANEWARRAY(0xbd, "anewarray", ANewArray.class), + ARRAYLENGTH(0xbe, "arraylength", ArrayLength.class), + ATHROW(0xbf, "athrow", AThrow.class), + CHECKCAST(0xc0, "checkcast", CheckCast.class), + INSTANCEOf(0xc1, "instanceof", InstanceOf.class), + MONITORENTER(0xc2, "monitorenter", MonitorEnter.class), + MONITOREXIT(0xc3, "monitorexit", MonitorExit.class), + MULTIANEWARRAY(0xc5, "multianewarray", MultiANewArray.class), + IFNULL(0xc6, "ifnull", IfNull.class), + IFNONNULL(0xc7, "ifnonnull", IfNonNull.class), + GOTO_W(0xc8, "goto_w", GotoW.class); + + private final int code; + private final String name; + private final Class clazz; + + InstructionType(int op, String name, Class clazz) + { + this.code = op; + this.name = name; + this.clazz = clazz; + } + + public int getCode() + { + return code; + } + + public String getName() + { + return name; + } + + public Class getInstructionClass() + { + return clazz; + } + + public static InstructionType findInstructionFromCode(int code) + { + for (InstructionType t : InstructionType.values()) + { + if (t.getCode() == code) + { + return t; + } + } + return null; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java new file mode 100644 index 0000000000..a528950d0a --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Instructions.java @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import net.runelite.asm.attributes.Code; + +public class Instructions +{ + private final Code code; + private final List instructions = new ArrayList<>(); + private final Map labelMap = new HashMap<>(); + + public Instructions(Code code) + { + this.code = code; + } + + public Label createLabelFor(Instruction target) + { + return createLabelFor(target, false); + } + + public Label createLabelFor(Instruction target, boolean forceCreate) + { + assert target.getInstructions() == this; + assert instructions.contains(target); + + if (target instanceof Label) + { + return (Label) target; + } + + int i = instructions.indexOf(target); + if (i > 0) + { + Instruction before = instructions.get(i - 1); + + if (!forceCreate && before instanceof Label) + { + return (Label) before; + } + } + + Label label = new Label(this); + label.setLabel(new org.objectweb.asm.Label()); + instructions.add(i, label); + labelMap.put(label.getLabel(), label); + return label; + } + + public Label findLabel(org.objectweb.asm.Label l) + { + Label label = labelMap.get(l); + assert label != null; + return label; + } + + public Label findOrCreateLabel(org.objectweb.asm.Label l) + { + Label label = labelMap.get(l); + if (label != null) + { + return label; + } + + label = new Label(this, l); + labelMap.put(l, label); + + return label; + } + + public void rebuildLabels() + { + labelMap.clear(); + + // ow2 asm requires new Labels each time you write out a class + // with ClassWriter, or else it crytpically fails + for (Instruction i : instructions) + { + if (i instanceof Label) + { + org.objectweb.asm.Label label = new org.objectweb.asm.Label(); + ((Label) i).setLabel(label); + + labelMap.put(label, (Label) i); + } + } + } + + public List getInstructions() + { + return instructions; + } + + public void addInstruction(Instruction i) + { + assert i.getInstructions() == this; + instructions.add(i); + } + + public void addInstruction(int idx, Instruction i) + { + assert i.getInstructions() == this; + instructions.add(idx, i); + } + + public void remove(Instruction ins) + { + assert ins.getInstructions() == this; + ins.remove(); + instructions.remove(ins); + ins.setInstructions(null); + } + + public void clear() + { + for (Instruction ins : instructions) + { + ins.remove(); + ins.setInstructions(null); + } + instructions.clear(); + } + + public Code getCode() + { + return code; + } + + public void lookup() + { + for (Instruction i : instructions) + { + i.lookup(); + } + } + + public void regeneratePool() + { + for (Instruction i : instructions) + { + i.regeneratePool(); + } + } + + public int replace(Instruction oldi, Instruction newi) + { + assert oldi != newi; + + assert oldi.getInstructions() == this; + assert newi.getInstructions() == this; + + assert instructions.contains(oldi); + assert !instructions.contains(newi); + + int i = instructions.indexOf(oldi); + instructions.remove(oldi); + oldi.setInstructions(null); + instructions.add(i, newi); + + return i; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java new file mode 100644 index 0000000000..7f2cd70ffd --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Label.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code; + +import net.runelite.asm.attributes.code.instructions.NOP; +import org.objectweb.asm.MethodVisitor; + +public class Label extends NOP +{ + private org.objectweb.asm.Label label; + private Integer lineNumber; + + public Label(Instructions instructions) + { + super(instructions); + } + + public Label(Instructions instructions, org.objectweb.asm.Label label) + { + super(instructions); + this.label = label; + } + + @Override + public String toString() + { + String string; + + if (this.getInstructions() == null) + { + string = "label "; + } + else + { + Instruction next = next(); + + if (next == null) + { + string = "label with no next instruction"; + } + else + { + string = "label " + next.toString(); + } + } + + if (lineNumber != null) + { + string += " on line number " + lineNumber; + } + + return string; + } + + @Override + public Instruction clone() + { + Label l = (Label) super.clone(); + l.label = new org.objectweb.asm.Label(); + l.lineNumber = lineNumber; + return l; + } + + @Override + public void accept(MethodVisitor visitor) + { + visitor.visitLabel(label); + + if (lineNumber != null) + { + visitor.visitLineNumber(lineNumber, label); + } + } + + public org.objectweb.asm.Label getLabel() + { + return label; + } + + public void setLabel(org.objectweb.asm.Label label) + { + this.label = label; + } + + public void setLineNumber(Integer lineNumber) + { + this.lineNumber = lineNumber; + } + + public Instruction next() + { + Instructions ins = this.getInstructions(); + int i = ins.getInstructions().indexOf(this); + assert i != -1; + + Instruction next; + do + { + next = ins.getInstructions().get(i + 1); + ++i; + } + while (next instanceof Label); + + return next; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java new file mode 100644 index 0000000000..3956b453d1 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/LocalVariable.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2018 Morgan Lewis + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code; + +import org.objectweb.asm.Label; + +public class LocalVariable +{ + private final String name; + private final String desc; + private final String signature; + private final Label start; + private final Label end; + private final int index; + + public LocalVariable(String name, String desc, String signature, Label start, Label end, int index) + { + this.name = name; + this.desc = desc; + this.signature = signature; + this.start = start; + this.end = end; + this.index = index; + } + + public String getName() + { + return name; + } + + public String getDesc() + { + return desc; + } + + public String getSignature() + { + return signature; + } + + public Label getStart() + { + return start; + } + + public Label getEnd() + { + return end; + } + + public int getIndex() + { + return index; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java new file mode 100644 index 0000000000..b42a41a4b5 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/Parameter.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018 Morgan Lewis + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code; + +public class Parameter +{ + private final String name; + private final int access; + private LocalVariable localVariable; + + public Parameter(String name, int access) + { + this.name = name; + this.access = access; + } + + public String getName() + { + return name; + } + + public int getAccess() + { + return access; + } + + public LocalVariable getLocalVariable() + { + return localVariable; + } + + public void setLocalVariable(LocalVariable localVariable) + { + this.localVariable = localVariable; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java new file mode 100644 index 0000000000..0fbb69ab1d --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/AdditionInstruction.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code.instruction.types; + +import net.runelite.asm.Field; +import net.runelite.asm.attributes.code.Instruction; +import net.runelite.asm.execution.InstructionContext; +import net.runelite.asm.execution.StackContext; +import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil; +import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping; + +public interface AdditionInstruction extends MappableInstruction +{ + default InstructionContext findArrayLoad(InstructionContext ic1, InstructionContext ic2) + { + Instruction i1 = ic1.getInstruction(); + Instruction i2 = ic2.getInstruction(); + + if (i1 instanceof ArrayLoad && !(i2 instanceof ArrayLoad)) + { + return ic1; + } + if (i2 instanceof ArrayLoad && !(i1 instanceof ArrayLoad)) + { + return ic2; + } + + return null; + } + + @Override + default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other) + { + /* lhs/rhs of addition instructions are randomally swapped, but + * we still map if each side is recognizable + * + * N.B. since the lhs/rhs of nested iadds can be swapped, and + * the mapper maps the first that it encounters, this can certainly + * attempt to map the wrong instructions even when mapping the correct + * method, so be careful. + */ + StackContext ctx1 = ctx.getPops().get(0); + StackContext ctx2 = ctx.getPops().get(1); + + StackContext other1 = other.getPops().get(0); + StackContext other2 = other.getPops().get(1); + + InstructionContext rc1 = ctx1.getPushed().resolve(ctx1); + InstructionContext rc2 = ctx2.getPushed().resolve(ctx2); //iaload + + InstructionContext ro1 = other1.getPushed().resolve(other1); + InstructionContext ro2 = other2.getPushed().resolve(other2); //iaload + + // There are a couple static final arrays that are only ever read from 1 or 2 places.. and never written + InstructionContext al1 = findArrayLoad(rc1, rc2); + InstructionContext al2 = findArrayLoad(ro1, ro2); + + if (al1 == null || al2 == null) + { + return; + } + + StackContext array1 = al1.getPops().get(1); + StackContext array2 = al2.getPops().get(1); + + InstructionContext field1 = array1.getPushed().resolve(array1); + InstructionContext field2 = array2.getPushed().resolve(array2); + + if (!(field1.getInstruction() instanceof GetFieldInstruction) || !(field2.getInstruction() instanceof GetFieldInstruction)) + { + return; + } + + GetFieldInstruction gf1 = (GetFieldInstruction) field1.getInstruction(); + GetFieldInstruction gf2 = (GetFieldInstruction) field2.getInstruction(); + + Field f1 = gf1.getMyField(); + Field f2 = gf2.getMyField(); + + if (f1 == null || f2 == null || !MappingExecutorUtil.isMaybeEqual(f1, f2)) + { + return; + } + + mappings.map((Instruction) this, f1, f2); + } + + @Override + default boolean isSame(InstructionContext thisIc, InstructionContext otherIc) + { + return this.getClass() == otherIc.getInstruction().getClass(); + } + + @Override + default boolean canMap(InstructionContext thisIc) + { + return true; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java new file mode 100644 index 0000000000..da196f0056 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayLoad.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code.instruction.types; + +import net.runelite.asm.attributes.code.Instruction; +import net.runelite.asm.execution.InstructionContext; +import net.runelite.asm.execution.StackContext; +import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil; +import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping; + +public interface ArrayLoad extends MappableInstruction +{ + @Override + default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other) + { + StackContext index1 = ctx.getPops().get(0), + index2 = other.getPops().get(0); + + InstructionContext ctx1 = MappingExecutorUtil.resolve(index1.getPushed(), index1), + ctx2 = MappingExecutorUtil.resolve(index2.getPushed(), index2); + + assert ctx1.getInstruction() instanceof GetFieldInstruction; + assert ctx2.getInstruction() instanceof GetFieldInstruction; + + GetFieldInstruction gf1 = (GetFieldInstruction) ctx1.getInstruction(); + GetFieldInstruction gf2 = (GetFieldInstruction) ctx2.getInstruction(); + mappings.map((Instruction) this, gf1.getMyField(), gf2.getMyField()); + } + + @Override + default boolean isSame(InstructionContext thisIc, InstructionContext otherIc) + { + if (thisIc.getInstruction().getType() != otherIc.getInstruction().getType()) + { + return false; + } + + StackContext index1 = thisIc.getPops().get(0), + index2 = otherIc.getPops().get(0); + + InstructionContext ctx1 = MappingExecutorUtil.resolve(index1.getPushed(), index1), + ctx2 = MappingExecutorUtil.resolve(index2.getPushed(), index2); + + assert ctx1.getInstruction() instanceof GetFieldInstruction; + assert ctx2.getInstruction() instanceof GetFieldInstruction; + + GetFieldInstruction gf1 = (GetFieldInstruction) ctx1.getInstruction(); + GetFieldInstruction gf2 = (GetFieldInstruction) ctx2.getInstruction(); + + return MappingExecutorUtil.isMaybeEqual(gf1.getMyField(), gf2.getMyField()); + } + + @Override + default boolean canMap(InstructionContext thisIc) + { + // assume that obfuscation can't remove a load with a variable + // index. map field access. + StackContext index = thisIc.getPops().get(0); + InstructionContext ctx = MappingExecutorUtil.resolve(index.getPushed(), index); + return ctx.getInstruction() instanceof GetFieldInstruction; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java new file mode 100644 index 0000000000..de019ce9e0 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ArrayStoreInstruction.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +public interface ArrayStoreInstruction extends MappableInstruction +{ + +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java new file mode 100644 index 0000000000..25e0cdf1da --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ComparisonInstruction.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +public interface ComparisonInstruction +{ + +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java new file mode 100644 index 0000000000..099b281725 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/ConversionInstruction.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +public interface ConversionInstruction +{ + +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java new file mode 100644 index 0000000000..f682748a65 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DivisionInstruction.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +import net.runelite.asm.Field; +import net.runelite.asm.attributes.code.Instruction; +import net.runelite.asm.execution.InstructionContext; +import net.runelite.asm.execution.StackContext; +import net.runelite.deob.deobfuscators.mapping.MappingExecutorUtil; +import net.runelite.deob.deobfuscators.mapping.ParallelExecutorMapping; + +public interface DivisionInstruction extends MappableInstruction +{ + @Override + default void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other) + { + StackContext s1 = ctx.getPops().get(0), + s2 = ctx.getPops().get(1); + + StackContext o1 = other.getPops().get(0), + o2 = other.getPops().get(1); + + InstructionContext i1 = MappingExecutorUtil.resolve(s1.getPushed(), s1); + InstructionContext i2 = MappingExecutorUtil.resolve(s2.getPushed(), s2); + + InstructionContext io1 = MappingExecutorUtil.resolve(o1.getPushed(), o1); + InstructionContext io2 = MappingExecutorUtil.resolve(o2.getPushed(), o2); + + if (i1.getInstruction() instanceof GetFieldInstruction && io1.getInstruction() instanceof GetFieldInstruction) + { + GetFieldInstruction f1 = (GetFieldInstruction) i1.getInstruction(); + GetFieldInstruction f2 = (GetFieldInstruction) io1.getInstruction(); + + Field fi1 = f1.getMyField(), fi2 = f2.getMyField(); + + if (fi1 != null && fi2 != null) + mappings.map((Instruction) this, fi1, fi2); + } + + if (i2.getInstruction() instanceof GetFieldInstruction && io2.getInstruction() instanceof GetFieldInstruction) + { + GetFieldInstruction f1 = (GetFieldInstruction) i2.getInstruction(); + GetFieldInstruction f2 = (GetFieldInstruction) io2.getInstruction(); + + Field fi1 = f1.getMyField(), fi2 = f2.getMyField(); + + if (fi1 != null && fi2 != null) + mappings.map((Instruction) this, fi1, fi2); + } + } + + @Override + default boolean isSame(InstructionContext thisIc, InstructionContext otherIc) + { + return this.getClass() == otherIc.getInstruction().getClass(); + } + + @Override + default boolean canMap(InstructionContext thisIc) + { + return true; + } +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java new file mode 100644 index 0000000000..93ccb70e45 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/DupInstruction.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +import java.util.List; +import net.runelite.asm.execution.InstructionContext; +import net.runelite.asm.execution.StackContext; + +public interface DupInstruction +{ + StackContext getOriginal(StackContext sctx); + + StackContext getOtherBranch(StackContext sctx); + + /** + * get the duplicated stackcontexts (which is popped from this) + * @param ictx instruction context for this instruction + * @return + */ + List getDuplicated(InstructionContext ictx); + + /** + * get the copied stackcontexts (pushed from this) + * @param ictx + * @return + */ + List getCopies(InstructionContext ictx); +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java new file mode 100644 index 0000000000..e9ed4999ff --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/FieldInstruction.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code.instruction.types; + +import net.runelite.asm.pool.Field; + +public interface FieldInstruction +{ + Field getField(); + + void setField(Field field); + + net.runelite.asm.Field getMyField(); +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java new file mode 100644 index 0000000000..f5a5af480a --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/GetFieldInstruction.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +public interface GetFieldInstruction extends FieldInstruction +{ +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java new file mode 100644 index 0000000000..2bc361ef44 --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/IntInstruction.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.asm.attributes.code.instruction.types; + +public interface IntInstruction +{ + int getOperand(); + + void setOperand(int operand); +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java new file mode 100644 index 0000000000..9396f974de --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/InvokeInstruction.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code.instruction.types; + +import java.util.List; +import net.runelite.asm.Method; + +public interface InvokeInstruction extends MappableInstruction +{ + void removeParameter(int idx); + + net.runelite.asm.pool.Method getMethod(); + + void setMethod(net.runelite.asm.pool.Method method); + + List getMethods(); +} diff --git a/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java new file mode 100644 index 0000000000..fc1dda4b3a --- /dev/null +++ b/deobfuscator/src/main/java/net/runelite/asm/attributes/code/instruction/types/JumpingInstruction.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016-2017, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.asm.attributes.code.instruction.types; + +import java.util.List; +import net.runelite.asm.attributes.code.Label; + +public interface JumpingInstruction +{ + List