java-deobfuscator / deobfuscator

The real deal
https://javadeobfuscator.com
Apache License 2.0
1.57k stars 292 forks source link

[NoSuchMethodHandlerException] Hide Access Transformer #387

Closed fahrenheit93 closed 5 years ago

fahrenheit93 commented 5 years ago

Hello again, i'm opening a new issue because the last one was resolved for the first of two files. The second one : palamodaddons-1.0.0.jar.zip

I logged the different classes here :

classNodes().forEach(classNode ->
    classNode.methods.stream().filter(methodNode -> !methodNode.desc.equals(bootstrapDesc)).forEach(methodNode -> {
            if (DEV) {
                System.out.println("ClassNode Name : " + classNode.name);
                System.out.println("ClassNode File : " + classNode.sourceFile);
            }

From here, i ignore the class causing the NullException, i don't know if it's good or not.

My config file :

input: "C:\\Users\\moi\\Documents\\re\\palamod\\fork\\palamodaddons-string.jar"
output: "C:\\Users\\moi\\Documents\\re\\palamod\\fork\\palamodaddons-1.0.0-deob-debug.jar"
path:
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\bootstrap\\runtime\\jre-x64-1.8.0_25-windows\\lib\\rt.jar"
ignoredClasses:
  - palamodaddons/modules/paladium/items/armors/BaseItemArmorEffect
  - palamodaddons/modules/paladium/items/tools/BaseItemAxe
  - palamodaddons/modules/paladium/items/tools/BaseItemShovel
  - palamodaddons/modules/paladium/PPaladium
  - palamodaddons/modules/paladium/items/weapons/BaseItemSword
  - palamodaddons/modules/paladium/materials/PArmorMaterial
  - palamodaddons/modules/paladium/items/armors/ItemRepairableArmor
  - palamodaddons/modules/paladium/items/weapons/ItemPaladiumGreenSword
  - palamodaddons/modules/paladium/items/armors/BaseItemArmor
  - palamodaddons/modules/paladium/materials/PToolMaterial
  - palamodaddons/modules/paladium/items/tools/BaseItemPickaxe
  - palamodaddons/common/creativetab/PCreativeTab
  - palamodaddons/client/gui/PGuiOverlayDebugOld
  - palamodaddons/client/gui/PGuiOverlayDebug
  - palamodaddons/kiwi/Kiwi
  - palamodaddons/client/gui/PGuiIngame
  - palamodaddons/utils/Utils
  - palamodaddons/kiwi/MKiwiConnect
  - palamodaddons/client/events/yv
  - palamodaddons/client/events/GuiHandler
  - palamodaddons/kiwi/MKiwiLoader
  - palamodaddons/pulsar/pulse/Pulse
  - palamodaddons/client/on
libraries:
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\libraries\\net\\minecraftforge\\forge\\1.7.10-10.13.4.2512\\forge-1.7.10-10.13.4.2512.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\libraries\\com\\google\\guava\\guava\\17.0\\guava-17.0.jar"
  - "C:\\Users\\moi\\Documents\\re\\minecraft.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\libraries\\io\\netty\\netty-all\\4.0.10.Final\\netty-all-4.0.10.Final.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\libraries\\com\\mojang\\authlib\\1.5.21\\authlib-1.5.21.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\libraries\\org\\apache\\logging\\log4j\\log4j-api\\2.0-beta9\\log4j-api-2.0-beta9.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\libraries\\net\\minecraft\\launchwrapper\\1.12\\launchwrapper-1.12.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\ArmorStatusHUD.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\BiblioCraft.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\Chisel.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\CodeChickenCore.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\CustomNPCs.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\Discord.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\IronChest.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\json-simple-1.1.1.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\NotEnoughItems.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\Optifine.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\PalaChristmasDeco-Client.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\Paladium-CEF.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\palamodaddons-1.0.0.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\RandomThings.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\RTG.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\SecretRooms.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\StatusEffectHUD.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\StorageDrawers.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\1.7.10\\[1.7.10]bspkrsCore-universal-6.15.jar"
  - "C:\\Users\\moi\\AppData\\Roaming\\.paladium\\minecraft\\mods\\1.7.10\\CodeChickenLib-1.7.10-1.1.1.99-universal.jar"
  - "C:\\Users\\moi\\Documents\\re\\Palamod-Client.jar"
  - "C:\\Users\\moi\\Documents\\re\\commons-io-2.6.jar"
transformers:
  - stringer.HideAccessObfuscationTransformer

The error : com.javadeobfuscator.deobfuscator.executor.exceptions.NoSuchMethodHandlerException: Could not find invoker for palamodaddons/client/on R(I)Ljava/lang/reflect/Method; @ palamodaddons/client/PProxyClient vT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; at com.javadeobfuscator.deobfuscator.executor.MethodExecutor.execute(MethodExecutor.java:1359)

It says couldn't find, yes i ignored these ones, if not, it's NullPointerException...

I used StringEncryptionTransformer one time before and it worked. I tried with doing a ClassNormalizer too. I tried doing a ReflectionObfuscationTransformer but java.lang.ArrayIndexOutOfBoundsException at java.lang.reflect.Array.get(Native Method) so..

I you can do it, please tell me how you did it thank you.

P.S : I don't want to ignore so much files, that's useless..

ThisTestUser commented 5 years ago

I gave you the file in the previous issue. You need to use StringEncryptionTransformer and then HideAccessTransformer. You can use this version of HideAccess to skip over unresolved libraries: https://gist.github.com/ThisTestUser/2ff4cad222667353e242214de18913a8

fahrenheit93 commented 5 years ago

Thank you @ThisTestUser but this is another mod, the last one was weirdly perfect. I'll try to understand your changes in the transformer.

EDIT : Ok i understand your changes, you catch the exception on each JavaField and continue, i wanted to do that with a try catch bloc wrapping the classNode().forEach but the program didn't write the file at the end :/

But a last question, when i start doing a reflection obfuscation tranformer, it found some, maybe i need to use this one too?

I think of : image

Maybe invokedDynamic transformer too

ThisTestUser commented 5 years ago

I did give you the deobfuscated addon jar: https://github.com/java-deobfuscator/deobfuscator/files/3025006/MC-Addon2Deob.zip If you find invokedynamic in the code this means that the transformer skipped over it because it couldn't resolve the library.

fahrenheit93 commented 5 years ago

Ok, so how did you do to avoid invokedynamic problems? I'm pretty sure i used same libs that you were using, except Minecraft.jar which may be different a bit.

How did you decompile properly minecraft.jar ? Mine is a bit broken i think (ex: ItemStack)

ThisTestUser commented 5 years ago

You need the forge SRG and regular forge Jar, which are downloaded when you setup a forge workspace.

fahrenheit93 commented 5 years ago

BON2 can do it, am I right? I mean, the remapping

Ok I am building a forge workspace image

I'm going to search how to use the SRG (This is a mapping file I believe)

fahrenheit93 commented 5 years ago

I can't get rid of invokedynamic, i used ForgeGradle, and opened forge/build/tmp/recompSrc and export .jar from there (using Eclipse).

ItemStack can't be resolved, the file you deobfuscated doesn't have any Invokedynamic in, that's curiously pretty good. I would like you to explain me how you did it properly, because I'm pretty sure this is Minecraft.jar dep, like on discord, here is for the Java-Deobfuscator issues, so this is not related anymore now i think : Follow#9407

Thank you, that's a little bit curious, i'm missing something.

ThisTestUser commented 5 years ago

The JARs are here: C:\Users\NAME.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-VERSION-1.7.10 Attach the SRG Jar, and then the normal jar. If it still doesn't work attach the normal jar and then the srg jar.

fahrenheit93 commented 5 years ago

Are you telling me that the order in the "libraries" field (config.yml) is important? I have a lot of dependencies

ThisTestUser commented 5 years ago

Only for the forge jars.

fahrenheit93 commented 5 years ago

Ok, so Forge SRG, and the "normal" is that the Universal one?

EDIT : I can take the forge 1.7.10 from the launcher tho

I'll try that, thanks

ThisTestUser commented 5 years ago

Go the folder I told you to go to and you'll find the jars. One is called forgeSrc-....jar, one is forge-...-srg.jar

fahrenheit93 commented 5 years ago

SRG is a mapping (naming system) file, am i right btw? Searge i believe from what i found

EDIT : Last but not least : Is Minecraft.jar obligatory? I'll see missing deps tho EDIT : Stupid question, minecraft.jar isn't, so no more Invokedynamic now thank you !

Is that the same way with the first file you were deob ? The biggest one i mean

ThisTestUser commented 5 years ago

Yes, but you will see invokedynamics because there are still missing dependencies.

fahrenheit93 commented 5 years ago

I can log some classes which can't be resolved, so from that, we can know what libs are missing, am i right? And if some libs are obfuscated, could it be a problem when resolving these ones?

Example log with your version of HideAccessTransformer : Could not find classnode com.google.gson.Gson

EDIT : Not all classes show the missing libs btw apparently

ThisTestUser commented 5 years ago

You also have to add all 1.7.10 libraries if you want to resolve that. But even then you'll still encounter missing dependencies, which you can't solve.

fahrenheit93 commented 5 years ago

Is there a way to know exactly what lib is missing? Because invokedynamic(-33hvc0:(Ljava/lang/Object;)Ljava/lang/String Is not so obvious. This is from the Java jar i believe, which is already in the "path" field (config.yml)

ThisTestUser commented 5 years ago

If you added all the libraries I told you to, there's nothing else you can do. But if you wanted to look at all the libraries, you can just use StringEncryptionTransformer and look for the HideAccess class to find out which classes are referenced.

fahrenheit93 commented 5 years ago

Ok you were really helpful thank you, i understand a bit more, i'll study that more further that's interesting.