Share Pastebin
Guest
Public paste!

caiobm

By: a guest | Jan 23rd, 2009 | Syntax: Java | Size: 0.71 KB | Hits: 53 | Expires: Never
Copy text to clipboard
  1. import java.net.*;
  2. import java.io.*;
  3.  
  4. public class ShutListener {
  5.        
  6.         public static void main(String[] args) throws Exception {
  7.                 ServerSocket ss = new ServerSocket(10001);
  8.                
  9.                 Socket so = ss.accept();
  10.                
  11.                
  12.                 BufferedReader in = new BufferedReader(new
  13.                 InputStreamReader(so.getInputStream()));
  14.        
  15.  
  16.                 while (!in.ready());
  17.        
  18.                 String str = in.readLine(); // Read one line and output it
  19.                 String param = in.readLine();
  20.  
  21.                
  22.                 if(str.compareTo("fgt") == 0) { //A senha é fgt
  23.                         try {
  24.                                 Runtime.getRuntime().exec("c:\\WINDOWS\\system32\\shutdown " + param);
  25.  
  26.                         } catch(Exception e) {
  27.                                 e.printStackTrace();   
  28.                           }
  29.                        
  30.                 }      
  31.                
  32.                 so.close();
  33.                 System.exit(0);
  34.         }
  35. }