Created
September 9, 2015 06:31
-
-
Save jsyeo/34c73c6d456e3ca83c1b to your computer and use it in GitHub Desktop.
Reflection with Method Param
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
public class Main { | |
public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { | |
// write your code here | |
Class a = A.class; | |
Method m = a.getMethod("vulnerableMethod", int.class); | |
m.invoke(null, 5); | |
} | |
} | |
class A { | |
public static void vulnerableMethod(int i) { | |
System.out.println("pwned with param " + i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it maybe in python?