feat: support rainbow v2025.3.2

This commit is contained in:
yelochick 2025-07-31 21:50:41 +08:00
parent cca89ed597
commit 7a9f82629c
3 changed files with 27 additions and 9 deletions

View File

@ -28,7 +28,7 @@ public class RuntimeMXBeanTransformer implements MyTransformer {
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/StackTraceRule", "check", "()Z", false));
LabelNode labelNode = new LabelNode();
list.add(new JumpInsnNode(IFEQ, labelNode));
list.add(new LdcInsnNode(""));
list.add(new LdcInsnNode("sorry, you can not read anything. haha!"));
list.add(new MethodInsnNode(INVOKESTATIC, "java/util/Collections", "singletonList", "(Ljava/lang/Object;)Ljava/util/List;", false));
list.add(new InsnNode(ARETURN));
list.add(labelNode);

View File

@ -16,13 +16,22 @@ public class LoadClassRule {
}
};
private static final List<String> IGNORE_CLASS = new ArrayList<String>() {
{
add("com.janetfilter.core.utils.StringUtils");
}
};
public static void check(String name) throws Exception {
boolean f = PREVENT_LOAD_PACKAGES.stream().anyMatch(name::startsWith);
if (f) {
boolean f2 = IGNORE_CLASS.stream().anyMatch(name::equals);
if (!f2) {
DebugInfo.output("======================LoadClass: " + name);
LogUtil.printStackTrace();
throw new ClassNotFoundException(name);
}
}
}
}

View File

@ -13,20 +13,29 @@ public class ResourceRule {
private static final List<String> PREVENT_LOAD_RESOURCE = new ArrayList<String>() {
{
// add("/6c81ec87e55d331c267262e892427a3d93d76683.txt");
add("/6c81ec87e55d331c267262e892427a3d93d76683.txt");
add("/com/janetfilter");
}
};
private static final List<String> IGNORE_RESOURCE = new ArrayList<String>() {
{
add("/com/janetfilter/core/utils/StringUtils.class");
}
};
public static boolean check(String name) {
boolean f = PREVENT_LOAD_RESOURCE.stream().anyMatch(name::startsWith);
if (f) {
boolean f1 = IGNORE_RESOURCE.stream().anyMatch(name::equals);
if (!f1) {
if (StackTraceRule.check()) {
DebugInfo.output("======================LoadResource: " + name);
LogUtil.printStackTrace();
return true;
}
}
}
return false;
}
}