feat: support rhino and jinjava packer

This commit is contained in:
ReaJason
2025-01-30 17:24:14 +08:00
parent dad1f83365
commit 1f94ca41f6
17 changed files with 164 additions and 18 deletions
@@ -0,0 +1,25 @@
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
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 2025/1/30
*/
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));
}
}
}