feat: support rainbow v2025.3.2
This commit is contained in:
parent
cca89ed597
commit
7a9f82629c
@ -28,7 +28,7 @@ public class RuntimeMXBeanTransformer implements MyTransformer {
|
|||||||
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/StackTraceRule", "check", "()Z", false));
|
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/rules/StackTraceRule", "check", "()Z", false));
|
||||||
LabelNode labelNode = new LabelNode();
|
LabelNode labelNode = new LabelNode();
|
||||||
list.add(new JumpInsnNode(IFEQ, 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 MethodInsnNode(INVOKESTATIC, "java/util/Collections", "singletonList", "(Ljava/lang/Object;)Ljava/util/List;", false));
|
||||||
list.add(new InsnNode(ARETURN));
|
list.add(new InsnNode(ARETURN));
|
||||||
list.add(labelNode);
|
list.add(labelNode);
|
||||||
|
@ -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 {
|
public static void check(String name) throws Exception {
|
||||||
boolean f = PREVENT_LOAD_PACKAGES.stream().anyMatch(name::startsWith);
|
boolean f = PREVENT_LOAD_PACKAGES.stream().anyMatch(name::startsWith);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
boolean f2 = IGNORE_CLASS.stream().anyMatch(name::equals);
|
||||||
|
if (!f2) {
|
||||||
DebugInfo.output("======================LoadClass: " + name);
|
DebugInfo.output("======================LoadClass: " + name);
|
||||||
LogUtil.printStackTrace();
|
LogUtil.printStackTrace();
|
||||||
throw new ClassNotFoundException(name);
|
throw new ClassNotFoundException(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,20 +13,29 @@ public class ResourceRule {
|
|||||||
|
|
||||||
private static final List<String> PREVENT_LOAD_RESOURCE = new ArrayList<String>() {
|
private static final List<String> PREVENT_LOAD_RESOURCE = new ArrayList<String>() {
|
||||||
{
|
{
|
||||||
// add("/6c81ec87e55d331c267262e892427a3d93d76683.txt");
|
add("/6c81ec87e55d331c267262e892427a3d93d76683.txt");
|
||||||
add("/com/janetfilter");
|
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) {
|
public static boolean check(String name) {
|
||||||
boolean f = PREVENT_LOAD_RESOURCE.stream().anyMatch(name::startsWith);
|
boolean f = PREVENT_LOAD_RESOURCE.stream().anyMatch(name::startsWith);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
boolean f1 = IGNORE_RESOURCE.stream().anyMatch(name::equals);
|
||||||
|
if (!f1) {
|
||||||
if (StackTraceRule.check()) {
|
if (StackTraceRule.check()) {
|
||||||
DebugInfo.output("======================LoadResource: " + name);
|
DebugInfo.output("======================LoadResource: " + name);
|
||||||
LogUtil.printStackTrace();
|
LogUtil.printStackTrace();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user