Skip to content

Commit

Permalink
recover synthetics
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicPlayerA10 committed Sep 11, 2024
1 parent 188472b commit 07ed1b7
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import uwu.narumi.deobfuscator.api.transformer.ComposedTransformer;
import uwu.narumi.deobfuscator.core.other.impl.clean.peephole.JsrInlinerTransformer;
import uwu.narumi.deobfuscator.core.other.impl.clean.peephole.PopUnUsedLocalVariablesTransformer;
import uwu.narumi.deobfuscator.core.other.impl.clean.peephole.UselessPopCleanTransformer;
import uwu.narumi.deobfuscator.core.other.impl.pool.InlineStaticFieldTransformer;
import uwu.narumi.deobfuscator.core.other.impl.universal.RecoverSyntheticsTransformer;
import uwu.narumi.deobfuscator.core.other.impl.universal.UniversalNumberTransformer;
import uwu.narumi.deobfuscator.core.other.impl.zkm.ZelixLongEncryptionTransformer;
import uwu.narumi.deobfuscator.core.other.impl.zkm.ZelixUselessTryCatchRemoverTransformer;
Expand All @@ -14,13 +17,18 @@ public class ComposedZelixTransformer extends ComposedTransformer {
public ComposedZelixTransformer() {
super(
JsrInlinerTransformer::new,
RecoverSyntheticsTransformer::new,

// Fixes flow a bit
ZelixUselessTryCatchRemoverTransformer::new,

ZelixLongEncryptionTransformer::new,
InlineStaticFieldTransformer::new,
UniversalNumberTransformer::new
UniversalNumberTransformer::new,

// Cleanup
PopUnUsedLocalVariablesTransformer::new,
UselessPopCleanTransformer::new
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package uwu.narumi.deobfuscator.core.other.impl.universal;

import uwu.narumi.deobfuscator.api.asm.ClassWrapper;
import uwu.narumi.deobfuscator.api.context.Context;
import uwu.narumi.deobfuscator.api.transformer.Transformer;

public class RecoverSyntheticsTransformer extends Transformer {
@Override
protected void transform(ClassWrapper scope, Context context) throws Exception {
context.classes(scope).forEach(classWrapper -> {
classWrapper.methods().forEach(methodNode -> {
// Recover by name
if (methodNode.name.startsWith("lambda$")) {
// Mark as synthetic
methodNode.access |= ACC_SYNTHETIC;
}
});
});
}
}
130 changes: 59 additions & 71 deletions testData/results/custom-classes/zkm/ExampleClass.dec
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public final class PacketEvents implements Listener, EventManager {
private static final long a = 110160429747013L;

public PacketEvents() {
long var1 = 125984749057137L;
int var10000 = Vulcan_Q();
super();
int var3 = var10000;
Expand All @@ -83,7 +82,6 @@ public final class PacketEvents implements Listener, EventManager {
}

public static PacketEvents Vulcan_o(Plugin var0) {
long var1 = 60184643744606L;
int var3 = Vulcan_a();
boolean var10000 = Bukkit.isPrimaryThread();
if (var3 == 0) {
Expand Down Expand Up @@ -272,7 +270,6 @@ public final class PacketEvents implements Listener, EventManager {

// $VF: Irreducible bytecode was duplicated to produce valid code
public void Vulcan_o(PacketEventsSettings var1) {
long var2 = 68094010456234L;
int var10000 = Vulcan_Q();
this.Vulcan_g();
int var4 = var10000;
Expand Down Expand Up @@ -308,7 +305,7 @@ public final class PacketEvents implements Listener, EventManager {
if (var4 != 0) {
if (var7) {
Metrics var5 = new Metrics((JavaPlugin)this.Vulcan_a(), 11327);
var5.addCustomChart(new SimplePie("packetevents_version", this::lambda$init$0));
var5.addCustomChart(new SimplePie("packetevents_version", () -> this.Vulcan_x().toString()));
}
} else if (var7) {
break label62;
Expand All @@ -321,7 +318,30 @@ public final class PacketEvents implements Listener, EventManager {
label53: {
Runnable var6;
label52: {
var6 = this::lambda$init$1;
var6 = () -> {
long var1x = 66876338785522L;
long var3 = 119084676127620L;
long var5x = 123797029215992L;
Bukkit.getPluginManager().registerEvents(this.bukkitEventProcessorInternal, plugin);
int var10000x = Vulcan_a();
Iterator var8 = Bukkit.getOnlinePlayers().iterator();
int var7x = var10000x;

while (var8.hasNext()) {
Player var9 = (Player)var8.next();

try {
this.injector.Vulcan_D(new Object[]{var5x, var9});
this.Vulcan_N().Vulcan_X(new Object[]{var3, new PostPlayerInjectEvent(var9, false)});
} catch (Exception var10) {
var9.kickPlayer("Failed to inject... Please rejoin!");
}

if (var7x != 0) {
break;
}
}
};
if (var4 != 0) {
if (!this.lateBind) {
break label52;
Expand Down Expand Up @@ -465,7 +485,6 @@ public final class PacketEvents implements Listener, EventManager {

private void Vulcan_H() {
label16: {
long var1 = 47494217086680L;
int var3 = Vulcan_Q();
PacketEvents var10000 = this;
if (var3 != 0) {
Expand All @@ -479,76 +498,45 @@ public final class PacketEvents implements Listener, EventManager {
var10000.updateChecker = new UpdateChecker();
}

Thread var4 = new Thread(this::lambda$handleUpdateCheck$2, "packetevents-update-check-thread");
var4.start();
}

private void lambda$handleUpdateCheck$2() {
long var1 = 73114304934084L;
long var3 = 71820540609001L;
int var10000 = Vulcan_a();
this.Vulcan_a().getLogger().info("[packetevents] Checking for an update, please wait...");
int var5 = var10000;
UpdateCheckerStatus var6 = this.updateChecker.Vulcan_M(new Object[]{var3});
int var7 = 5;
byte var8 = 5;
int var9 = 0;

while (var9 < var8 && (var6 == UpdateCheckerStatus.FAILED || var5 != 0)) {
this.Vulcan_a().getLogger().severe("[packetevents] Checking for an update again in " + var7 + " seconds...");

try {
Thread.sleep((long)var7 * 1000L);
} catch (InterruptedException var11) {
var11.printStackTrace();
}

var7 *= 2;
var6 = this.updateChecker.Vulcan_M(new Object[]{var3});
if (var5 == 0) {
if (var9 == 4) {
this.Vulcan_a().getLogger().severe("[packetevents] PacketEvents failed to check for an update. No longer retrying.");
if (var5 == 0) {
break;
}
Thread var4 = new Thread(() -> {
long var1 = 73114304934084L;
long var3x = 71820540609001L;
int var10000x = Vulcan_a();
this.Vulcan_a().getLogger().info("[packetevents] Checking for an update, please wait...");
int var5 = var10000x;
UpdateCheckerStatus var6 = this.updateChecker.Vulcan_M(new Object[]{var3x});
int var7 = 5;
byte var8 = 5;
int var9 = 0;

while (var9 < var8 && (var6 == UpdateCheckerStatus.FAILED || var5 != 0)) {
this.Vulcan_a().getLogger().severe("[packetevents] Checking for an update again in " + var7 + " seconds...");

try {
Thread.sleep((long)var7 * 1000L);
} catch (InterruptedException var11) {
var11.printStackTrace();
}

var9++;
}

if (var5 != 0) {
break;
}
}
}

private void lambda$init$1() {
long var1 = 66876338785522L;
long var3 = 119084676127620L;
long var5 = 123797029215992L;
Bukkit.getPluginManager().registerEvents(this.bukkitEventProcessorInternal, plugin);
int var10000 = Vulcan_a();
Iterator var8 = Bukkit.getOnlinePlayers().iterator();
int var7 = var10000;

while (var8.hasNext()) {
Player var9 = (Player)var8.next();
var7 *= 2;
var6 = this.updateChecker.Vulcan_M(new Object[]{var3x});
if (var5 == 0) {
if (var9 == 4) {
this.Vulcan_a().getLogger().severe("[packetevents] PacketEvents failed to check for an update. No longer retrying.");
if (var5 == 0) {
break;
}
}

try {
this.injector.Vulcan_D(new Object[]{var5, var9});
this.Vulcan_N().Vulcan_X(new Object[]{var3, new PostPlayerInjectEvent(var9, false)});
} catch (Exception var11) {
var9.kickPlayer("Failed to inject... Please rejoin!");
}
var9++;
}

if (var7 != 0) {
break;
if (var5 != 0) {
break;
}
}
}
}

private String lambda$init$0() {
return this.Vulcan_x().toString();
}, "packetevents-update-check-thread");
var4.start();
}

public static void Vulcan_x(int var0) {
Expand Down

0 comments on commit 07ed1b7

Please sign in to comment.