本文整理汇总了Java中org.frustra.filament.Hooks类的典型用法代码示例。如果您正苦于以下问题:Java Hooks类的具体用法?Java Hooks怎么用?Java Hooks使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Hooks类属于org.frustra.filament包,在下文中一共展示了Hooks类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: complete
import org.frustra.filament.Hooks; //导入依赖的package包/类
public void complete(FilamentClassNode node, MethodNode m) {
// Loop through the bytecode instructions inside the main function
AbstractInsnNode insn = m.instructions.getFirst();
while (insn != null) {
// Look for any method call instructions
if (insn instanceof MethodInsnNode) {
MethodInsnNode insn2 = (MethodInsnNode) insn;
// Find the first method call pointing to within ExampleC
if (insn2.owner.equals(Type.getInternalName(ExampleC.class))) {
// Store the target method as ExampleC.printOne for the injector to use
Hooks.set("ExampleC.printOne", HookUtil.getMethodNode(insn2.owner, insn2.name, insn2.desc));
return;
}
}
insn = insn.getNext();
}
}
示例2: main
import org.frustra.filament.Hooks; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// Load the obfuscated examples package so we can modify the bytecode
loader.loadPackage("com.shopify.examples.obf");
// Load a hook to identify the printOne method for the injector
Hooks.load("com.shopify.examples.hooks");
// Register the injector we're going to be using on our example
Injectors.register("com.shopify.examples.injectors");
// Run the program with the modified bytecode
Class<?> cls = loader.loadClass(ExampleC.class.getName());
Method entryPoint = cls.getDeclaredMethod("main", new Class[] {String[].class});
entryPoint.invoke(null, new Object[] {args});
}
示例3: matches
import org.frustra.filament.Hooks; //导入依赖的package包/类
/**
* Check if this class matches a specified class hook.
*
* @param hook a class hook to compare
* @return <code>true</code> if the classes have the same name and package
* @throws BadHookException if the specified hook is undefined or is the wrong type
* @see Hooks
*/
public boolean matches(String hook) throws BadHookException {
FilamentClassNode node = Hooks.getClass(hook);
return this.equals(node);
}