fix for java8

Signed-off-by: pengzhile <pengzhile@gmail.com>
This commit is contained in:
pengzhile 2021-12-01 12:33:37 +08:00
parent 164b9147d0
commit a34a4318c1
2 changed files with 11 additions and 3 deletions

View File

@ -8,7 +8,6 @@ import io.zhile.research.ja.netfilter.plugin.PluginManager;
import java.io.File;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
public class Initializer {
public static void init(String args, Instrumentation inst, File currentDirectory) {
@ -30,10 +29,15 @@ public class Initializer {
inst.addTransformer(Dispatcher.getInstance(), true);
for (Class<?> c : inst.getAllLoadedClasses()) {
String name = c.getName();
if (name.startsWith("java.lang.invoke.LambdaForm$") || '[' == name.charAt(0)) {
continue;
}
try {
inst.retransformClasses(c);
} catch (UnmodifiableClassException e) {
// ok, ok. just ignore
} catch (Throwable e) {
DebugInfo.output("Retransform class failed: " + name);
}
}
}

View File

@ -9,6 +9,8 @@ import java.net.URL;
import java.util.jar.JarFile;
public class Launcher {
private static final String VERSION = "v1.1.3";
public static void main(String[] args) {
printUsage();
}
@ -39,6 +41,8 @@ public class Launcher {
private static void printUsage() {
String content = "\n ============================================================================ \n" +
"\n" +
" ja-netfilter-" + VERSION +
"\n\n" +
" A javaagent lib for network filter :)\n" +
"\n" +
" https://github.com/pengzhile/ja-netfilter\n" +