moar
This commit is contained in:
parent
b17876bf5f
commit
f6a09ec495
5 changed files with 21 additions and 18 deletions
|
@ -34,11 +34,11 @@ import java.util.function.Consumer;
|
|||
|
||||
public class BaseBand {
|
||||
public static int majorVersion = 1;
|
||||
public static int buildNumber = 466;
|
||||
public static String hash = "1d2648358af42270";
|
||||
public static int buildNumber = 468;
|
||||
public static String hash = "2714cbd106927da2";
|
||||
|
||||
public static String name = "BaseBand";
|
||||
public long timeOfCompile = 1696820768856L;
|
||||
public long timeOfCompile = 1696830524662L;
|
||||
public CommandManager commandRegistry;
|
||||
public EventBus eventBus;
|
||||
public ArrayList<Module> modules = new ArrayList<>();
|
||||
|
|
|
@ -94,8 +94,8 @@ public class Loader {
|
|||
resourceKey = new DataKeeper<>(dynamicPermissionManager, defaultStrictness, new Key());
|
||||
|
||||
try {
|
||||
Socket socket = new Socket("127.0.0.1", 31212);
|
||||
// Socket socket = new Socket("88.208.243.108", 31212);
|
||||
// Socket socket = new Socket("127.0.0.1", 31212);
|
||||
Socket socket = new Socket("88.208.243.108", 31212);
|
||||
|
||||
// initialize REALLY FUNNY encryption
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
|
@ -242,7 +242,7 @@ public class Loader {
|
|||
}
|
||||
|
||||
case -9: {
|
||||
message("Update", "The Loader has been updated, " +
|
||||
message("Update", "Re-run the installer. " +
|
||||
"\nPlease re-run the installer.", JOptionPane.ERROR_MESSAGE, true);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package dev.baseband.server;
|
||||
|
||||
import dev.baseband.server.socket.Bot;
|
||||
import dev.baseband.server.socket.Socket;
|
||||
import dev.baseband.server.socket.SocketHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
@ -10,6 +10,6 @@ import java.security.spec.InvalidKeySpecException;
|
|||
public class Main {
|
||||
public static void main(String[] args) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
Bot.start();
|
||||
Socket.launch(args);
|
||||
SocketHandler.launch(args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,14 +11,15 @@ import java.io.BufferedReader;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Base64;
|
||||
|
||||
public class ClientHandler extends Thread {
|
||||
final java.net.Socket client;
|
||||
final Socket client;
|
||||
|
||||
public ClientHandler(java.net.Socket client) {
|
||||
public ClientHandler(Socket client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class ClientHandler extends Thread {
|
|||
DataInputStream dis = new DataInputStream(client.getInputStream());
|
||||
|
||||
Cipher decrypt = Cipher.getInstance("RSA");
|
||||
decrypt.init(Cipher.DECRYPT_MODE, Socket.key.getPrivate());
|
||||
decrypt.init(Cipher.DECRYPT_MODE, SocketHandler.key.getPrivate());
|
||||
|
||||
byte[] aesBytes = new byte[dis.readInt()];
|
||||
dis.readFully(aesBytes);
|
||||
|
@ -141,7 +142,7 @@ public class ClientHandler extends Thread {
|
|||
System.out.println("Auth succeeded, Sending loader.");
|
||||
dos.writeInt(result);
|
||||
|
||||
byte[] encryptedBytes = key.encryptByte(aesE.doFinal(Socket.loaderFileData));
|
||||
byte[] encryptedBytes = key.encryptByte(aesE.doFinal(SocketHandler.loaderFileData));
|
||||
dos.writeInt(encryptedBytes.length);
|
||||
dos.write(encryptedBytes, 0, encryptedBytes.length);
|
||||
dos.flush();
|
||||
|
@ -162,7 +163,7 @@ public class ClientHandler extends Thread {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!Socket.currentJarHash.equals(jarHash) && !Socket.pastJarHashes.contains(jarHash) && result >= 0) {
|
||||
if(!SocketHandler.currentJarHash.equals(jarHash) && !SocketHandler.pastJarHashes.contains(jarHash) && result >= 0) {
|
||||
dos.writeInt(-8);
|
||||
System.out.println("JAR HASH MISMATCH, banning.");
|
||||
UserManager.setBanned(username, true);
|
||||
|
@ -171,7 +172,7 @@ public class ClientHandler extends Thread {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!Socket.currentJarHash.equals(jarHash) && Socket.pastJarHashes.contains(jarHash) && result >= 0) {
|
||||
if(!SocketHandler.currentJarHash.equals(jarHash) && SocketHandler.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");
|
||||
|
@ -185,7 +186,7 @@ public class ClientHandler extends Thread {
|
|||
System.out.println("Client is valid");
|
||||
dos.writeInt(result);
|
||||
|
||||
byte[] encryptedBytes = key.encryptByte(aesE.doFinal(Socket.clientFileData));
|
||||
byte[] encryptedBytes = key.encryptByte(aesE.doFinal(SocketHandler.clientFileData));
|
||||
dos.writeInt(encryptedBytes.length);
|
||||
dos.write(encryptedBytes, 0, encryptedBytes.length);
|
||||
dos.flush();
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Base64;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Socket {
|
||||
public class SocketHandler {
|
||||
public static KeyPair key;
|
||||
public static KeyFactory factory;
|
||||
public static byte[] clientFileData;
|
||||
|
@ -94,14 +94,16 @@ public class Socket {
|
|||
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();
|
||||
HashSet<String> hashes = new HashSet<>();
|
||||
BufferedReader reader = new BufferedReader(new FileReader("valid_hashes.txt"));
|
||||
String s;
|
||||
while ((s = reader.readLine()) != null)
|
||||
hashes.add(s);
|
||||
Socket.pastJarHashes = hashes;
|
||||
if(!hashes.contains(currentJarHash)) {
|
||||
new PrintStream(validHashesOut).println(jarHash);
|
||||
}
|
||||
SocketHandler.pastJarHashes = hashes;
|
||||
|
||||
ServerSocket socket = new ServerSocket(31212);
|
||||
|
Loading…
Add table
Reference in a new issue