From fb7e002056e82a346df3f64b2531b4528b4f488d Mon Sep 17 00:00:00 2001 From: Jess Date: Fri, 14 Jun 2024 00:04:46 +0100 Subject: [PATCH] make error messages prettier, make default root user disabled (LOL) --- .../java/de/com/baseband/launcher/Loader.java | 32 +++++++++++-------- .../launcher/security/impl/JVMArgImpl.java | 7 ++-- .../java/de/com/baseband/server/Main.java | 2 +- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Loader/src/main/java/de/com/baseband/launcher/Loader.java b/Loader/src/main/java/de/com/baseband/launcher/Loader.java index 1e548c8..c004ccd 100644 --- a/Loader/src/main/java/de/com/baseband/launcher/Loader.java +++ b/Loader/src/main/java/de/com/baseband/launcher/Loader.java @@ -39,15 +39,21 @@ public class Loader implements Util { public static Class baseBandClass; public enum Response { - OK, - FORBIDDEN, - OUTDATED, - BANNED, - RESET, - SERVER_ERROR, - SERVER_DOWN, - HWID_INVALID, - LOGIN_LOCKOUT, + OK("Ok."), + FORBIDDEN("Request Forbidden."), + OUTDATED("Your Loader is Outdated."), + BANNED("Account Banned."), + RESET("HWID Reset."), + SERVER_ERROR("Server Error, Contact a Member of staff."), + SERVER_DOWN("Server down for maintenance. Do not contact Staff as this is intentional."), + HWID_INVALID("Invalid HWID, Contact a Member of staff for a reset."), + LOGIN_LOCKOUT("Account Locked, Contact a Member of staff."); + + final String name; + + Response(String s) { + name = s; + } } private static final SystemInfo systemInfo = new SystemInfo(); @@ -68,6 +74,8 @@ public class Loader implements Util { Response status = Response.values()[inputStream.readInt()]; + LOGGER.info(status.name); + if(status == Response.OUTDATED) { LOGGER.info("BaseBand is downloading an update."); RawKey rk = new RawKey(key.toBytes()); @@ -101,10 +109,8 @@ public class Loader implements Util { LOGGER.fatal("BaseBand failed to (down)load."); e.printStackTrace(); } - } - else { - LOGGER.fatal("Server refused."); - LOGGER.error(status.ordinal()); + } else { + LOGGER.error(status.name); exit(); } } catch (Exception e) { diff --git a/Loader/src/main/java/de/com/baseband/launcher/security/impl/JVMArgImpl.java b/Loader/src/main/java/de/com/baseband/launcher/security/impl/JVMArgImpl.java index 9bc5201..2007d89 100644 --- a/Loader/src/main/java/de/com/baseband/launcher/security/impl/JVMArgImpl.java +++ b/Loader/src/main/java/de/com/baseband/launcher/security/impl/JVMArgImpl.java @@ -5,7 +5,6 @@ import de.com.baseband.launcher.security.SecurityImpl; import java.lang.management.ManagementFactory; import java.util.Arrays; import java.util.List; -import java.util.Optional; public class JVMArgImpl implements SecurityImpl { @@ -32,10 +31,8 @@ public class JVMArgImpl implements SecurityImpl { @Override public boolean run() { - Optional inputFlag = ManagementFactory.getRuntimeMXBean().getInputArguments().stream() + return ManagementFactory.getRuntimeMXBean().getInputArguments().stream() .filter(input -> BAD_INPUT_FLAGS.stream().anyMatch(input::contains)) - .findFirst(); - - return inputFlag.isPresent(); + .findFirst().isPresent(); } } diff --git a/Server/src/main/java/de/com/baseband/server/Main.java b/Server/src/main/java/de/com/baseband/server/Main.java index daa4cb4..b8f9be4 100644 --- a/Server/src/main/java/de/com/baseband/server/Main.java +++ b/Server/src/main/java/de/com/baseband/server/Main.java @@ -84,7 +84,7 @@ public class Main { tcn.set("password", BCrypt.withDefaults().hashToString(4, "test".toCharArray())); tcn.set("hardware-id", Hasher.sha512hex("hardware-id")); tcn.set("hardware-id-reset", true); - tcn.set("disabled", false); + tcn.set("disabled", true); tcn.set("discord-id", 0); tcn.set("branch", "release");