From 2beca5f91f8da0b16910e7720788eacf385e03db Mon Sep 17 00:00:00 2001 From: PandaNinjas Date: Mon, 13 Feb 2023 16:22:43 -0800 Subject: v1.1.0 release (trolling) --- .../nosession/NoSessionLoadingPlugin.java | 20 ++++++++----- .../malwarefight/nosession/relaunch/Relaunch.java | 34 ++++++++-------------- 2 files changed, 24 insertions(+), 30 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java b/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java index 40a8586..d808a15 100644 --- a/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java +++ b/src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java @@ -3,11 +3,6 @@ package gq.malwarefight.nosession; import gq.malwarefight.nosession.relaunch.Relaunch; import gq.malwarefight.nosession.tweaks.initial.InitialTweaker; import gq.malwarefight.nosession.utils.Utils; -import java.util.HashMap; -import java.util.Map.Entry; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; - import java.io.IOException; import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; @@ -15,10 +10,14 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; import java.util.Properties; import java.util.regex.Matcher; import java.util.regex.Pattern; +import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; @IFMLLoadingPlugin.MCVersion("1.8.9") @IFMLLoadingPlugin.Name("NoSession trolling") @@ -67,6 +66,11 @@ public class NoSessionLoadingPlugin implements IFMLLoadingPlugin { public static ArrayList constructLaunchArgs(HashMap args) { ArrayList constructedArgs = new ArrayList<>(); for (Entry entry: args.entrySet()) { + if (entry.getKey().equals("--accessToken")) { + constructedArgs.add(entry.getKey()); + constructedArgs.add(""); + continue; + } constructedArgs.add(entry.getKey()); constructedArgs.add(entry.getValue()); } @@ -102,15 +106,15 @@ public class NoSessionLoadingPlugin implements IFMLLoadingPlugin { // test if we can find the token in Launch.blackboard.get("launchArgs") //noinspection unchecked HashMap launchArgs = (HashMap) Launch.blackboard.get("launchArgs"); - Pattern pattern = Pattern.compile("(?eyJhbGciOiJIUzI1NiJ9\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*)"); - Matcher match = pattern.matcher(launchArgs.get("launchArgs")); + Pattern pattern = Pattern.compile("(ey[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*\\.[A-Za-z0-9-_]*)"); + Matcher match = pattern.matcher(launchArgs.get("--accessToken")); if (match.find()) { // relaunch now ! System.out.println("======================="); System.out.println("NoSession: relaunching without the token"); System.out.println("======================="); try { - Relaunch.relaunch(constructLaunchArgs(launchArgs), Launch.minecraftHome, Launch.assetsDir, "1.8.9"); + Relaunch.relaunch(constructLaunchArgs(launchArgs)); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); diff --git a/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java b/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java index e712254..d1a240c 100644 --- a/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java +++ b/src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java @@ -2,17 +2,6 @@ package gq.malwarefight.nosession.relaunch; import gq.malwarefight.nosession.tweaks.cleanup.CleanupTweaker; import gq.malwarefight.nosession.utils.Utils; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.client.FMLClientHandler; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModAPIManager; -import net.minecraftforge.fml.common.asm.ASMTransformerWrapper; -import net.minecraftforge.fml.common.registry.ItemStackHolderInjector; -import net.minecraftforge.fml.common.registry.ObjectHolderRegistry; -import net.minecraftforge.fml.relauncher.FMLInjectionData; -import net.minecraftforge.fml.relauncher.FMLLaunchHandler; - -import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -22,9 +11,18 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; +import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModAPIManager; +import net.minecraftforge.fml.common.asm.ASMTransformerWrapper; +import net.minecraftforge.fml.common.registry.ItemStackHolderInjector; +import net.minecraftforge.fml.common.registry.ObjectHolderRegistry; +import net.minecraftforge.fml.relauncher.FMLInjectionData; +import net.minecraftforge.fml.relauncher.FMLLaunchHandler; public class Relaunch { - public static void relaunch(ArrayList args, File gameDir, File assetsDir, String version) throws Exception { + public static void relaunch(ArrayList args) throws Exception { resetSecurityManager(); setToNull(FMLLaunchHandler.class, "INSTANCE"); setToNull(Loader.class, "instance"); @@ -36,18 +34,10 @@ public class Relaunch { Utils.setStaticValue(FMLInjectionData.class, "containers", new ArrayList()); resetTransformerWrapper(); addSelfToClassloader(); - Class innerLaunch = Launch.class; - Method launch = innerLaunch.getDeclaredMethod("main", String[].class); - launch.invoke(null, (Object) constructArgs(args, gameDir, assetsDir, version)); + Launch.main(constructArgs(args)); } - private static String[] constructArgs(ArrayList initial, File gameDir, File assetDir, String version) { - initial.add("--version"); - initial.add(version); - initial.add("--gameDir"); - initial.add(gameDir.getAbsolutePath()); - initial.add("--assetsDir"); - initial.add(assetDir.getAbsolutePath()); + private static String[] constructArgs(ArrayList initial) { initial.add("--tweakClass"); initial.add(CleanupTweaker.class.getName()); return initial.toArray(new String[0]); -- cgit