本文整理汇总了Java中org.objectweb.asm.commons.Method类的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于org.objectweb.asm.commons包,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
public MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("service") && desc.equals("(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadThis();
loadArg(0);
loadArg(1);
invokeStatic(Type.getType(ApplicationFilterHook.class),
new Method("checkRequest", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"));
}
@Override
protected void onMethodExit(int opcode) {
invokeStatic(Type.getType(HookHandler.class),
new Method("onServiceExit", "()V"));
super.onMethodExit(opcode);
}
};
}
return mv;
}
示例2: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("setValues") && desc.startsWith("(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;"
+ "Ljava/lang/String;)")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadArg(3);
invokeStatic(Type.getType(XXEHook.class),
new Method("checkXXE", "(Ljava/lang/String;)V"));
}
};
}
return mv;
}
示例3: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature,
String[] exceptions, MethodVisitor mv) {
if ("doFilter".equals(name)) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadThis();
loadArg(0);
loadArg(1);
invokeStatic(Type.getType(ApplicationFilterHook.class),
new Method("checkRequest",
"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"));
}
};
}
return mv;
}
示例4: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
public MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("targetUrl")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodExit(int opcode) {
if (opcode != Opcodes.ATHROW) {
mv.visitInsn(Opcodes.DUP);
invokeStatic(Type.getType(JstlImportHook.class),
new Method("checkJstlImport", "(Ljava/lang/String;)V"));
}
}
};
}
return mv;
}
示例5: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
public MethodVisitor hookMethod(int access, String name, String desc,
String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("copyResource") && desc.startsWith("(Ljavax/naming/directory/DirContext;Ljava/util/Hashtable;Ljava/lang/String;Ljava/lang/String;)Z")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadThis();
loadArg(2);
loadArg(3);
invokeStatic(Type.getType(WebDAVCopyResourceHook.class),
new Method("checkWebdavCopyResource", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V"));
}
};
}
return mv;
}
示例6: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
public MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("start") && desc.equals("()Ljava/lang/Process;")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadThis();
invokeVirtual(Type.getType("java/lang/ProcessBuilder"),
new Method("command", "()Ljava/util/List;"));
invokeStatic(Type.getType(ProcessBuilderHook.class),
new Method("checkCommand", "(Ljava/util/List;)V"));
}
};
}
return mv;
}
示例7: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
public MethodVisitor hookMethod(int access, String name, String desc,
String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("compile") && desc.startsWith("()V")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
invokeStatic(Type.getType(HookHandler.class),
new Method("preShieldHook", "()V"));
}
@Override
protected void onMethodExit(int i) {
invokeStatic(Type.getType(HookHandler.class),
new Method("postShieldHook", "()V"));
}
};
}
return mv;
}
示例8: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor) (String)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc,
String signature, String[] exceptions, MethodVisitor mv) {
if ("resolveClass".equals(name) && "(Ljava/io/ObjectStreamClass;)Ljava/lang/Class;".equals(desc)) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadArg(0);
invokeStatic(Type.getType(DeserializationHook.class),
new Method("checkDeserializationClass", "(Ljava/io/ObjectStreamClass;)V"));
}
};
}
return mv;
}
示例9: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor) (String)
*/
@Override
public MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("setHeaders")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodExit(int opcode) {
loadThis();
invokeInterface(Type.getType("org/apache/commons/fileupload/FileItem"),
new Method("getName", "()Ljava/lang/String;"));
loadThis();
invokeInterface(Type.getType("org/apache/commons/fileupload/FileItem"),
new Method("get", "()[B"));
invokeStatic(Type.getType(DiskFileItemHook.class),
new Method("checkFileUpload", "(Ljava/lang/String;[B)V"));
super.onMethodExit(opcode);
}
};
}
return mv;
}
示例10: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if ("<init>".equals(name) && "(Ljava/io/File;)V".equals(desc)) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
public void onMethodExit(int opcode) {
if (opcode == Opcodes.RETURN) {
loadArg(0);
invokeStatic(Type.getType(FileInputStreamHook.class),
new Method("checkReadFile", "(Ljava/io/File;)V"));
}
super.onMethodExit(opcode);
}
};
}
return mv;
}
示例11: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if ("<init>".equals(name) && "(Ljava/io/File;Z)V".equals(desc)) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
public void onMethodExit(int opcode) {
if (opcode == Opcodes.RETURN) {
loadArg(0);
invokeStatic(Type.getType(FileOutputStreamHook.class),
new Method("checkWriteFile", "(Ljava/io/File;)V"));
}
super.onMethodExit(opcode);
}
};
}
return mv;
}
示例12: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc,
String signature, String[] exceptions, MethodVisitor mv) {
if ("parseExpression".equals(name) && "(Ljava/lang/String;)Ljava/lang/Object;".equals(desc)) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadArg(0);
invokeStatic(Type.getType(OgnlHook.class),
new Method("checkOgnlExpression", "(Ljava/lang/String;)V"));
}
};
}
return mv;
}
示例13: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
/**
* (none-javadoc)
*
* @see com.fuxi.javaagent.hook.AbstractClassHook#hookMethod(int, String, String, String, String[], MethodVisitor)
*/
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature,
String[] exceptions, MethodVisitor mv) {
if (name.equals("service") && desc.equals("(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadThis();
loadArg(0);
loadArg(1);
invokeStatic(Type.getType(ApplicationFilterHook.class),
new Method("checkRequest", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"));
}
@Override
protected void onMethodExit(int opcode) {
invokeStatic(Type.getType(HookHandler.class),
new Method("onServiceExit", "()V"));
super.onMethodExit(opcode);
}
};
}
return mv;
}
示例14: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("handle")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadThis();
loadArg(2);
loadArg(3);
invokeStatic(Type.getType(ApplicationFilterHook.class),
new Method("checkRequest", "(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"));
}
};
}
return mv;
}
示例15: hookMethod
import org.objectweb.asm.commons.Method; //导入依赖的package包/类
@Override
protected MethodVisitor hookMethod(int access, String name, String desc, String signature, String[] exceptions, MethodVisitor mv) {
if (name.equals("executeMethod") && desc.equals("(Lorg/apache/commons/httpclient/HostConfiguration;" +
"Lorg/apache/commons/httpclient/HttpMethod;" +
"Lorg/apache/commons/httpclient/HttpState;)I")) {
return new AdviceAdapter(Opcodes.ASM5, mv, access, name, desc) {
@Override
protected void onMethodEnter() {
loadArg(1);
invokeStatic(Type.getType(CommonHttpClientHook.class),
new Method("checkHttpConnection", "(Ljava/lang/Object;)V"));
}
};
}
return mv;
}