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 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) {

View file

@ -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<String> 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();
}
}

View file

@ -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");