mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FEATURE]Полноценная реализация блокировки launcher консоли
This commit is contained in:
parent
5373856646
commit
c5635de295
6 changed files with 17 additions and 1 deletions
|
@ -83,6 +83,12 @@ public void setSecretKey(String key) {
|
||||||
body.append("\";");
|
body.append("\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOemUnlockKey(String key) {
|
||||||
|
body.append("this.oemUnlockKey = \"");
|
||||||
|
body.append(key);
|
||||||
|
body.append("\";");
|
||||||
|
}
|
||||||
|
|
||||||
public void setGuardType(String key) {
|
public void setGuardType(String key) {
|
||||||
body.append("this.guardType = \"");
|
body.append("this.guardType = \"");
|
||||||
body.append(key);
|
body.append(key);
|
||||||
|
|
|
@ -137,6 +137,8 @@ public Path process(Path inputJar) throws IOException {
|
||||||
jaConfigurator.setGuardType(server.config.launcher.guardType);
|
jaConfigurator.setGuardType(server.config.launcher.guardType);
|
||||||
jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava);
|
jaConfigurator.setWarningMissArchJava(server.config.isWarningMissArchJava);
|
||||||
jaConfigurator.setEnv(server.config.env);
|
jaConfigurator.setEnv(server.config.env);
|
||||||
|
if(server.runtime.oemUnlockKey == null) server.runtime.oemUnlockKey = SecurityHelper.randomStringToken();
|
||||||
|
jaConfigurator.setOemUnlockKey(server.runtime.oemUnlockKey);
|
||||||
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
server.buildHookManager.registerAllClientModuleClass(jaConfigurator);
|
||||||
reader.getCp().add(new JarFile(inputJar.toFile()));
|
reader.getCp().add(new JarFile(inputJar.toFile()));
|
||||||
server.launcherBinary.coreLibs.forEach(e -> {
|
server.launcherBinary.coreLibs.forEach(e -> {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
public class LaunchServerRuntimeConfig {
|
public class LaunchServerRuntimeConfig {
|
||||||
public String clientToken;
|
public String clientToken;
|
||||||
|
public String oemUnlockKey;
|
||||||
|
|
||||||
public void verify() {
|
public void verify() {
|
||||||
if (clientToken == null) LogHelper.error("[RuntimeConfig] clientToken must not be null");
|
if (clientToken == null) LogHelper.error("[RuntimeConfig] clientToken must not be null");
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.gravit.launcher.managers;
|
package ru.gravit.launcher.managers;
|
||||||
|
|
||||||
|
import ru.gravit.launcher.Launcher;
|
||||||
import ru.gravit.launcher.console.FeatureCommand;
|
import ru.gravit.launcher.console.FeatureCommand;
|
||||||
import ru.gravit.launcher.console.UnlockCommand;
|
import ru.gravit.launcher.console.UnlockCommand;
|
||||||
import ru.gravit.launcher.console.admin.ExecCommand;
|
import ru.gravit.launcher.console.admin.ExecCommand;
|
||||||
|
@ -19,6 +20,9 @@
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
public class ConsoleManager {
|
public class ConsoleManager {
|
||||||
public static CommandHandler handler;
|
public static CommandHandler handler;
|
||||||
|
@ -50,7 +54,7 @@ public static void registerCommands() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean checkUnlockKey(String key) {
|
public static boolean checkUnlockKey(String key) {
|
||||||
return true;
|
return key.equals(Launcher.getConfig().oemUnlockKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unlock() {
|
public static void unlock() {
|
||||||
|
|
|
@ -8,6 +8,7 @@ public class AutogenConfig {
|
||||||
private boolean isInitModules;
|
private boolean isInitModules;
|
||||||
public String guardType;
|
public String guardType;
|
||||||
public String secretKeyClient;
|
public String secretKeyClient;
|
||||||
|
public String oemUnlockKey;
|
||||||
public String guardLicenseName;
|
public String guardLicenseName;
|
||||||
public String guardLicenseKey;
|
public String guardLicenseKey;
|
||||||
public String guardLicenseEncryptKey;
|
public String guardLicenseEncryptKey;
|
||||||
|
|
|
@ -25,6 +25,7 @@ public static AutogenConfig getAutogenConfig() {
|
||||||
public final String projectname;
|
public final String projectname;
|
||||||
public final int clientPort;
|
public final int clientPort;
|
||||||
public String secretKeyClient;
|
public String secretKeyClient;
|
||||||
|
public String oemUnlockKey;
|
||||||
@LauncherAPI
|
@LauncherAPI
|
||||||
public final RSAPublicKey publicKey;
|
public final RSAPublicKey publicKey;
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
|
||||||
projectname = config.projectname;
|
projectname = config.projectname;
|
||||||
clientPort = config.clientPort;
|
clientPort = config.clientPort;
|
||||||
secretKeyClient = config.secretKeyClient;
|
secretKeyClient = config.secretKeyClient;
|
||||||
|
oemUnlockKey = config.oemUnlockKey;
|
||||||
|
|
||||||
isWarningMissArchJava = config.isWarningMissArchJava;
|
isWarningMissArchJava = config.isWarningMissArchJava;
|
||||||
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
guardLicenseEncryptKey = config.guardLicenseEncryptKey;
|
||||||
|
|
Loading…
Reference in a new issue