mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
28 lines
879 B
Java
28 lines
879 B
Java
import org.mozilla.javascript.Context;
|
|
import org.mozilla.javascript.Scriptable;
|
|
|
|
import javax.servlet.ServletException;
|
|
import javax.servlet.annotation.WebServlet;
|
|
import javax.servlet.http.HttpServlet;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.io.IOException;
|
|
|
|
/**
|
|
* @author ReaJason
|
|
* @since 2025/1/30
|
|
*/
|
|
@WebServlet("/rhino")
|
|
public class RhinoServlet extends HttpServlet {
|
|
|
|
@Override
|
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
String data = req.getParameter("data");
|
|
try (Context cx = Context.enter()) {
|
|
Scriptable scope = cx.initStandardObjects();
|
|
Object result = cx.evaluateString(scope, data, null, 1, null);
|
|
resp.getWriter().print(Context.toString(result));
|
|
}
|
|
}
|
|
}
|