Misc fixes

This commit is contained in:
Jess 2023-10-09 06:38:58 +01:00
parent 2745e969ac
commit b17876bf5f
5 changed files with 34 additions and 22 deletions

View file

@ -34,11 +34,11 @@ import java.util.function.Consumer;
public class BaseBand {
public static int majorVersion = 1;
public static int buildNumber = 465;
public static String hash = "ba757ba2fd71f658";
public static int buildNumber = 466;
public static String hash = "1d2648358af42270";
public static String name = "BaseBand";
public long timeOfCompile = 1696732715749L;
public long timeOfCompile = 1696820768856L;
public CommandManager commandRegistry;
public EventBus eventBus;
public ArrayList<Module> modules = new ArrayList<>();

View file

@ -27,13 +27,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@Restrict(Restrict.Edition.BETA)
public class RenderTest extends Module {
@Restrict(Restrict.Edition.PLUS)
public class HoleESP extends Module {
//Shitty holeesp as a "test" :3
@Override
public String toString() {
return "RenderTest";
return "HoleESP";
}
List<BlockPos> toRender = new CopyOnWriteArrayList<>();

View file

@ -27,7 +27,6 @@ import sun.misc.Unsafe;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.swing.*;
import java.io.*;
import java.lang.management.ManagementFactory;
@ -35,9 +34,9 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.Socket;
import java.security.*;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.KeyFactory;
import java.security.MessageDigest;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
@ -242,6 +241,12 @@ public class Loader {
break;
}
case -9: {
message("Update", "The Loader has been updated, " +
"\nPlease re-run the installer.", JOptionPane.ERROR_MESSAGE, true);
break;
}
default: {
Tweaker.log("Authenticated.");
}

View file

@ -4,20 +4,16 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.mindrot.jbcrypt.BCrypt;
import java.io.*;
import java.net.URL;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.SecretKeySpec;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.security.MessageDigest;
import java.security.PublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import java.util.Random;
public class ClientHandler extends Thread {
final java.net.Socket client;
@ -31,7 +27,7 @@ public class ClientHandler extends Thread {
@Override
public void run() {
try {
client.setSoTimeout(20000);
client.setSoTimeout(60000);
DataOutputStream dos = new DataOutputStream(client.getOutputStream());
DataInputStream dis = new DataInputStream(client.getInputStream());
@ -166,15 +162,24 @@ public class ClientHandler extends Thread {
return;
}
if(!Socket.jarHash.contains(jarHash) && result >= 0) {
if(!Socket.currentJarHash.equals(jarHash) && !Socket.pastJarHashes.contains(jarHash) && result >= 0) {
dos.writeInt(-8);
System.out.println("JAR HASH MISMATCH, denying.");
System.out.println("JAR HASH MISMATCH, banning.");
UserManager.setBanned(username, true);
System.out.println("========================================");
Bot.sendDiscordWebhookMessage(username + " has an invalid hash.");
return;
}
if(!Socket.currentJarHash.equals(jarHash) && Socket.pastJarHashes.contains(jarHash) && result >= 0) {
dos.writeInt(-8);
System.out.println("JAR HASH MISMATCH, denying.");
System.out.println("But it matches an old version, so tell them to redownload it");
System.out.println("========================================");
Bot.sendDiscordWebhookMessage(username + " has old loader.");
return;
}
if (result >= 0 || result == -2) {
System.out.println("Client is valid");

View file

@ -19,7 +19,8 @@ public class Socket {
public static byte[] loaderFileData;
public static File loaderFile;
public static Set<String> jarHash;
public static Set<String> pastJarHashes;
public static String currentJarHash;
@ -91,6 +92,7 @@ public class Socket {
jarHash.append(lengthifyStart(Integer.toHexString(Byte.toUnsignedInt(b)), "0", 2)).append(":");
}
System.out.println("Current valid jar hash: " + jarHash);
currentJarHash = jarHash.toString();
FileOutputStream validHashesOut = new FileOutputStream("valid_hashes.txt", true);
new PrintStream(validHashesOut).println(jarHash);
validHashesOut.close();
@ -99,7 +101,7 @@ public class Socket {
String s;
while ((s = reader.readLine()) != null)
hashes.add(s);
Socket.jarHash = hashes;
Socket.pastJarHashes = hashes;
ServerSocket socket = new ServerSocket(31212);