make error messages prettier, make default root user disabled (LOL)

This commit is contained in:
Jess H 2024-06-14 00:04:46 +01:00
parent 1087c121ca
commit fb7e002056
Signed by: UnixSystemV
GPG key ID: 9B21C50B68D67F19
3 changed files with 22 additions and 19 deletions

View file

@ -39,15 +39,21 @@ public class Loader implements Util {
public static Class<?> baseBandClass; public static Class<?> baseBandClass;
public enum Response { public enum Response {
OK, OK("Ok."),
FORBIDDEN, FORBIDDEN("Request Forbidden."),
OUTDATED, OUTDATED("Your Loader is Outdated."),
BANNED, BANNED("Account Banned."),
RESET, RESET("HWID Reset."),
SERVER_ERROR, SERVER_ERROR("Server Error, Contact a Member of staff."),
SERVER_DOWN, SERVER_DOWN("Server down for maintenance. Do not contact Staff as this is intentional."),
HWID_INVALID, HWID_INVALID("Invalid HWID, Contact a Member of staff for a reset."),
LOGIN_LOCKOUT, LOGIN_LOCKOUT("Account Locked, Contact a Member of staff.");
final String name;
Response(String s) {
name = s;
}
} }
private static final SystemInfo systemInfo = new SystemInfo(); private static final SystemInfo systemInfo = new SystemInfo();
@ -68,6 +74,8 @@ public class Loader implements Util {
Response status = Response.values()[inputStream.readInt()]; Response status = Response.values()[inputStream.readInt()];
LOGGER.info(status.name);
if(status == Response.OUTDATED) { if(status == Response.OUTDATED) {
LOGGER.info("BaseBand is downloading an update."); LOGGER.info("BaseBand is downloading an update.");
RawKey rk = new RawKey(key.toBytes()); RawKey rk = new RawKey(key.toBytes());
@ -101,10 +109,8 @@ public class Loader implements Util {
LOGGER.fatal("BaseBand failed to (down)load."); LOGGER.fatal("BaseBand failed to (down)load.");
e.printStackTrace(); e.printStackTrace();
} }
} } else {
else { LOGGER.error(status.name);
LOGGER.fatal("Server refused.");
LOGGER.error(status.ordinal());
exit(); exit();
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -5,7 +5,6 @@ import de.com.baseband.launcher.security.SecurityImpl;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
public class JVMArgImpl implements SecurityImpl { public class JVMArgImpl implements SecurityImpl {
@ -32,10 +31,8 @@ public class JVMArgImpl implements SecurityImpl {
@Override @Override
public boolean run() { public boolean run() {
Optional<String> inputFlag = ManagementFactory.getRuntimeMXBean().getInputArguments().stream() return ManagementFactory.getRuntimeMXBean().getInputArguments().stream()
.filter(input -> BAD_INPUT_FLAGS.stream().anyMatch(input::contains)) .filter(input -> BAD_INPUT_FLAGS.stream().anyMatch(input::contains))
.findFirst(); .findFirst().isPresent();
return inputFlag.isPresent();
} }
} }

View file

@ -84,7 +84,7 @@ public class Main {
tcn.set("password", BCrypt.withDefaults().hashToString(4, "test".toCharArray())); tcn.set("password", BCrypt.withDefaults().hashToString(4, "test".toCharArray()));
tcn.set("hardware-id", Hasher.sha512hex("hardware-id")); tcn.set("hardware-id", Hasher.sha512hex("hardware-id"));
tcn.set("hardware-id-reset", true); tcn.set("hardware-id-reset", true);
tcn.set("disabled", false); tcn.set("disabled", true);
tcn.set("discord-id", 0); tcn.set("discord-id", 0);
tcn.set("branch", "release"); tcn.set("branch", "release");