diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java index e81b20de..5ab1a00d 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/LauncherConfigurator.java @@ -35,35 +35,6 @@ public void addModuleClass(String fullName) { initModuleMethod.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, modulesManagerName, "loadModule", registerModDesc)); } - public void setAddress(String address) { - setStringField("address", address); - } - - public void setPasswordEncryptKey(String pass) { - setStringField("passwordEncryptKey", pass); - } - - public void setProjectName(String name) { - setStringField("projectname", name); - } - - public void setSecretKey(String key) { - setStringField("secretKeyClient", key); - } - - public void setOemUnlockKey(String key) { - setStringField("oemUnlockKey", key); - } - - public void setGuardType(String key) { - setStringField("guardType", key); - } - - public void setSecureCheck(String hash, String salt) { - setStringField("secureCheckHash", hash); - setStringField("secureCheckSalt", salt); - } - public void setEnv(LauncherConfig.LauncherEnvironment env) { int i = 2; switch (env) { @@ -82,12 +53,4 @@ public void setEnv(LauncherConfig.LauncherEnvironment env) { } setIntegerField("env", i); } - - public void setClientPort(int port) { - setIntegerField("clientPort", port); - } - - public void setWarningMissArchJava(boolean b) { - setBooleanField("isWarningMissArchJava", b); - } } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java index b111755d..0c3b3b54 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/binary/tasks/MainBuildTask.java @@ -123,21 +123,22 @@ public Path process(Path inputJar) throws IOException { LauncherConfigurator launcherConfigurator = new LauncherConfigurator(cn); BuildContext context = new BuildContext(output, launcherConfigurator, this); server.buildHookManager.hook(context); - launcherConfigurator.setAddress(server.config.netty.address); - launcherConfigurator.setProjectName(server.config.projectName); - launcherConfigurator.setSecretKey(SecurityHelper.randomStringAESKey()); - launcherConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512)); - launcherConfigurator.setGuardType(server.config.launcher.guardType); - launcherConfigurator.setWarningMissArchJava(server.config.launcher.warningMissArchJava); + launcherConfigurator.setStringField("address", server.config.netty.address); + launcherConfigurator.setStringField("projectname", server.config.projectName); + launcherConfigurator.setStringField("secretKeyClient", SecurityHelper.randomStringAESKey()); + launcherConfigurator.setIntegerField("clientPort", 32148 + SecurityHelper.newRandom().nextInt(512)); + launcherConfigurator.setStringField("guardType", server.config.launcher.guardType); + launcherConfigurator.setBooleanField("isWarningMissArchJava", server.config.launcher.warningMissArchJava); launcherConfigurator.setEnv(server.config.env); - launcherConfigurator.setPasswordEncryptKey(server.runtime.passwordEncryptKey); + launcherConfigurator.setStringField("passwordEncryptKey", server.runtime.passwordEncryptKey); String launcherSalt = SecurityHelper.randomStringToken(); byte[] launcherSecureHash = SecurityHelper.digest(SecurityHelper.DigestAlgorithm.SHA256, server.runtime.clientCheckSecret.concat(".").concat(launcherSalt)); - launcherConfigurator.setSecureCheck(Base64.getEncoder().encodeToString(launcherSecureHash), launcherSalt); + launcherConfigurator.setStringField("secureCheckHash", Base64.getEncoder().encodeToString(launcherSecureHash)); + launcherConfigurator.setStringField("secureCheckSalt", launcherSalt); //LogHelper.debug("[checkSecure] %s: %s", launcherSalt, Arrays.toString(launcherSecureHash)); if (server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken(); - launcherConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey); + launcherConfigurator.setStringField("oemUnlockKey", server.runtime.oemUnlockKey); server.buildHookManager.registerAllClientModuleClass(launcherConfigurator); reader.getCp().add(new JarFile(inputJar.toFile())); server.launcherBinary.coreLibs.forEach(e -> {