something i did broke it sorry tud

This commit is contained in:
Jess 2023-09-30 01:18:13 +01:00
parent ab3923b1c7
commit 3e670caa4d
6 changed files with 25 additions and 27 deletions

View file

@ -34,11 +34,11 @@ import java.util.function.Consumer;
public class BaseBand { public class BaseBand {
public static int majorVersion = 1; public static int majorVersion = 1;
public static int buildNumber = 420; public static int buildNumber = 425;
public static String hash = "a6da9fde4af68e4f"; public static String hash = "13abf1c10d8b70e0";
public static String name = "BaseBand"; public static String name = "BaseBand";
public long timeOfCompile = 1696013042250L; public long timeOfCompile = 1696031498107L;
public CommandManager commandRegistry; public CommandManager commandRegistry;
public EventBus eventBus; public EventBus eventBus;
public ArrayList<Module> modules = new ArrayList<>(); public ArrayList<Module> modules = new ArrayList<>();

View file

@ -236,7 +236,8 @@ public class CustomClassloader extends ClassLoader {
private static class CustomMixinServer extends MixinServiceLaunchWrapper { private static class CustomMixinServer extends MixinServiceLaunchWrapper {
private CustomMixinServer() {} private CustomMixinServer() {
}
private final PermissionManager accessControl = new BBPermissionManager(new MixinRestriction()); private final PermissionManager accessControl = new BBPermissionManager(new MixinRestriction());

View file

@ -88,8 +88,8 @@ public class Loader {
resourceKey = new DataKeeper<>(dynamicPermissionManager, defaultStrictness, new Key()); resourceKey = new DataKeeper<>(dynamicPermissionManager, defaultStrictness, new Key());
try { try {
Socket socket = new Socket("127.0.0.1", 31212); //Socket socket = new Socket("127.0.0.1", 31212);
// Socket socket = new Socket("88.208.243.108", 31212); Socket socket = new Socket("88.208.243.108", 31212);
DataInputStream inputF = new DataInputStream(socket.getInputStream()); DataInputStream inputF = new DataInputStream(socket.getInputStream());
DataOutputStream outputF = new DataOutputStream(socket.getOutputStream()); DataOutputStream outputF = new DataOutputStream(socket.getOutputStream());
@ -143,13 +143,8 @@ public class Loader {
String file = Loader.class.getProtectionDomain().getCodeSource().getLocation().getFile(); String file = Loader.class.getProtectionDomain().getCodeSource().getLocation().getFile();
String filePM = BBPermissionManager.class.getProtectionDomain().getCodeSource().getLocation().getFile(); String filePM = BBPermissionManager.class.getProtectionDomain().getCodeSource().getLocation().getFile();
if(!file.endsWith(".jar") || !file.equals(filePM)) { if(!file.endsWith(".jar") || !file.equals(filePM)) {
System.out.println("--------"); message("An unexpected issue occurred.", "An unexpected issue occurred, " +
System.out.println("--------"); "\nPlease contact support. ", JOptionPane.ERROR_MESSAGE, true);
System.out.println("--------");
System.out.println("DM JESS.");
System.out.println("--------");
System.out.println("--------");
System.out.println("--------");
getPermissionManager().crash(null); getPermissionManager().crash(null);
return; return;
} }
@ -458,6 +453,7 @@ public class Loader {
public static void exit() { public static void exit() {
try { try {
DataKeeper.forgetAll=true; //REAL
Class<?> shutdownClass = Class.forName("java.lang.Shutdown"); Class<?> shutdownClass = Class.forName("java.lang.Shutdown");
Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class); Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class);
exitMethod.setAccessible(true); exitMethod.setAccessible(true);

View file

@ -21,7 +21,7 @@ public class BaseBandSecurityManager extends SecurityManager {
//Loader.exit(); //Loader.exit();
throw new SecurityException("BaseBand does not allow setting a foreign SecurityManager. Please contact basebandsec@mail.tudbut.de or @tudbut on Discord."); throw new SecurityException("BaseBand does not allow setting a foreign SecurityManager. Please contact basebandsec@mail.tudbut.de or @tudbut on Discord.");
} }
//noinspection ConstantValue,DuplicateCondition // noinspection ConstantValue
if (permissionName.equals("setSecurityManager")) { if (permissionName.equals("setSecurityManager")) {
Loader.exit(); Loader.exit();
} }

View file

@ -11,10 +11,10 @@ import java.util.UUID;
public class Key { public class Key {
protected final String string; private String string;
public Key() { public Key() {
string = getRandomTicket(); set();
} }
public Key(String key) { public Key(String key) {
@ -26,12 +26,12 @@ public class Key {
} }
private static String getRandomTicket() { private void set() {
StringBuilder buffer = new StringBuilder(); StringBuilder buffer = new StringBuilder();
for (int count = 0; count < 64; ++count) { for (int count = 0; count < 128; ++count) {
buffer.append(UUID.randomUUID()); buffer.append(UUID.randomUUID());
} }
return buffer.toString(); string = buffer.toString();
} }
public byte[] encryptByte(byte[] bytes) { public byte[] encryptByte(byte[] bytes) {

View file

@ -48,14 +48,6 @@ public class ClientHandler extends Thread {
System.out.println(dumpString); System.out.println(dumpString);
System.out.println(jarHash); System.out.println(jarHash);
if(!Socket.jarHash.contains(jarHash)) {
dos.writeInt(-8);
System.out.println("JAR HASH MISMATCH, denying.");
System.out.println("========================================");
Bot.sendDiscordWebhookMessage(username + " has an invalid hash.");
return;
}
int result; int result;
// TODO MUST ALWAYS BE FALSE // TODO MUST ALWAYS BE FALSE
if(false) { if(false) {
@ -128,6 +120,15 @@ public class ClientHandler extends Thread {
return; return;
} }
if(!Socket.jarHash.contains(jarHash) && result >= 0 && false) {
dos.writeInt(-8);
System.out.println("JAR HASH MISMATCH, denying.");
UserManager.setBanned(username, true);
System.out.println("========================================");
Bot.sendDiscordWebhookMessage(username + " has an invalid hash.");
return;
}
if (result >= 0 || result == -2) { if (result >= 0 || result == -2) {
System.out.println("Client is valid"); System.out.println("Client is valid");