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));
|
||||
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);
|
||||
|
@ -16,12 +16,21 @@ 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) {
|
||||
DebugInfo.output("======================LoadClass: " + name);
|
||||
LogUtil.printStackTrace();
|
||||
throw new ClassNotFoundException(name);
|
||||
boolean f2 = IGNORE_CLASS.stream().anyMatch(name::equals);
|
||||
if (!f2) {
|
||||
DebugInfo.output("======================LoadClass: " + name);
|
||||
LogUtil.printStackTrace();
|
||||
throw new ClassNotFoundException(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,18 +13,27 @@ 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) {
|
||||
if (StackTraceRule.check()) {
|
||||
DebugInfo.output("======================LoadResource: " + name);
|
||||
LogUtil.printStackTrace();
|
||||
return true;
|
||||
boolean f1 = IGNORE_RESOURCE.stream().anyMatch(name::equals);
|
||||
if (!f1) {
|
||||
if (StackTraceRule.check()) {
|
||||
DebugInfo.output("======================LoadResource: " + name);
|
||||
LogUtil.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user