[FIX] Вырезана лицензия на защиту

This commit is contained in:
Gravit 2019-10-16 17:08:48 +07:00
parent a84f489f0d
commit 35a94ae59f
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
7 changed files with 4 additions and 70 deletions

View file

@ -150,32 +150,4 @@ private void setBooleanField(String name, boolean b)
constructor.instructions.add(new InsnNode(b ? Opcodes.ICONST_1 : Opcodes.ICONST_0));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, name, Type.BOOLEAN_TYPE.getInternalName()));
}
public void setGuardLicense(String name, String key, String encryptKey) {
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
constructor.instructions.add(new LdcInsnNode(name));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, "guardLicenseName", stringDesc));
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
constructor.instructions.add(new LdcInsnNode(key));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, "guardLicenseKey", stringDesc));
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
constructor.instructions.add(new LdcInsnNode(encryptKey));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, "guardLicenseEncryptKey", stringDesc));
}
public void nullGuardLicense() {
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
constructor.instructions.add(new InsnNode(Opcodes.ACONST_NULL));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, "guardLicenseName", stringDesc));
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
constructor.instructions.add(new InsnNode(Opcodes.ACONST_NULL));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, "guardLicenseKey", stringDesc));
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
constructor.instructions.add(new InsnNode(Opcodes.ACONST_NULL));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, "guardLicenseEncryptKey", stringDesc));
}
}

View file

@ -124,10 +124,6 @@ public Path process(Path inputJar) throws IOException {
BuildContext context = new BuildContext(output, launcherConfigurator, this);
server.buildHookManager.hook(context);
launcherConfigurator.setAddress(server.config.netty.address);
if (server.config.guardLicense != null)
launcherConfigurator.setGuardLicense(server.config.guardLicense.name, server.config.guardLicense.key, server.config.guardLicense.encryptKey);
else
launcherConfigurator.nullGuardLicense();
launcherConfigurator.setProjectName(server.config.projectName);
launcherConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
launcherConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));

View file

@ -84,7 +84,6 @@ public AuthProviderPair getAuthProviderPair() {
public ExeConf launch4j;
public NettyConfig netty;
public GuardLicenseConf guardLicense;
public String whitelistRejectString;
public LauncherConf launcher;
@ -280,12 +279,6 @@ public NettyBindAddress(String address, int port) {
this.port = port;
}
}
public static class GuardLicenseConf {
public String name;
public String key;
public String encryptKey;
}
public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env)
{
LaunchServerConfig newConfig = new LaunchServerConfig();

View file

@ -1,22 +0,0 @@
package pro.gravit.launcher.bridge;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import pro.gravit.launcher.LauncherAPI;
@LauncherAPI
public class GravitGuardBridge {
@LauncherAPI
public static native void callGuard();
@LauncherAPI
public static int sendHTTPRequest(String strurl) throws IOException {
URL url = new URL(strurl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Content-Language", "en-US");
return connection.getResponseCode();
}
}

View file

@ -12,7 +12,7 @@ public static void initGuard(boolean clientInstance) {
LauncherConfig config = Launcher.getConfig();
switch (config.guardType) {
case "gravitguard": {
guard = new LauncherGravitGuard();
guard = new LauncherStdGuard();
break;
}
case "wrapper": {

View file

@ -8,7 +8,6 @@
import pro.gravit.launcher.Launcher;
import pro.gravit.launcher.LauncherConfig;
import pro.gravit.launcher.bridge.GravitGuardBridge;
import pro.gravit.launcher.client.ClientLauncher;
import pro.gravit.launcher.client.ClientLauncherContext;
import pro.gravit.launcher.client.DirBridge;
@ -16,14 +15,14 @@
import pro.gravit.utils.helper.JVMHelper;
import pro.gravit.utils.helper.UnpackHelper;
//Используется для всех типов защит, совместимых с новым GravitGuard API
public class LauncherGravitGuard implements LauncherGuardInterface {
//Стандартный интерфейс для всех AntiInject
public class LauncherStdGuard implements LauncherGuardInterface {
public String protectToken;
public Path javaBinPath;
@Override
public String getName() {
return "gravitguard";
return "stdguard";
}
@Override
@ -58,7 +57,6 @@ public void init(boolean clientInstance) {
} catch (IOException e) {
throw new SecurityException(e);
}
if (clientInstance && JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) GravitGuardBridge.callGuard();
}
@Override
@ -74,9 +72,7 @@ public void addCustomEnv(ClientLauncherContext context) {
else
env.put("JAVA_HOME", javaBinPath.toAbsolutePath().toString());
LauncherConfig config = Launcher.getConfig();
env.put("GUARD_BRIDGE", GravitGuardBridge.class.getName());
env.put("GUARD_USERNAME", context.playerProfile.username);
//env.put("GUARD_PUBLICKEY", config.publicKey.getModulus().toString(16));
env.put("GUARD_PROJECTNAME", config.projectname);
if (protectToken != null)
env.put("GUARD_TOKEN", protectToken);

View file

@ -63,7 +63,6 @@ public void addCustomEnv(ClientLauncherContext context) {
env.put("JAVA_HOME", System.getProperty("java.home"));
LauncherConfig config = Launcher.getConfig();
env.put("GUARD_USERNAME", context.playerProfile.username);
//env.put("GUARD_PUBLICKEY", config.publicKey.getModulus().toString(16));
env.put("GUARD_PROJECTNAME", config.projectname);
if (protectToken != null)
env.put("GUARD_TOKEN", protectToken);