好吧,所以我试图编写一个通用的字符串deobFuscator(类似于.NET与简单汇编探索器具有的内容)

我想做的是通过BCEL抓住方法的说明,并通过我提供的参数执行它们,并可以访问该方法的输出。这是否可以与任何现有库进行?如果是这样,我可以得到一些帮助吗?

谢谢

有帮助吗?

解决方案

BCEL和反射/调用的结合可以完成这项工作。使用bcel获取类和方法的名称(您的 LDC, invokestatic 技巧或类似的东西)并立即调用该方法。如果将“测试课”放在类路径上,则可以执行此操作。对我来说,无需执行字节代码。


如果您有课程和方法名称,则会像这样:

Class clazz = Class.forName(yourClassName);
// either (for public methods)
Method method = clazz.getMethod(yourMethodName);
// or for protected / private methods:
Method method = clazz.getDeclaredMethod(yourMethodName, yourArgumentTypes);
method.setAccessible(true); 

// assuming the method is static
Object result = method.invoke(null, yourMethodArgs);
// otherwise: pass a object reference instead of null
// to call the method "on" that object
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top