Bot+Installer
This commit is contained in:
parent
3ee0497260
commit
faa880659d
20 changed files with 414 additions and 64 deletions
|
@ -15,7 +15,7 @@ import org.apache.logging.log4j.Logger;
|
|||
import java.awt.*;
|
||||
|
||||
public class Main {
|
||||
public static int buildNumber = 14;
|
||||
public static int buildNumber = 49;
|
||||
|
||||
public static final String name = "BaseBand";
|
||||
public static ModuleRegistry moduleRegistry;
|
||||
|
|
|
@ -10,7 +10,7 @@ public class CreditsCommand extends Command {
|
|||
|
||||
@Override
|
||||
public String run(String[] args) {
|
||||
Utils.sendChatMessage("Base and most of the loader written by JessSystemV, John200410 helped with the loader.");
|
||||
return null;
|
||||
Utils.sendChatMessage("Base and most of the loader written by JessSystemV, \nJohn200410 helped with the loader.");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ public class HelpCommand extends Command {
|
|||
|
||||
@Override
|
||||
public String run(String[] args) {
|
||||
return "BaseBand Rewrite Copyright (2023) JessSystemV";
|
||||
return "BaseBand Rewrite Copyright (2023) JessSystemV & TudbuT";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.baseband.client.command.commands;
|
|||
import com.baseband.client.Main;
|
||||
import com.baseband.client.command.Command;
|
||||
import com.baseband.client.module.Module;
|
||||
import com.baseband.client.module.ModuleRegistry;
|
||||
|
||||
public class ToggleCommand extends Command {
|
||||
public ToggleCommand() {
|
||||
|
@ -15,7 +14,7 @@ public class ToggleCommand extends Command {
|
|||
if (args.length != 1) {
|
||||
return "Please specify a module name.";
|
||||
}
|
||||
Module module = ModuleRegistry.getModule(args[0]);
|
||||
Module module = Main.moduleRegistry.getModule(args[0]);
|
||||
if (module == null) {
|
||||
return "Cannot find module.";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.baseband.client.module;
|
||||
|
||||
import com.baseband.client.module.modules.Brightness;
|
||||
import com.baseband.client.module.modules.ClickGUI;
|
||||
import com.baseband.client.module.modules.HUD;
|
||||
import com.baseband.client.module.modules.Test;
|
||||
|
@ -20,6 +21,7 @@ public class ModuleRegistry {
|
|||
}
|
||||
|
||||
void addModules() {
|
||||
modules.add(new Brightness());
|
||||
modules.add(new Test());
|
||||
modules.add(new HUD());
|
||||
modules.add(new ClickGUI());
|
||||
|
@ -53,7 +55,7 @@ public class ModuleRegistry {
|
|||
|
||||
static List<Module> modules = new ArrayList<>();
|
||||
|
||||
public static Module getModule(String name) {
|
||||
public Module getModule(String name) {
|
||||
for (Module m : modules) {
|
||||
if (m.getName().equalsIgnoreCase(name)) {
|
||||
return m;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.baseband.client.module.modules;
|
||||
|
||||
import com.baseband.client.Main;
|
||||
import com.baseband.client.module.Module;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class Brightness extends Module {
|
||||
public Brightness() {
|
||||
super("Brightness");
|
||||
}
|
||||
|
||||
|
||||
public void enable() {
|
||||
if(Main.isIngame()) {
|
||||
Minecraft.getMinecraft().gameSettings.gammaSetting=100f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void disable() {
|
||||
if(Main.isIngame()) {
|
||||
Minecraft.getMinecraft().gameSettings.gammaSetting=1f;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ public class Test extends Module {
|
|||
|
||||
|
||||
public void enable() {
|
||||
super.enable();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ shadowJar {
|
|||
version = "1.0"
|
||||
manifest {
|
||||
attributes(
|
||||
'Main-Class': 'com.thnkscj.installer.Main'
|
||||
'Main-Class': 'org.baseband.installer.Installer'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package com.thnkscj.installer;
|
||||
|
||||
import com.thnkscj.installer.util.library.LibraryInstaller;
|
||||
import com.thnkscj.installer.util.version.VersionInstaller;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import static com.thnkscj.installer.util.library.LibraryInstaller.toUrl;
|
||||
|
||||
public class Installer {
|
||||
public static String mainClassPath = "org.baseband.launcher";
|
||||
public static String jarPath = "com/thnkscj/loader/1.0.0/Loader-1.0.0.jar";
|
||||
public static URL jarUrl = toUrl("https://example.com/" + jarPath);
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
LibraryInstaller.download();
|
||||
VersionInstaller.injectVersionJson();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.baseband.installer;
|
||||
|
||||
import org.baseband.installer.util.library.LibraryInstaller;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.net.URL;
|
||||
|
||||
public class Installer {
|
||||
public static String mainClassPath = "org.baseband.launcher";
|
||||
public static String jarPath = "com/thnkscj/loader/1.0.0/Loader-1.0.0.jar";
|
||||
public static URL jarUrl = LibraryInstaller.toUrl("https://example.com/" + jarPath);
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
//LibraryInstaller.download();
|
||||
//VersionInstaller.injectVersionJson();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new InstallerApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
232
Installer/src/main/java/org/baseband/installer/InstallerApp.java
Normal file
232
Installer/src/main/java/org/baseband/installer/InstallerApp.java
Normal file
|
@ -0,0 +1,232 @@
|
|||
package org.baseband.installer;
|
||||
|
||||
import org.baseband.installer.util.minecraft.MinecraftFiles;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
public class InstallerApp {
|
||||
private JFrame loginFrame;
|
||||
private JFrame installerFrame;
|
||||
public static String username;
|
||||
public static String password;
|
||||
|
||||
public InstallerApp() {
|
||||
try {
|
||||
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
UIManager.put("TextField.border", BorderFactory.createEmptyBorder(5, 5, 5, 5)); // Add padding
|
||||
UIManager.put("PasswordField.border", BorderFactory.createEmptyBorder(5, 5, 5, 5)); // Add padding
|
||||
// Reduce the vertical size of text input fields
|
||||
int textFieldHeight = UIManager.getFont("TextField.font").getSize() + 5; // Adjust vertical size
|
||||
UIManager.put("TextField.height", textFieldHeight);
|
||||
UIManager.put("PasswordField.height", textFieldHeight);
|
||||
} catch (Exception e) {
|
||||
// Handle the exception
|
||||
}
|
||||
|
||||
createLoginWindow();
|
||||
}
|
||||
|
||||
boolean attempted = false;
|
||||
private void createLoginWindow() {
|
||||
loginFrame = new JFrame("BaseBand Login");
|
||||
loginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
loginFrame.setSize(300, 150);
|
||||
loginFrame.setLayout(new BorderLayout());
|
||||
loginFrame.setResizable(false); // Prevent maximizing
|
||||
loginFrame.setAlwaysOnTop(true); // Yes
|
||||
loginFrame.setLocationRelativeTo(null); // Center the login window on the screen
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new GridLayout(3, 2));
|
||||
|
||||
JLabel userLabel = new JLabel("Username:");
|
||||
JTextField userField = new JTextField();
|
||||
|
||||
JLabel passLabel = new JLabel("Password:");
|
||||
JPasswordField passField = new JPasswordField();
|
||||
|
||||
JToggleButton loginButton = new JToggleButton("Login");
|
||||
|
||||
loginButton.addItemListener(new ItemListener() {
|
||||
private boolean isPressed = false;
|
||||
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
isPressed = true;
|
||||
} else if (e.getStateChange() == ItemEvent.DESELECTED && isPressed) {
|
||||
loginButton.setSelected(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
loginButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if(attempted){
|
||||
return;
|
||||
}
|
||||
attempted=true;
|
||||
|
||||
loginButton.getModel().setPressed(true);
|
||||
String username = userField.getText();
|
||||
String password = new String(passField.getPassword());
|
||||
try {
|
||||
|
||||
Socket socket = new Socket("127.0.0.1", 31212);
|
||||
DataInputStream inputF = new DataInputStream(socket.getInputStream());
|
||||
DataOutputStream outputF = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
|
||||
InstallerApp.username=username;
|
||||
InstallerApp.password=bytesToHex(MessageDigest.getInstance("MD5").digest(password.getBytes()));
|
||||
|
||||
outputF.writeUTF("installer");
|
||||
outputF.writeUTF(InstallerApp.username);
|
||||
outputF.writeUTF(InstallerApp.password);
|
||||
outputF.writeUTF(generate());
|
||||
outputF.writeInt(0);
|
||||
|
||||
int responseInt = inputF.readInt();
|
||||
|
||||
if (responseInt == 0 || responseInt == -2) {
|
||||
loginFrame.dispose();
|
||||
createInstallerWindow();
|
||||
} else if (responseInt == -4) {
|
||||
JOptionPane.showMessageDialog(loginFrame, "Invalid HWID\nPlease contact support.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(0);
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(loginFrame, "Invalid username or password.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(0);
|
||||
}
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
});
|
||||
|
||||
panel.add(userLabel);
|
||||
panel.add(userField);
|
||||
panel.add(passLabel);
|
||||
panel.add(passField);
|
||||
panel.add(new JLabel()); // Empty cell for spacing
|
||||
panel.add(loginButton);
|
||||
|
||||
loginFrame.add(panel, BorderLayout.CENTER);
|
||||
loginFrame.setVisible(true);
|
||||
}
|
||||
|
||||
public static String generate() {
|
||||
try {
|
||||
return bytesToHex(MessageDigest.getInstance("MD5").digest((System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("COMPUTERNAME") + System.getProperty("user.name")).getBytes()));
|
||||
} catch (Exception e) {
|
||||
return "######################";
|
||||
}
|
||||
}
|
||||
|
||||
private static String bytesToHex(byte[] bytes) {
|
||||
char[] hexChars = new char[bytes.length * 2];
|
||||
for (int j = 0; j < bytes.length; j++) {
|
||||
int v = bytes[j] & 0xFF;
|
||||
hexChars[j * 2] = "0123456789ABCDEF".toCharArray()[v >>> 4];
|
||||
hexChars[j * 2 + 1] = "0123456789ABCDEF".toCharArray()[v & 0x0F];
|
||||
}
|
||||
return new String(hexChars);
|
||||
}
|
||||
|
||||
private void createInstallerWindow() {
|
||||
installerFrame = new JFrame("Installer");
|
||||
installerFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
installerFrame.setSize(330, 200);
|
||||
installerFrame.setLayout(new BorderLayout());
|
||||
installerFrame.setResizable(false); // Prevent maximizing
|
||||
installerFrame.setAlwaysOnTop(true); // Yes
|
||||
installerFrame.setLocationRelativeTo(null); // Center the login window on the screen
|
||||
|
||||
//JLabel logoLabel = new JLabel(new ImageIcon("path/to/logo.png"));
|
||||
//logoLabel.setHorizontalAlignment(JLabel.CENTER);
|
||||
|
||||
JTextField pathField = new JTextField();
|
||||
JButton filePickerButton = new JButton("Choose File");
|
||||
pathField.setText(MinecraftFiles.getMinecraftMods()+"BaseBand-Loader.jar");
|
||||
filePickerButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JFileChooser fileChooser = new JFileChooser();
|
||||
int result = fileChooser.showOpenDialog(installerFrame);
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
File selectedFile = fileChooser.getSelectedFile();
|
||||
pathField.setText(selectedFile.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JButton installButton = new JButton("Install");
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
GridLayout gridLayout = new GridLayout(4, 1);
|
||||
gridLayout.setHgap(10);
|
||||
panel.setLayout(gridLayout);
|
||||
// panel.add(logoLabel);
|
||||
JLabel text = new JLabel("BaseBand Installer");
|
||||
//panel.add(new JLabel()); // Empty cell for spacing
|
||||
text.setHorizontalAlignment(JLabel.CENTER);
|
||||
|
||||
|
||||
installButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
|
||||
Socket socket = new Socket("127.0.0.1", 31212);
|
||||
DataInputStream inputF = new DataInputStream(socket.getInputStream());
|
||||
DataOutputStream outputF = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
|
||||
outputF.writeUTF("installer");
|
||||
outputF.writeUTF(username);
|
||||
outputF.writeUTF(password);
|
||||
outputF.writeUTF(generate());
|
||||
outputF.writeInt(1);
|
||||
|
||||
int responseInt = inputF.readInt();
|
||||
|
||||
if (responseInt == 0 || responseInt == -2) {
|
||||
byte[] bytes = new byte[1024]; // You can adjust the buffer size as needed
|
||||
|
||||
InputStream is = socket.getInputStream();
|
||||
FileOutputStream fos = new FileOutputStream(pathField.getText());
|
||||
BufferedOutputStream bos = new BufferedOutputStream(fos);
|
||||
|
||||
int bytesRead;
|
||||
while ((bytesRead = is.read(bytes)) != -1) {
|
||||
bos.write(bytes, 0, bytesRead);
|
||||
}
|
||||
|
||||
bos.close();
|
||||
fos.close();
|
||||
JOptionPane.showMessageDialog(loginFrame, "Installed!", "BaseBand Installer", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
System.exit(0);
|
||||
}
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
panel.add(text); // Placeholder for your text
|
||||
panel.add(pathField);
|
||||
panel.add(filePickerButton);
|
||||
panel.add(installButton);
|
||||
|
||||
installerFrame.add(panel, BorderLayout.CENTER);
|
||||
installerFrame.setVisible(true);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.thnkscj.installer.util.library;
|
||||
package org.baseband.installer.util.library;
|
||||
|
||||
import com.thnkscj.installer.util.minecraft.MinecraftFiles;
|
||||
import org.baseband.installer.util.minecraft.MinecraftFiles;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -10,8 +10,8 @@ import java.net.URL;
|
|||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
|
||||
import static com.thnkscj.installer.Installer.jarPath;
|
||||
import static com.thnkscj.installer.Installer.jarUrl;
|
||||
import static org.baseband.installer.Installer.jarPath;
|
||||
import static org.baseband.installer.Installer.jarUrl;
|
||||
|
||||
public class LibraryInstaller {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.thnkscj.installer.util.minecraft;
|
||||
package org.baseband.installer.util.minecraft;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
@ -24,6 +24,22 @@ public class MinecraftFiles {
|
|||
return minecraft;
|
||||
}
|
||||
|
||||
public static String getMinecraftMods() {
|
||||
String minecraft = null;
|
||||
|
||||
assert os != null;
|
||||
|
||||
if (os.contains("nux")) {
|
||||
minecraft = System.getProperty("user.home") + "/.minecraft/mods/";
|
||||
} else if (os.contains("darwin") || os.contains("mac")) {
|
||||
minecraft = System.getProperty("user.home") + "/Library/Application Support/minecraft/mods/";
|
||||
} else if (os.contains("win")) {
|
||||
minecraft = System.getenv("APPDATA") + File.separator + ".minecraft" + File.separator + "mods" + File.separator;
|
||||
}
|
||||
|
||||
return minecraft;
|
||||
}
|
||||
|
||||
public static String getVersions() {
|
||||
if (minecraft != null) {
|
||||
versions = minecraft + "versions" + File.separator;
|
|
@ -1,6 +1,7 @@
|
|||
package com.thnkscj.installer.util.version;
|
||||
package org.baseband.installer.util.version;
|
||||
|
||||
import com.thnkscj.installer.Installer;
|
||||
import org.baseband.installer.Installer;
|
||||
import org.baseband.installer.util.minecraft.MinecraftFiles;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
@ -11,9 +12,6 @@ import java.nio.file.Files;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.thnkscj.installer.Installer.mainClassPath;
|
||||
import static com.thnkscj.installer.util.minecraft.MinecraftFiles.getVersions;
|
||||
|
||||
public class VersionInstaller {
|
||||
|
||||
public static JSONObject parseJSONFile(String filename) throws JSONException, IOException {
|
||||
|
@ -22,7 +20,7 @@ public class VersionInstaller {
|
|||
}
|
||||
|
||||
public static void injectVersionJson() throws IOException {
|
||||
File file2 = new File(getVersions());
|
||||
File file2 = new File(MinecraftFiles.getVersions());
|
||||
if (file2.isDirectory()) {
|
||||
for (File file1 : Objects.requireNonNull(file2.listFiles())) {
|
||||
if (!file1.isDirectory()) continue;
|
||||
|
@ -43,9 +41,9 @@ public class VersionInstaller {
|
|||
JSONObject obj = parseJSONFile(path);
|
||||
|
||||
String args = (String) obj.get("minecraftArguments");
|
||||
if (!args.contains("--tweakClass " + mainClassPath)) {
|
||||
if (!args.contains("--tweakClass " + Installer.mainClassPath)) {
|
||||
obj.remove("minecraftArguments");
|
||||
obj.put("minecraftArguments", args + " --tweakClass " + mainClassPath);
|
||||
obj.put("minecraftArguments", args + " --tweakClass " + Installer.mainClassPath);
|
||||
|
||||
Files.write(Paths.get(path), new JSONObject(obj.toString()).toString(2).getBytes());
|
||||
}
|
|
@ -5,7 +5,9 @@ import org.baseband.launcher.Tweaker;
|
|||
import org.baseband.launcher.util.CustomClassloader;
|
||||
import org.baseband.launcher.util.HWID;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -22,40 +24,41 @@ public class Loader {
|
|||
DataOutputStream outputF = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
|
||||
outputF.writeUTF("loader");
|
||||
outputF.writeUTF("Username");
|
||||
outputF.writeUTF("Password");
|
||||
outputF.writeUTF(HWID.generate());
|
||||
|
||||
|
||||
int responseCode = inputF.readInt();
|
||||
|
||||
switch (responseCode) {
|
||||
case -1: {
|
||||
Tweaker.log.fatal("Invalid Username/Password");
|
||||
exit();
|
||||
message("Invalid username/password","Invalid username/password " +
|
||||
"\nPlease contact support for more details.", JOptionPane.ERROR_MESSAGE, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case -2: {
|
||||
Tweaker.log.warn("HWID Reset.");
|
||||
message("HWID Reset.","Your HWID has been reset.", JOptionPane.INFORMATION_MESSAGE, false);
|
||||
break;
|
||||
}
|
||||
|
||||
case -3: {
|
||||
Tweaker.log.fatal("BaseBand Auth Temporarily Down.");
|
||||
exit();
|
||||
message("Auth Server Down.","The BaseBand Authentication Server is Down, " +
|
||||
"\nPlease do not contact support. " +
|
||||
"\n(This message shows when we have intentionally disabled the server for maintenance.)", JOptionPane.ERROR_MESSAGE, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case -4: {
|
||||
Tweaker.log.fatal("Invalid HWID, Please request a Reset.");
|
||||
exit();
|
||||
message("Invalid HWID","Invalid HWID, " +
|
||||
"\nPlease contact support for more details.", JOptionPane.ERROR_MESSAGE, true);
|
||||
break;
|
||||
}
|
||||
|
||||
case -5: {
|
||||
Tweaker.log.fatal("Your BaseBand account has been banned.");
|
||||
exit();
|
||||
message("Banned Account","Your BaseBand account has been banned," +
|
||||
"\nContact support for more details.", JOptionPane.ERROR_MESSAGE, true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -83,6 +86,7 @@ public class Loader {
|
|||
}
|
||||
bos.close();
|
||||
|
||||
|
||||
if (zipEntry.getName().endsWith(".class")) {
|
||||
classCache.put(zipEntry.getName().replace(".class", "").replace('/', '.'), bos.toByteArray());
|
||||
} else {
|
||||
|
@ -115,13 +119,36 @@ public class Loader {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tweaker.log.info("Loaded classes.");
|
||||
Tweaker.latch.countDown();
|
||||
} catch (Exception ignored) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void message(String title, String message, int b, boolean exit) {
|
||||
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (Exception ignored) {}
|
||||
JFrame jFrame = new JFrame();
|
||||
jFrame.setAlwaysOnTop(true);
|
||||
jFrame.setFocusable(false);
|
||||
JOptionPane.showMessageDialog(jFrame, message, "[BaseBand] " + title, b);
|
||||
jFrame.dispose();
|
||||
if(exit) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
public static void exit() {
|
||||
while(true);
|
||||
try {
|
||||
Class<?> shutdownClass = Class.forName("java.lang.Shutdown");
|
||||
Method exitMethod = shutdownClass.getDeclaredMethod("exit", int.class);
|
||||
exitMethod.setAccessible(true);
|
||||
exitMethod.invoke(null, 1);
|
||||
} catch (Exception b) {
|
||||
while(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@ public class CustomClassloader extends ClassLoader {
|
|||
|
||||
public CustomClassloader() {
|
||||
//lmao no touch my pie and you die
|
||||
//oh my god this took so long to figure out
|
||||
//CREDIT to John200410 who fucking baby-sat my ass
|
||||
//through the reflection classloader fuckery on lines 50-53
|
||||
|
||||
try {
|
||||
CustomMixinServer customService = new CustomMixinServer();
|
||||
|
|
|
@ -24,6 +24,7 @@ dependencies {
|
|||
}
|
||||
|
||||
jar {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from {
|
||||
configurations.embed.collect { it.isDirectory() ? it : zipTree(it) }
|
||||
} {
|
||||
|
|
|
@ -31,7 +31,6 @@ public class Bot extends ListenerAdapter {
|
|||
return;
|
||||
}
|
||||
String username = message[1];
|
||||
event.getChannel().sendMessage("Resetting HWID of username [**" + username + "**]").queue();
|
||||
if(UserManager.users.usernameExists(username)) {
|
||||
UserManager.users.setResetStatus(username, "true");
|
||||
event.getChannel().sendMessage("HWID of username [**" + username + "**] reset.").queue();
|
||||
|
|
|
@ -16,12 +16,14 @@ public class ClientHandler extends Thread {
|
|||
DataInputStream dis = new DataInputStream(client.getInputStream());
|
||||
|
||||
|
||||
|
||||
String type = dis.readUTF();
|
||||
String username = dis.readUTF();
|
||||
String hashedPassword = dis.readUTF();
|
||||
String hwid = dis.readUTF();
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("========================================");
|
||||
System.out.println("Client connected: " + client.getInetAddress().getHostAddress());
|
||||
System.out.println(username);
|
||||
|
@ -29,16 +31,50 @@ public class ClientHandler extends Thread {
|
|||
System.out.println(hwid);
|
||||
|
||||
int result = UserManager.isUserValid(username, hashedPassword, hwid);
|
||||
System.out.println(result);
|
||||
|
||||
if (result == 0) {
|
||||
if(type.contains("installer")) {
|
||||
System.out.println("Installer detected.");
|
||||
int typeInt = dis.readInt();
|
||||
if(result==0 || result==-2) {
|
||||
if(typeInt==0) {
|
||||
dos.writeInt(result);
|
||||
System.out.println("Auth succeeded.");
|
||||
}else {
|
||||
System.out.println("Auth succeeded, Sending loader.");
|
||||
dos.writeInt(result);
|
||||
byte[] bytes = new byte[(int) Socket.loaderFile.length()];
|
||||
|
||||
FileInputStream fis = new FileInputStream(Socket.loaderFile);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis);
|
||||
|
||||
bis.read(bytes, 0, bytes.length);
|
||||
dos.write(bytes, 0, bytes.length);
|
||||
|
||||
dos.flush();
|
||||
}
|
||||
} else if (result == -4){
|
||||
System.out.println("Invalid HWID");
|
||||
dos.writeInt(result);
|
||||
} else{
|
||||
System.out.println("Auth failed");
|
||||
dos.writeInt(result);
|
||||
}
|
||||
|
||||
client.close();
|
||||
System.out.println("========================================");
|
||||
return;
|
||||
}
|
||||
|
||||
if (result == 0 || result == -2) {
|
||||
System.out.println("Client is valid");
|
||||
|
||||
dos.writeInt(0);
|
||||
dos.writeInt(result);
|
||||
|
||||
|
||||
byte[] bytes = new byte[(int) Socket.file.length()];
|
||||
byte[] bytes = new byte[(int) Socket.clientFile.length()];
|
||||
|
||||
FileInputStream fis = new FileInputStream(Socket.file);
|
||||
FileInputStream fis = new FileInputStream(Socket.clientFile);
|
||||
BufferedInputStream bis = new BufferedInputStream(fis);
|
||||
|
||||
bis.read(bytes, 0, bytes.length);
|
||||
|
@ -48,6 +84,7 @@ public class ClientHandler extends Thread {
|
|||
|
||||
System.out.println("Sent File To Client");
|
||||
System.out.println("========================================");
|
||||
client.close();
|
||||
} else {
|
||||
System.out.println("Invalid, Error code "+result);
|
||||
System.out.println("========================================");
|
||||
|
|
|
@ -4,19 +4,27 @@ import java.io.*;
|
|||
import java.net.ServerSocket;
|
||||
|
||||
public class Socket {
|
||||
public static byte[] fileData;
|
||||
public static File file;
|
||||
public static byte[] clientFileData;
|
||||
public static File clientFile;
|
||||
|
||||
public static byte[] loaderFileData;
|
||||
public static File loaderFile;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static void launch(String[] args) throws IOException {
|
||||
if (args.length != 1) {
|
||||
System.err.println("Usage: java Main <file>.jar");
|
||||
if (args.length != 2) {
|
||||
System.err.println("Usage: java Main <client>.jar <loader>.jar");
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
file = new File(args[0]);
|
||||
fileData = readFully(args[0]);
|
||||
clientFile = new File(args[0]);
|
||||
clientFileData = readFully(args[0]);
|
||||
|
||||
loaderFile = new File(args[1]);
|
||||
loaderFileData = readFully(args[1]);
|
||||
|
||||
ServerSocket socket = new ServerSocket(31212);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue