aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gq/malwarefight
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gq/malwarefight')
-rw-r--r--src/main/java/gq/malwarefight/nosession/NoSessionLoadingPlugin.java20
-rw-r--r--src/main/java/gq/malwarefight/nosession/relaunch/Relaunch.java34
2 files changed, 24 insertions, 30 deletions
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<String> constructLaunchArgs(HashMap<String, String> args) {
ArrayList<String> constructedArgs = new ArrayList<>();
for (Entry<String, String> entry: args.entrySet()) {
+ if (entry.getKey().equals("--accessToken")) {
+ constructedArgs.add(entry.getKey());
+ constructedArgs.add("<noSessionAccessToken>");
+ 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<String, String> launchArgs = (HashMap<String, String>) Launch.blackboard.get("launchArgs");
- Pattern pattern = Pattern.compile("(?<token>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<String> args, File gameDir, File assetsDir, String version) throws Exception {
+ public static void relaunch(ArrayList<String> 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<String>());
resetTransformerWrapper();
addSelfToClassloader();
- Class<Launch> 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<String> 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<String> initial) {
initial.add("--tweakClass");
initial.add(CleanupTweaker.class.getName());
return initial.toArray(new String[0]);