From 2e155aa16c32acecfc01359be1ab694f975faad7 Mon Sep 17 00:00:00 2001 From: Jess Date: Wed, 4 Oct 2023 13:45:57 +0100 Subject: [PATCH] ungodly amounts of *AAAAAAAA* --- .gitignore | 3 +- .../java/com/baseband/client/BaseBand.java | 6 +-- .../command/commands/GenericSetCommand.java | 17 ++++++- .../assets/minecraft/texts/splashes.txt | 1 + .../classloader/CustomClassloader.java | 20 +++++---- .../launcher/util/BBPermissionManager.java | 2 + .../util/BaseBandSecurityManager.java | 3 +- .../java/dev/baseband/server/socket/Bot.java | 44 +++++++++---------- .../baseband/server/socket/ClientHandler.java | 8 ++-- 9 files changed, 63 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 845b0d8..2186283 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ /.idea/ .vscode/settings.json -valid_hashes.txt \ No newline at end of file +valid_hashes.txt +Obf.tar diff --git a/Client/src/main/java/com/baseband/client/BaseBand.java b/Client/src/main/java/com/baseband/client/BaseBand.java index ae4c1a1..df8fa35 100644 --- a/Client/src/main/java/com/baseband/client/BaseBand.java +++ b/Client/src/main/java/com/baseband/client/BaseBand.java @@ -34,11 +34,11 @@ import java.util.function.Consumer; public class BaseBand { public static int majorVersion = 1; - public static int buildNumber = 445; - public static String hash = "831a32dc3bc7d84f"; + public static int buildNumber = 447; + public static String hash = "0c9b07530f2b1e4f"; public static String name = "BaseBand"; - public long timeOfCompile = 1696423350837L; + public long timeOfCompile = 1696423461109L; public CommandManager commandRegistry; public EventBus eventBus; public ArrayList modules = new ArrayList<>(); diff --git a/Client/src/main/java/com/baseband/client/command/commands/GenericSetCommand.java b/Client/src/main/java/com/baseband/client/command/commands/GenericSetCommand.java index 0a0e351..4207946 100644 --- a/Client/src/main/java/com/baseband/client/command/commands/GenericSetCommand.java +++ b/Client/src/main/java/com/baseband/client/command/commands/GenericSetCommand.java @@ -1,10 +1,10 @@ package com.baseband.client.command.commands; import com.baseband.client.BaseBand; +import com.baseband.client.Utils; import com.baseband.client.command.Command; import com.baseband.client.module.Module; import com.baseband.client.module.modules.ChatCrypt; - import de.tudbut.tools.Hasher; public class GenericSetCommand extends Command { @@ -30,6 +30,21 @@ public class GenericSetCommand extends Command { return "OK"; } + if(args[0].equalsIgnoreCase("list") && args.length==2) { + if(args[1].equalsIgnoreCase("modules")) { + for (Module m : BaseBand.INSTANCE.modules) { + Utils.sendChatMessage(m.toString()); + } + } + + if(args[1].equalsIgnoreCase("commands")) { + for (Command c : BaseBand.INSTANCE.commandRegistry.commands) { + // Utils.sendChatMessage(c.toString() + ":"+c.getHelp()); + } + } + return "OK"; + } + if(args[0].equalsIgnoreCase("cryptkey") && args.length==2) { ChatCrypt.chatKey = Hasher.sha512hex(Hasher.sha512hex(args[0])); return "OK"; diff --git a/Client/src/main/resources/assets/minecraft/texts/splashes.txt b/Client/src/main/resources/assets/minecraft/texts/splashes.txt index 7539710..aeeb8d8 100644 --- a/Client/src/main/resources/assets/minecraft/texts/splashes.txt +++ b/Client/src/main/resources/assets/minecraft/texts/splashes.txt @@ -28,3 +28,4 @@ Soldering fume AT+CGMI=? Modemful Other clients are incredibly modemless +Join 2beta2t.net today! diff --git a/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java b/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java index 2ca66e8..c5b6fd6 100644 --- a/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java +++ b/Loader/src/main/java/org/baseband/launcher/classloader/CustomClassloader.java @@ -7,7 +7,9 @@ package org.baseband.launcher.classloader; -import de.tudbut.security.*; +import de.tudbut.security.AccessKiller; +import de.tudbut.security.DataKeeper; +import de.tudbut.security.PermissionManager; import de.tudbut.security.permissionmanager.CallClassRestriction; import de.tudbut.security.permissionmanager.HideErrorRestriction; import net.minecraft.launchwrapper.Launch; @@ -89,6 +91,14 @@ public class CustomClassloader extends ClassLoader { } public void initClasses(Object classes, Object resources) { + AtomicReference> data = new AtomicReference<>(); + + ((DataKeeper>) ((Supplier) classes).get()).access(accessor -> data.set(accessor.getValue())); + encryptedClasses.access(accessor -> accessor.setValue(data.get())); + + ((DataKeeper>) ((Supplier) resources).get()).access(accessor -> data.set(accessor.getValue())); + encryptedResources.access(accessor -> accessor.setValue(data.get())); + try { CustomMixinServer customService = new CustomMixinServer(); Class mixinServiceClass = Class.forName("org.spongepowered.asm.service.MixinService"); @@ -106,14 +116,6 @@ public class CustomClassloader extends ClassLoader { Loader.exit(); } - AtomicReference> data = new AtomicReference<>(); - - ((DataKeeper>) ((Supplier) classes).get()).access(accessor -> data.set(accessor.getValue())); - encryptedClasses.access(accessor -> accessor.setValue(data.get())); - - ((DataKeeper>) ((Supplier) resources).get()).access(accessor -> data.set(accessor.getValue())); - encryptedResources.access(accessor -> accessor.setValue(data.get())); - try { Field parent = ClassLoader.class.getDeclaredField("parent"); parent.setAccessible(true); diff --git a/Loader/src/main/java/org/baseband/launcher/util/BBPermissionManager.java b/Loader/src/main/java/org/baseband/launcher/util/BBPermissionManager.java index a6cc803..fdc52d4 100644 --- a/Loader/src/main/java/org/baseband/launcher/util/BBPermissionManager.java +++ b/Loader/src/main/java/org/baseband/launcher/util/BBPermissionManager.java @@ -57,6 +57,8 @@ public class BBPermissionManager extends Restriction { return false; // instrumentation detected if(s.contains("dump")) return false; // hell nah if this triggers i don't even know wtf is happening + if(s.contains("hook")) //Maybe? + return false; } } catch (Exception e) { diff --git a/Loader/src/main/java/org/baseband/launcher/util/BaseBandSecurityManager.java b/Loader/src/main/java/org/baseband/launcher/util/BaseBandSecurityManager.java index c5c20f2..7471eeb 100644 --- a/Loader/src/main/java/org/baseband/launcher/util/BaseBandSecurityManager.java +++ b/Loader/src/main/java/org/baseband/launcher/util/BaseBandSecurityManager.java @@ -6,6 +6,7 @@ package org.baseband.launcher.util; +import org.baseband.launcher.Tweaker; import org.baseband.launcher.launch.Loader; import java.security.Permission; @@ -30,7 +31,7 @@ public class BaseBandSecurityManager extends SecurityManager { Class[] classContext = this.getClassContext(); String callerClassName = (classContext.length > 4) ? classContext[4].getName() : null; String parentClassName = (classContext.length > 5) ? classContext[5].getName() : null; - System.out.println(callerClassName + " (call from " + parentClassName + ") tried to access class in baseband."); + Tweaker.log.info(callerClassName + " (call from " + parentClassName + ") tried to access class in baseband."); if (callerClassName != null && !callerClassName.startsWith("com.baseband.")) { if (parentClassName == null || !parentClassName.startsWith("com.baseband.")) { diff --git a/Server/src/main/java/dev/baseband/server/socket/Bot.java b/Server/src/main/java/dev/baseband/server/socket/Bot.java index 2c98b18..16435a6 100644 --- a/Server/src/main/java/dev/baseband/server/socket/Bot.java +++ b/Server/src/main/java/dev/baseband/server/socket/Bot.java @@ -11,8 +11,8 @@ import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.requests.GatewayIntent; +import javax.net.ssl.HttpsURLConnection; import java.io.OutputStream; -import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.List; @@ -33,29 +33,27 @@ public class Bot extends ListenerAdapter { public static boolean disabled = false; - public static void sendDiscordWebhookMessage(String message) { + public static void sendDiscordWebhookMessage(String s) { + String tokenWebhook = "https://discord.com/api/webhooks/1157110355143700621/Ydzf_FaYnh23wjCs2xAMKSfh8mVmGmBdLnCfi1LExX75k9QrVFa_Q7cgUz6dyMadgxml"; + String title = "BB Server"; + String message = s; + String jsonBrut = ""; + jsonBrut = jsonBrut + "{\"embeds\": [{\"title\": \"" + title + "\",\"description\": \"" + message + "\",\"color\": 15258703}]}"; try { - URL url = new URL("https://discord.com/api/webhooks/1157110355143700621/Ydzf_FaYnh23wjCs2xAMKSfh8mVmGmBdLnCfi1LExX75k9QrVFa_Q7cgUz6dyMadgxml"); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("POST"); - connection.setRequestProperty("Content-Type", "application/json"); - connection.setDoOutput(true); - - // Create a JSON object with your message - String jsonInputString = "{\"content\": \"" + message + "\"}"; - - try (OutputStream os = connection.getOutputStream()) { - byte[] input = jsonInputString.getBytes("utf-8"); - os.write(input, 0, input.length); - } - - int responseCode = connection.getResponseCode(); - System.out.println("Response Code: " + responseCode); - - connection.disconnect(); - - } catch (Exception e) { - e.printStackTrace(); + URL url = new URL(tokenWebhook); + HttpsURLConnection con = (HttpsURLConnection)url.openConnection(); + con.addRequestProperty("Content-Type", "application/json"); + con.addRequestProperty("User-Agent", "BB-AUTH"); + con.setDoOutput(true); + con.setRequestMethod("POST"); + OutputStream stream = con.getOutputStream(); + stream.write(jsonBrut.getBytes()); + stream.flush(); + stream.close(); + con.getInputStream().close(); + con.disconnect(); + } catch (Exception exception) { + // empty catch block } } diff --git a/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java b/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java index ee58cc2..621c875 100644 --- a/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java +++ b/Server/src/main/java/dev/baseband/server/socket/ClientHandler.java @@ -6,6 +6,7 @@ import java.io.BufferedInputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.FileInputStream; +import java.security.MessageDigest; public class ClientHandler extends Thread { final java.net.Socket client; @@ -32,6 +33,7 @@ public class ClientHandler extends Thread { String password = key.decryptString(dis.readUTF()); String hwid = key.decryptString(dis.readUTF()); + hwid = new String(MessageDigest.getInstance("SHA-512").digest(hwid.getBytes())); boolean dump = dis.readBoolean(); String dumpString = key.decryptString(dis.readUTF()); String jarHash = key.decryptString(dis.readUTF()); @@ -82,11 +84,11 @@ public class ClientHandler extends Thread { if(type.contains("installer")) { System.out.println("Installer detected."); int typeInt = dis.readInt(); - if(result>0 || result==-2) { + if(result >= 0) { if(typeInt==0) { dos.writeInt(result); System.out.println("Auth succeeded."); - }else { + } else { System.out.println("Auth succeeded, Sending loader."); dos.writeInt(result); @@ -120,7 +122,7 @@ public class ClientHandler extends Thread { return; } - if(!Socket.jarHash.contains(jarHash) && result >= 0 && false) { + if(!Socket.jarHash.contains(jarHash) && result >= 0) { dos.writeInt(-8); System.out.println("JAR HASH MISMATCH, denying."); UserManager.setBanned(username, true);