feat: hook ClassLoader, Class, RuntimeMXBean, System, PluginManagerCore

This commit is contained in:
2025-06-23 10:26:07 +08:00
parent 3388fad6fc
commit 6da7112443
17 changed files with 493 additions and 38 deletions

View File

@@ -0,0 +1,29 @@
package com.novitechie.rules;
import com.janetfilter.core.commons.DebugInfo;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Path;
/**
* @author YeloChick
*/
public class VMOptionsRule {
public static Path hook() {
String tmpdir = System.getProperty("java.io.tmpdir");
File file = new File(tmpdir, "fake.vmoptions");
if (file.exists()) {
return file.toPath();
}
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write("# This file is created by plugin-privacy".getBytes());
return file.toPath();
} catch (IOException e) {
DebugInfo.output("create temp file error", e);
return null;
}
}
}