feat: support rainbow v2025.3.4

This commit is contained in:
yelochick 2025-08-26 16:18:45 +08:00
parent b316de054e
commit 3e5cf0680d
10 changed files with 16 additions and 41 deletions

View File

@ -9,8 +9,9 @@ PREFIX,com.janetfilter
PREFIX,jdk.internal.org.objectweb.asm
[Hide_Resource]
EQUAL,/6c81ec87e55d331c267262e892427a3d93d76683.txt
# EQUAL,/6c81ec87e55d331c267262e892427a3d93d76683.txt
PREFIX,/com/janetfilter
PREFIX,/com/novitechie
[Hide_Env]
EQUAL,IDEA_VM_OPTIONS
@ -37,8 +38,8 @@ EQUAL,janf.output
[Ignore_Class]
EQUAL,com.janetfilter.core.utils.StringUtils
EQUAL,com.janetfilter.core.utils.DateUtils
# EQUAL,com.janetfilter.core.utils.DateUtils
[Ignore_Resource]
EQUAL,/com/janetfilter/core/utils/StringUtils.class
EQUAL,/com/janetfilter/core/utils/DateUtils.class
# EQUAL,/com/janetfilter/core/utils/DateUtils.class

View File

@ -21,12 +21,12 @@ public class LicensingFacadeTransformer implements MyTransformer {
for (MethodNode m : node.methods) {
if ("getLicenseExpirationDate".equals(m.name)) {
InsnList list = new InsnList();
LabelNode L0 = new LabelNode();
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/StackTraceRule", "hook", "()Ljava/util/Date;", false));
list.add(new InsnNode(DUP));
LabelNode labelNode = new LabelNode();
list.add(new JumpInsnNode(IFNULL, labelNode));
list.add(new JumpInsnNode(IFNULL, L0));
list.add(new InsnNode(ARETURN));
list.add(labelNode);
list.add(L0);
list.add(new InsnNode(POP));
m.instructions.insert(list);
}

View File

@ -42,7 +42,9 @@ public class MethodTransformer implements MyTransformer {
list.add(new InsnNode(AALOAD));
list.add(new MethodInsnNode(INVOKESTATIC, "java/lang/String", "valueOf", "(Ljava/lang/Object;)Ljava/lang/String;", false));
list.add(new VarInsnNode(ASTORE, 3));
// list.add(new LdcInsnNode("com.janetfilter"));
list.add(new VarInsnNode(ALOAD, 3));
// list.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/String", "startsWith", "(Ljava/lang/String;)Z", false));
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/BootstrapClassRule", "check", "(Ljava/lang/String;)Z", false));
list.add(new JumpInsnNode(IFEQ, L0));
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/StackTraceRule", "check", "()Z", false));

View File

@ -31,8 +31,7 @@ public class PluginManagerCoreTransformer implements MyTransformer {
LabelNode L3 = new LabelNode();
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/StackTraceRule", "check", "()Z", false));
list.add(new JumpInsnNode(IFEQ, L0));
list.add(new FieldInsnNode(GETSTATIC, "com/intellij/ide/plugins/PluginManagerCore", "INSTANCE", "Lcom/intellij/ide/plugins/PluginManagerCore;"));
list.add(new MethodInsnNode(INVOKEVIRTUAL, "com/intellij/ide/plugins/PluginManagerCore", "getPluginSet", "()Lcom/intellij/ide/plugins/PluginSet;", false));
list.add(new MethodInsnNode(INVOKESTATIC, "com/intellij/ide/plugins/PluginManagerCore", "getPluginSet", "()Lcom/intellij/ide/plugins/PluginSet;", false));
list.add(new FieldInsnNode(GETFIELD, "com/intellij/ide/plugins/PluginSet", "allPlugins", "Ljava/util/Set;"));
list.add(new VarInsnNode(ASTORE, 0));
list.add(new TypeInsnNode(NEW, "java/util/HashSet"));

View File

@ -1,28 +0,0 @@
package com.novitechie.rules;
import com.janetfilter.core.commons.DebugInfo;
import com.novitechie.LogUtil;
import java.util.ArrayList;
import java.util.List;
/**
* @author YeloChick
*/
public class ClassRule {
private static final List<String> PREVENT_LOAD_METHOD = new ArrayList<String>() {
{
add("findBootstrapClass");
}
};
public static void checkMethod(String name) throws Exception {
if (PREVENT_LOAD_METHOD.stream().anyMatch(name::equals)) {
DebugInfo.output("======================LoadMethod: " + name);
LogUtil.printStackTrace();
throw new NoSuchMethodException();
}
}
}

View File

@ -20,7 +20,7 @@ public class IdeaPluginRule {
public static boolean check(String name) {
if (checkHidePlugin(name)) {
DebugInfo.output("======================LoadPlugin: " + name);
DebugInfo.output("======================Hide Plugin: " + name);
LogUtil.printStackTrace();
return true;
}

View File

@ -20,7 +20,7 @@ public class LoadClassRule {
public static void check(String name) throws Exception {
if (!checkIgnoreClass(name) && checkHidePackage(name)) {
DebugInfo.output("======================LoadClass: " + name);
DebugInfo.output("======================Hide Class: " + name);
LogUtil.printStackTrace();
throw new ClassNotFoundException(name);
}

View File

@ -23,7 +23,7 @@ public class ResourceRule {
public static boolean check(String name) {
if (!checkIgnoreResource(name) && checkHideResource(name) && StackTraceRule.check()) {
DebugInfo.output("======================LoadResource: " + name);
DebugInfo.output("======================Hide Resource: " + name);
LogUtil.printStackTrace();
return true;
}

View File

@ -23,7 +23,7 @@ public class SystemRule {
public static boolean checkEnv(String name) {
if (checkHideEnv(name) && StackTraceRule.check()) {
DebugInfo.output("======================LoadEnv: " + name);
DebugInfo.output("======================Hide Env: " + name);
LogUtil.printStackTrace();
return true;
}
@ -32,7 +32,7 @@ public class SystemRule {
public static boolean checkProperty(String name) {
if (checkHideProperty(name) && StackTraceRule.check()) {
DebugInfo.output("======================LoadProperty: " + name);
DebugInfo.output("======================Hide Property: " + name);
LogUtil.printStackTrace();
return true;
}

View File

@ -13,6 +13,7 @@ import java.nio.file.Path;
public class VMOptionsRule {
public static Path hook() {
DebugInfo.output("======================Hide VMOptions");
String tmpdir = System.getProperty("java.io.tmpdir");
File file = new File(tmpdir, "fake.vmoptions");
if (file.exists()) {