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

@@ -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);
}
}
}

View File

@@ -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;