feat: support rainbow v2025.3.3
This commit is contained in:
		
							
								
								
									
										44
									
								
								privacy.conf.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								privacy.conf.example
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					[Hide_Plugin]
 | 
				
			||||||
 | 
					EQUAL,io.zhile.research.ide-eval-resetter
 | 
				
			||||||
 | 
					EQUAL,Nasller.License
 | 
				
			||||||
 | 
					EQUAL,nasller
 | 
				
			||||||
 | 
					EQUAL,manifold.ij
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Hide_Package]
 | 
				
			||||||
 | 
					PREFIX,com.janetfilter
 | 
				
			||||||
 | 
					PREFIX,jdk.internal.org.objectweb.asm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Hide_Resource]
 | 
				
			||||||
 | 
					EQUAL,/6c81ec87e55d331c267262e892427a3d93d76683.txt
 | 
				
			||||||
 | 
					PREFIX,/com/janetfilter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Hide_Env]
 | 
				
			||||||
 | 
					EQUAL,IDEA_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,CLION_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,PHPSTORM_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,GOLAND_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,PYCHARM_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,WEBSTORM_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,WEBIDE_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,RIDER_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,DATAGRIP_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,RUBYMINE_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,APPCODE_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,DATASPELL_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,GATEWAY_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,JETBRAINS_CLIENT_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,JETBRAINSCLIENT_VM_OPTIONS
 | 
				
			||||||
 | 
					EQUAL,JANF_DEBUG
 | 
				
			||||||
 | 
					EQUAL,JANF_OUTPUT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Hide_Property]
 | 
				
			||||||
 | 
					EQUAL,janf.debug
 | 
				
			||||||
 | 
					EQUAL,janf.output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Ignore_Class]
 | 
				
			||||||
 | 
					EQUAL,com.janetfilter.core.utils.StringUtils
 | 
				
			||||||
 | 
					EQUAL,com.janetfilter.core.utils.DateUtils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[Ignore_Resource]
 | 
				
			||||||
 | 
					EQUAL,/com/janetfilter/core/utils/StringUtils.class
 | 
				
			||||||
 | 
					EQUAL,/com/janetfilter/core/utils/DateUtils.class
 | 
				
			||||||
@@ -1,12 +1,27 @@
 | 
				
			|||||||
package com.novitechie;
 | 
					package com.novitechie;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.janetfilter.core.Environment;
 | 
				
			||||||
import com.janetfilter.core.plugin.MyTransformer;
 | 
					import com.janetfilter.core.plugin.MyTransformer;
 | 
				
			||||||
 | 
					import com.janetfilter.core.plugin.PluginConfig;
 | 
				
			||||||
