mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] Поддержка в ConfigGenerator List<byte[]>
This commit is contained in:
parent
386a110eb1
commit
8ba00d106e
2 changed files with 23 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
package pro.gravit.launchserver.asm;
|
package pro.gravit.launchserver.asm;
|
||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
import org.objectweb.asm.ClassWriter;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
import org.objectweb.asm.tree.LdcInsnNode;
|
import org.objectweb.asm.tree.LdcInsnNode;
|
||||||
import org.objectweb.asm.tree.MethodInsnNode;
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
import org.objectweb.asm.tree.TypeInsnNode;
|
||||||
import org.objectweb.asm.tree.VarInsnNode;
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
public class ConfigGenerator {
|
public class ConfigGenerator {
|
||||||
|
@ -55,6 +57,23 @@ public void setByteArrayField(String name, byte[] value)
|
||||||
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/Base64$Decoder", "decode", base64DecDesc, false));
|
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/Base64$Decoder", "decode", base64DecDesc, false));
|
||||||
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, stringDesc));
|
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, stringDesc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setByteArrayListField(String name, List<byte[]> b)
|
||||||
|
{
|
||||||
|
constructor.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
constructor.instructions.add(new TypeInsnNode(Opcodes.NEW, "java/util/ArrayList"));
|
||||||
|
constructor.instructions.add(new InsnNode(Opcodes.DUP));
|
||||||
|
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "java/util/ArrayList", "<init>", "()V"));
|
||||||
|
for (byte[] value : b) {
|
||||||
|
constructor.instructions.add(new InsnNode(Opcodes.DUP));
|
||||||
|
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/Base64", "getDecoder", "()Ljava/util/Base64$Decoder;", false));
|
||||||
|
constructor.instructions.add(NodeUtils.getSafeStringInsnList(Base64.getEncoder().encodeToString(value)));
|
||||||
|
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/util/Base64$Decoder", "decode", base64DecDesc, false));
|
||||||
|
constructor.instructions.add(new MethodInsnNode(Opcodes.INVOKEINTERFACE, "java/util/List", "add", "(Ljava/lang/Object;)Z", false));
|
||||||
|
constructor.instructions.add(new InsnNode(Opcodes.POP));
|
||||||
|
}
|
||||||
|
constructor.instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, configclass.name, name, "Ljava/util/List;"));
|
||||||
|
}
|
||||||
|
|
||||||
public void setIntegerField(String name, int value)
|
public void setIntegerField(String name, int value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package pro.gravit.launcher;
|
package pro.gravit.launcher;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public class SecureAutogenConfig {
|
public class SecureAutogenConfig {
|
||||||
public byte[][] certificates;
|
public byte[][] certificates;
|
||||||
|
|
||||||
|
@ -38,7 +40,8 @@ public SecureAutogenConfig() {
|
||||||
"OATWgSKH0qTkleE/v7k+USs0a+KV8wmC5wwliqH+uLO++yIP/9bjDctyLulQX5Ee\n" +
|
"OATWgSKH0qTkleE/v7k+USs0a+KV8wmC5wwliqH+uLO++yIP/9bjDctyLulQX5Ee\n" +
|
||||||
"+EhD7tb1R/yyWY4uhkzlsr3N2Kl34aQAEBMn8Z1mHsyyu1FcbEaNLU8jcS3pHPVM\n" +
|
"+EhD7tb1R/yyWY4uhkzlsr3N2Kl34aQAEBMn8Z1mHsyyu1FcbEaNLU8jcS3pHPVM\n" +
|
||||||
"gQRn3m1iDnQlFciAMxW0pW6mW/4xKYzhXk5BTSolnqMVylxHgWXuBwdDDQQVnQ==\n" +
|
"gQRn3m1iDnQlFciAMxW0pW6mW/4xKYzhXk5BTSolnqMVylxHgWXuBwdDDQQVnQ==\n" +
|
||||||
"-----END CERTIFICATE-----").getBytes()
|
"-----END CERTIFICATE-----").getBytes(StandardCharsets.US_ASCII)
|
||||||
|
// ? Какая из них, но выбрать надо однозачно
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue