當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。