当前位置: 首页>>代码示例>>Java>>正文


Java Method类代码示例

本文整理汇总了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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:29,代码来源:HttpServletHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:21,代码来源:XXEHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:21,代码来源:ApplicationFilterHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:22,代码来源:JstlImportHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:23,代码来源:WebDAVCopyResourceHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:22,代码来源:ProcessBuilderHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:26,代码来源:JspCompilationContextHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:21,代码来源:DeserializationHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:29,代码来源:DiskFileItemHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:23,代码来源:FileInputStreamHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:23,代码来源:FileOutputStreamHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:21,代码来源:OgnlHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:30,代码来源:WeblogicJspBaseHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:17,代码来源:JettyServerHandleHook.java

示例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;
}
 
开发者ID:baidu,项目名称:openrasp,代码行数:17,代码来源:CommonHttpClientHook.java


注:本文中的org.objectweb.asm.commons.Method类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。