[ANY] Remove old guard/antiinject support

This commit is contained in:
Gravita 2023-02-26 19:01:43 +07:00
parent ffad29f53b
commit 930a5caf74
11 changed files with 0 additions and 93 deletions

View file

@ -16,7 +16,6 @@
public final class JARLauncherBinary extends LauncherBinary { public final class JARLauncherBinary extends LauncherBinary {
public final AtomicLong count; public final AtomicLong count;
public final Path runtimeDir; public final Path runtimeDir;
public final Path guardDir;
public final Path buildDir; public final Path buildDir;
public final List<Path> coreLibs; public final List<Path> coreLibs;
public final List<Path> addonLibs; public final List<Path> addonLibs;
@ -27,7 +26,6 @@ public JARLauncherBinary(LaunchServer server) throws IOException {
super(server, resolve(server, ".jar"), "Launcher-%s-%d.jar"); super(server, resolve(server, ".jar"), "Launcher-%s-%d.jar");
count = new AtomicLong(0); count = new AtomicLong(0);
runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR); runtimeDir = server.dir.resolve(Launcher.RUNTIME_DIR);
guardDir = server.dir.resolve(Launcher.GUARD_DIR);
buildDir = server.dir.resolve("build"); buildDir = server.dir.resolve("build");
coreLibs = new ArrayList<>(); coreLibs = new ArrayList<>();
addonLibs = new ArrayList<>(); addonLibs = new ArrayList<>();

View file

@ -72,7 +72,6 @@ public Path process(Path inputJar) throws IOException {
} else { } else {
context.pushDir(server.launcherBinary.runtimeDir, Launcher.RUNTIME_DIR, runtime, false); context.pushDir(server.launcherBinary.runtimeDir, Launcher.RUNTIME_DIR, runtime, false);
} }
context.pushDir(server.launcherBinary.guardDir, Launcher.GUARD_DIR, runtime, false);
LauncherConfig launcherConfig = new LauncherConfig(server.config.netty.address, server.keyAgreementManager.ecdsaPublicKey, server.keyAgreementManager.rsaPublicKey, runtime, server.config.projectName); LauncherConfig launcherConfig = new LauncherConfig(server.config.netty.address, server.keyAgreementManager.ecdsaPublicKey, server.keyAgreementManager.rsaPublicKey, runtime, server.config.projectName);
context.pushFile(Launcher.CONFIG_FILE, launcherConfig); context.pushFile(Launcher.CONFIG_FILE, launcherConfig);
@ -108,7 +107,6 @@ protected void initProps() {
properties.put("launcher.projectName", server.config.projectName); properties.put("launcher.projectName", server.config.projectName);
properties.put("runtimeconfig.secretKeyClient", SecurityHelper.randomStringAESKey()); properties.put("runtimeconfig.secretKeyClient", SecurityHelper.randomStringAESKey());
properties.put("launcher.port", 32148 + SecurityHelper.newRandom().nextInt(512)); properties.put("launcher.port", 32148 + SecurityHelper.newRandom().nextInt(512));
properties.put("launcher.guardType", server.config.launcher.guardType);
properties.put("launchercore.env", server.config.env); properties.put("launchercore.env", server.config.env);
properties.put("launcher.memory", server.config.launcher.memoryLimit); properties.put("launcher.memory", server.config.launcher.memoryLimit);
properties.put("launcher.customJvmOptions", server.config.launcher.customJvmOptions); properties.put("launcher.customJvmOptions", server.config.launcher.customJvmOptions);

View file

@ -60,7 +60,6 @@ public boolean allowDelete() {
public void tryUnpack() throws IOException { public void tryUnpack() throws IOException {
logger.info("Unpacking launcher native guard list and runtime"); logger.info("Unpacking launcher native guard list and runtime");
UnpackHelper.unpackZipNoCheck("guard.zip", server.launcherBinary.guardDir);
UnpackHelper.unpackZipNoCheck("runtime.zip", server.launcherBinary.runtimeDir); UnpackHelper.unpackZipNoCheck("runtime.zip", server.launcherBinary.runtimeDir);
} }

View file

@ -84,7 +84,6 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
newConfig.netty.performance.schedulerThread = 2; newConfig.netty.performance.schedulerThread = 2;
newConfig.launcher = new LauncherConf(); newConfig.launcher = new LauncherConf();
newConfig.launcher.guardType = "no";
newConfig.launcher.compress = true; newConfig.launcher.compress = true;
newConfig.launcher.deleteTempFiles = true; newConfig.launcher.deleteTempFiles = true;
newConfig.launcher.stripLineNumbers = true; newConfig.launcher.stripLineNumbers = true;
@ -269,7 +268,6 @@ public static class NettyUpdatesBind {
} }
public static class LauncherConf { public static class LauncherConf {
public String guardType;
public boolean compress; public boolean compress;
public boolean stripLineNumbers; public boolean stripLineNumbers;
public boolean deleteTempFiles; public boolean deleteTempFiles;

View file

@ -8,9 +8,6 @@
import pro.gravit.launcher.console.ModulesCommand; import pro.gravit.launcher.console.ModulesCommand;
import pro.gravit.launcher.console.SignDataCommand; import pro.gravit.launcher.console.SignDataCommand;
import pro.gravit.launcher.events.request.*; import pro.gravit.launcher.events.request.*;
import pro.gravit.launcher.guard.LauncherGuard;
import pro.gravit.launcher.guard.LauncherNoGuard;
import pro.gravit.launcher.guard.LauncherWrapperGuard;
import pro.gravit.launcher.gui.NoRuntimeProvider; import pro.gravit.launcher.gui.NoRuntimeProvider;
import pro.gravit.launcher.gui.RuntimeProvider; import pro.gravit.launcher.gui.RuntimeProvider;
import pro.gravit.launcher.managers.ClientGsonManager; import pro.gravit.launcher.managers.ClientGsonManager;
@ -49,7 +46,6 @@
public class LauncherEngine { public class LauncherEngine {
public static ClientLauncherProcess.ClientParams clientParams; public static ClientLauncherProcess.ClientParams clientParams;
public static LauncherGuard guard;
public static ClientModuleManager modulesManager; public static ClientModuleManager modulesManager;
public final boolean clientInstance; public final boolean clientInstance;
// Instance // Instance
@ -153,16 +149,6 @@ public static void verifyNoAgent() {
throw new SecurityException("JavaAgent found"); throw new SecurityException("JavaAgent found");
} }
public static LauncherGuard tryGetStdGuard() {
switch (Launcher.getConfig().guardType) {
case "no":
return new LauncherNoGuard();
case "wrapper":
return new LauncherWrapperGuard();
}
return null;
}
public static RequestService initOffline() { public static RequestService initOffline() {
OfflineRequestService service = new OfflineRequestService(); OfflineRequestService service = new OfflineRequestService();
applyBasicOfflineProcessors(service); applyBasicOfflineProcessors(service);
@ -232,7 +218,6 @@ public void readKeys() throws IOException, InvalidKeySpecException {
public void start(String... args) throws Throwable { public void start(String... args) throws Throwable {
//Launcher.modulesManager = new ClientModuleManager(this); //Launcher.modulesManager = new ClientModuleManager(this);
LauncherEngine.guard = tryGetStdGuard();
ClientPreGuiPhase event = new ClientPreGuiPhase(null); ClientPreGuiPhase event = new ClientPreGuiPhase(null);
LauncherEngine.modulesManager.invokeEvent(event); LauncherEngine.modulesManager.invokeEvent(event);
runtimeProvider = event.runtimeProvider; runtimeProvider = event.runtimeProvider;

View file

@ -133,7 +133,6 @@ private void applyClientProfile() {
public void start(boolean pipeOutput) throws IOException, InterruptedException { public void start(boolean pipeOutput) throws IOException, InterruptedException {
if (isStarted) throw new IllegalStateException("Process already started"); if (isStarted) throw new IllegalStateException("Process already started");
if (LauncherEngine.guard != null) LauncherEngine.guard.applyGuardParams(this);
LauncherEngine.modulesManager.invokeEvent(new ClientProcessBuilderPreLaunchEvent(this)); LauncherEngine.modulesManager.invokeEvent(new ClientProcessBuilderPreLaunchEvent(this));
List<String> processArgs = new LinkedList<>(); List<String> processArgs = new LinkedList<>();
processArgs.add(executeFile.toString()); processArgs.add(executeFile.toString());

View file

@ -1,9 +0,0 @@
package pro.gravit.launcher.guard;
import pro.gravit.launcher.client.ClientLauncherProcess;
public interface LauncherGuard {
String getName();
void applyGuardParams(ClientLauncherProcess process);
}

View file

@ -1,15 +0,0 @@
package pro.gravit.launcher.guard;
import pro.gravit.launcher.client.ClientLauncherProcess;
public class LauncherNoGuard implements LauncherGuard {
@Override
public String getName() {
return "noGuard";
}
@Override
public void applyGuardParams(ClientLauncherProcess process) {
//IGNORED
}
}

View file

@ -1,40 +0,0 @@
package pro.gravit.launcher.guard;
import pro.gravit.launcher.Launcher;
import pro.gravit.launcher.client.ClientLauncherProcess;
import pro.gravit.launcher.client.DirBridge;
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.UnpackHelper;
import java.io.IOException;
public class LauncherWrapperGuard implements LauncherGuard {
public LauncherWrapperGuard() {
try {
String wrapperName = JVMHelper.JVM_BITS == 64 ? "wrapper64.exe" : "wrapper32.exe";
String projectName = Launcher.getConfig().projectName;
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
String antiInjectName = JVMHelper.JVM_BITS == 64 ? "AntiInject64.dll" : "AntiInject32.dll";
UnpackHelper.unpack(Launcher.getResourceURL(wrapperName, "guard"), DirBridge.getGuardDir().resolve(wrapperUnpackName));
UnpackHelper.unpack(Launcher.getResourceURL(antiInjectName, "guard"), DirBridge.getGuardDir().resolve(antiInjectName));
} catch (IOException e) {
throw new SecurityException(e);
}
}
@Override
public String getName() {
return "wrapper";
}
@Override
public void applyGuardParams(ClientLauncherProcess process) {
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
String projectName = Launcher.getConfig().projectName;
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
process.executeFile = DirBridge.getGuardDir().resolve(wrapperUnpackName);
process.useLegacyJavaClassPathProperty = true;
}
}
}

View file

@ -41,7 +41,6 @@ public final class Launcher {
public static final String RUNTIME_DIR = "runtime"; public static final String RUNTIME_DIR = "runtime";
// Constants // Constants
public static final String GUARD_DIR = "guard";
public static final String CONFIG_FILE = "config.bin"; public static final String CONFIG_FILE = "config.bin";
private static final AtomicReference<LauncherConfig> CONFIG = new AtomicReference<>(); private static final AtomicReference<LauncherConfig> CONFIG = new AtomicReference<>();
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL); private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);

View file

@ -32,8 +32,6 @@ public final class LauncherConfig extends StreamObject {
public final ECPublicKey ecdsaPublicKey; public final ECPublicKey ecdsaPublicKey;
public final RSAPublicKey rsaPublicKey; public final RSAPublicKey rsaPublicKey;
public final Map<String, byte[]> runtime; public final Map<String, byte[]> runtime;
@LauncherInject("launcher.guardType")
public final String guardType;
@LauncherInject("runtimeconfig.secureCheckHash") @LauncherInject("runtimeconfig.secureCheckHash")
public final String secureCheckHash; public final String secureCheckHash;
@LauncherInject("runtimeconfig.secureCheckSalt") @LauncherInject("runtimeconfig.secureCheckSalt")
@ -68,7 +66,6 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
} catch (CertificateException e) { } catch (CertificateException e) {
throw new IOException(e); throw new IOException(e);
} }
guardType = null;
address = null; address = null;
environment = LauncherEnvironment.STD; environment = LauncherEnvironment.STD;
Launcher.applyLauncherEnv(environment); Launcher.applyLauncherEnv(environment);
@ -91,7 +88,6 @@ public LauncherConfig(String address, ECPublicKey ecdsaPublicKey, RSAPublicKey r
this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime)); this.runtime = Collections.unmodifiableMap(new HashMap<>(runtime));
this.projectName = projectName; this.projectName = projectName;
this.clientPort = 32148; this.clientPort = 32148;
guardType = "no";
environment = LauncherEnvironment.STD; environment = LauncherEnvironment.STD;
secureCheckSalt = null; secureCheckSalt = null;
secureCheckHash = null; secureCheckHash = null;
@ -109,7 +105,6 @@ public LauncherConfig(String address, Map<String, byte[]> runtime, String projec
this.rsaPublicKey = null; this.rsaPublicKey = null;
this.ecdsaPublicKey = null; this.ecdsaPublicKey = null;
environment = env; environment = env;
guardType = "no";
secureCheckSalt = null; secureCheckSalt = null;
secureCheckHash = null; secureCheckHash = null;
passwordEncryptKey = null; passwordEncryptKey = null;