mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
29 lines
843 B
Java
29 lines
843 B
Java
import ognl.Ognl;
|
|
import ognl.OgnlContext;
|
|
import ognl.OgnlException;
|
|
|
|
import javax.servlet.ServletException;
|
|
import javax.servlet.http.HttpServlet;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.IOException;
|
|
|
|
/**
|
|
* @author ReaJason
|
|
* @since 2024/12/14
|
|
*/
|
|
public class OgnlServlet extends HttpServlet {
|
|
@Override
|
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
String data = req.getParameter("data");
|
|
OgnlContext context = new OgnlContext();
|
|
Object value = null;
|
|
try {
|
|
value = Ognl.getValue(data, context, context.getRoot());
|
|
} catch (OgnlException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
resp.getWriter().println(value);
|
|
}
|
|
}
|