[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 InsnNode(b ? Opcodes.ICONST_1 : Opcodes.ICONST_0));
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, autoGenConfigName, name, Type.BOOLEAN_TYPE.getInternalName())); 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); BuildContext context = new BuildContext(output, launcherConfigurator, this);
server.buildHookManager.hook(context); server.buildHookManager.hook(context);
launcherConfigurator.setAddress(server.config.netty.address); 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.setProjectName(server.config.projectName);
launcherConfigurator.setSecretKey(SecurityHelper.randomStringAESKey()); launcherConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
launcherConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512)); launcherConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));

View file

@ -84,7 +84,6 @@ public AuthProviderPair getAuthProviderPair() {
public ExeConf launch4j; public ExeConf launch4j;
public NettyConfig netty; public NettyConfig netty;
public GuardLicenseConf guardLicense;
public String whitelistRejectString; public String whitelistRejectString;
public LauncherConf launcher; public LauncherConf launcher;
@ -280,12 +279,6 @@ public NettyBindAddress(String address, int port) {
this.port = port; this.port = port;
} }
} }
public static class GuardLicenseConf {
public String name;
public String key;
public String encryptKey;
}
public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env)
{ {
LaunchServerConfig newConfig = new LaunchServerConfig(); 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(); LauncherConfig config = Launcher.getConfig();
switch (config.guardType) { switch (config.guardType) {
case "gravitguard": { case "gravitguard": {
guard = new LauncherGravitGuard(); guard = new LauncherStdGuard();
break; break;
} }
case "wrapper": { case "wrapper": {

View file

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

View file

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