import com.janetfilter.core.plugin.PluginEntry;
 | 
					import com.janetfilter.core.plugin.PluginEntry;
 | 
				
			||||||
 | 
					import com.novitechie.rules.IdeaPluginRule;
 | 
				
			||||||
 | 
					import com.novitechie.rules.LoadClassRule;
 | 
				
			||||||
 | 
					import com.novitechie.rules.ResourceRule;
 | 
				
			||||||
 | 
					import com.novitechie.rules.SystemRule;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Arrays;
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class PrivacyPlugin implements PluginEntry {
 | 
					public class PrivacyPlugin implements PluginEntry {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public void init(Environment environment, PluginConfig config) {
 | 
				
			||||||
 | 
					        IdeaPluginRule.initRules(config.getBySection("Hide_Plugin"));
 | 
				
			||||||
 | 
					        LoadClassRule.initRules(config.getBySection("Hide_Package"), config.getBySection("Ignore_Class"));
 | 
				
			||||||
 | 
					        ResourceRule.initRules(config.getBySection("Hide_Resource"), config.getBySection("Ignore_Resource"));
 | 
				
			||||||
 | 
					        SystemRule.initRules(config.getBySection("Hide_Env"), config.getBySection("Hide_Property"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public String getName() {
 | 
					    public String getName() {
 | 
				
			||||||
        return "PRIVACY";
 | 
					        return "PRIVACY";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,10 @@
 | 
				
			|||||||
package com.novitechie.rules;
 | 
					package com.novitechie.rules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.janetfilter.core.commons.DebugInfo;
 | 
					import com.janetfilter.core.commons.DebugInfo;
 | 
				
			||||||
 | 
					import com.janetfilter.core.models.FilterRule;
 | 
				
			||||||
import com.novitechie.LogUtil;
 | 
					import com.novitechie.LogUtil;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -11,21 +12,22 @@ import java.util.List;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public class IdeaPluginRule {
 | 
					public class IdeaPluginRule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> PREVENT_LOAD_PLUGINS = new ArrayList<String>() {
 | 
					    private static List<FilterRule> hidePluginRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					
 | 
				
			||||||
            add("io.zhile.research.ide-eval-resetter");
 | 
					    public static void initRules(List<FilterRule> hidePluginRules) {
 | 
				
			||||||
            add("Nasller.License");
 | 
					        IdeaPluginRule.hidePluginRules = hidePluginRules;
 | 
				
			||||||
            add("nasller");
 | 
					    }
 | 
				
			||||||
            add("manifold.ij");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static boolean check(String name) {
 | 
					    public static boolean check(String name) {
 | 
				
			||||||
        boolean f = PREVENT_LOAD_PLUGINS.stream().anyMatch(name::equals);
 | 
					        if (checkHidePlugin(name)) {
 | 
				
			||||||
        if (f) {
 | 
					 | 
				
			||||||
            DebugInfo.output("======================LoadPlugin: " + name);
 | 
					            DebugInfo.output("======================LoadPlugin: " + name);
 | 
				
			||||||
            LogUtil.printStackTrace();
 | 
					            LogUtil.printStackTrace();
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return f;
 | 
					        return false;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkHidePlugin(String name) {
 | 
				
			||||||
 | 
					        return hidePluginRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,37 +1,37 @@
 | 
				
			|||||||
package com.novitechie.rules;
 | 
					package com.novitechie.rules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.janetfilter.core.commons.DebugInfo;
 | 
					import com.janetfilter.core.commons.DebugInfo;
 | 
				
			||||||
 | 
					import com.janetfilter.core.models.FilterRule;
 | 
				
			||||||
import com.novitechie.LogUtil;
 | 
					import com.novitechie.LogUtil;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class LoadClassRule {
 | 
					public class LoadClassRule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> PREVENT_LOAD_PACKAGES = new ArrayList<String>() {
 | 
					    private static List<FilterRule> hidePackageRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            // add("com.novitechie");
 | 
					 | 
				
			||||||
            add("com.janetfilter");
 | 
					 | 
				
			||||||
            add("jdk.internal.org.objectweb.asm");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> IGNORE_CLASS = new ArrayList<String>() {
 | 
					    private static List<FilterRule> ignoreClassRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					
 | 
				
			||||||
            add("com.janetfilter.core.utils.StringUtils");
 | 
					    public static void initRules(List<FilterRule> hidePackageRules, List<FilterRule> ignoreClassRules) {
 | 
				
			||||||
        }
 | 
					        LoadClassRule.hidePackageRules = hidePackageRules;
 | 
				
			||||||
    };
 | 
					        LoadClassRule.ignoreClassRules = ignoreClassRules;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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);
 | 
					        if (!checkIgnoreClass(name) && checkHidePackage(name)) {
 | 
				
			||||||
        if (f) {
 | 
					            DebugInfo.output("======================LoadClass: " + name);
 | 
				
			||||||
            boolean f2 = IGNORE_CLASS.stream().anyMatch(name::equals);
 | 
					            LogUtil.printStackTrace();
 | 
				
			||||||
            if (!f2) {
 | 
					            throw new ClassNotFoundException(name);
 | 
				
			||||||
                DebugInfo.output("======================LoadClass: " + name);
 | 
					 | 
				
			||||||
                LogUtil.printStackTrace();
 | 
					 | 
				
			||||||
                throw new ClassNotFoundException(name);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkHidePackage(String name) {
 | 
				
			||||||
 | 
					        return hidePackageRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkIgnoreClass(String name) {
 | 
				
			||||||
 | 
					        return ignoreClassRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,10 @@
 | 
				
			|||||||
package com.novitechie.rules;
 | 
					package com.novitechie.rules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.janetfilter.core.commons.DebugInfo;
 | 
					import com.janetfilter.core.commons.DebugInfo;
 | 
				
			||||||
 | 
					import com.janetfilter.core.models.FilterRule;
 | 
				
			||||||
import com.novitechie.LogUtil;
 | 
					import com.novitechie.LogUtil;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -11,31 +12,29 @@ import java.util.List;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public class ResourceRule {
 | 
					public class ResourceRule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> PREVENT_LOAD_RESOURCE = new ArrayList<String>() {
 | 
					    private static List<FilterRule> hideResourceRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            add("/6c81ec87e55d331c267262e892427a3d93d76683.txt");
 | 
					 | 
				
			||||||
            add("/com/janetfilter");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> IGNORE_RESOURCE = new ArrayList<String>() {
 | 
					    private static List<FilterRule> ignoreResourceRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					
 | 
				
			||||||
            add("/com/janetfilter/core/utils/StringUtils.class");
 | 
					    public static void initRules(List<FilterRule> hideResourceRules, List<FilterRule> ignoreResourceRules) {
 | 
				
			||||||
        }
 | 
					        ResourceRule.hideResourceRules = hideResourceRules;
 | 
				
			||||||
    };
 | 
					        ResourceRule.ignoreResourceRules = ignoreResourceRules;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static boolean check(String name) {
 | 
					    public static boolean check(String name) {
 | 
				
			||||||
        boolean f = PREVENT_LOAD_RESOURCE.stream().anyMatch(name::startsWith);
 | 
					        if (!checkIgnoreResource(name) && checkHideResource(name) && StackTraceRule.check()) {
 | 
				
			||||||
        if (f) {
 | 
					            DebugInfo.output("======================LoadResource: " + name);
 | 
				
			||||||
            boolean f1 = IGNORE_RESOURCE.stream().anyMatch(name::equals);
 | 
					            LogUtil.printStackTrace();
 | 
				
			||||||
            if (!f1) {
 | 
					            return true;
 | 
				
			||||||
                if (StackTraceRule.check()) {
 | 
					 | 
				
			||||||
                    DebugInfo.output("======================LoadResource: " + name);
 | 
					 | 
				
			||||||
                    LogUtil.printStackTrace();
 | 
					 | 
				
			||||||
                    return true;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkHideResource(String name) {
 | 
				
			||||||
 | 
					        return hideResourceRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkIgnoreResource(String name) {
 | 
				
			||||||
 | 
					        return ignoreResourceRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,10 @@
 | 
				
			|||||||
package com.novitechie.rules;
 | 
					package com.novitechie.rules;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.janetfilter.core.commons.DebugInfo;
 | 
					import com.janetfilter.core.commons.DebugInfo;
 | 
				
			||||||
 | 
					import com.janetfilter.core.models.FilterRule;
 | 
				
			||||||
import com.novitechie.LogUtil;
 | 
					import com.novitechie.LogUtil;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -11,56 +12,38 @@ import java.util.List;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
public class SystemRule {
 | 
					public class SystemRule {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> PREVENT_LOAD_ENV = new ArrayList<String>() {
 | 
					    private static List<FilterRule> hideEnvRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            add("IDEA_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("CLION_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("PHPSTORM_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("GOLAND_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("PYCHARM_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("WEBSTORM_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("WEBIDE_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("RIDER_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("DATAGRIP_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("RUBYMINE_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("APPCODE_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("DATASPELL_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("GATEWAY_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("JETBRAINS_CLIENT_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("JETBRAINSCLIENT_VM_OPTIONS");
 | 
					 | 
				
			||||||
            add("JANF_DEBUG");
 | 
					 | 
				
			||||||
            add("JANF_OUTPUT");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private static final List<String> PREVENT_LOAD_PROPERTY = new ArrayList<String>() {
 | 
					    private static List<FilterRule> hidePropertyRules = Collections.emptyList();
 | 
				
			||||||
        {
 | 
					
 | 
				
			||||||
            add("janf.debug");
 | 
					    public static void initRules(List<FilterRule> hideEnvRules, List<FilterRule> hidePropertyRules) {
 | 
				
			||||||
            add("janf.output");
 | 
					        SystemRule.hideEnvRules = hideEnvRules;
 | 
				
			||||||
        }
 | 
					        SystemRule.hidePropertyRules = hidePropertyRules;
 | 
				
			||||||
    };
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static boolean checkEnv(String name) {
 | 
					    public static boolean checkEnv(String name) {
 | 
				
			||||||
        boolean f = PREVENT_LOAD_ENV.stream().anyMatch(name::equals);
 | 
					        if (checkHideEnv(name) && StackTraceRule.check()) {
 | 
				
			||||||
        if (f) {
 | 
					            DebugInfo.output("======================LoadEnv: " + name);
 | 
				
			||||||
            if (StackTraceRule.check()) {
 | 
					            LogUtil.printStackTrace();
 | 
				
			||||||
                DebugInfo.output("======================LoadEnv: " + name);
 | 
					            return true;
 | 
				
			||||||
                LogUtil.printStackTrace();
 | 
					 | 
				
			||||||
                return true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static boolean checkProperty(String name) {
 | 
					    public static boolean checkProperty(String name) {
 | 
				
			||||||
        boolean f = PREVENT_LOAD_PROPERTY.stream().anyMatch(name::equals);
 | 
					        if (checkHideProperty(name) && StackTraceRule.check()) {
 | 
				
			||||||
        if (f) {
 | 
					            DebugInfo.output("======================LoadProperty: " + name);
 | 
				
			||||||
            if (StackTraceRule.check()) {
 | 
					            LogUtil.printStackTrace();
 | 
				
			||||||
                DebugInfo.output("======================LoadProperty: " + name);
 | 
					            return true;
 | 
				
			||||||
                LogUtil.printStackTrace();
 | 
					 | 
				
			||||||
                return true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return false;
 | 
					        return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkHideEnv(String name) {
 | 
				
			||||||
 | 
					        return hideEnvRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static boolean checkHideProperty(String name) {
 | 
				
			||||||
 | 
					        return hidePropertyRules.stream().anyMatch(rule -> rule.test(name));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user