igogiko

Minecraft lastlogin decrypter

May 15th, 2012
816
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. import java.io.*;
  2. import javax.crypto.*;
  3. import javax.crypto.spec.*;
  4. import java.util.*;
  5. import javax.swing.JOptionPane;
  6.  
  7. public class Lastlogin {
  8.     public static String user = "";
  9.     public static String pass = "";
  10.    
  11.     public static void main(String[] args) {
  12.         readUsername();
  13.         JOptionPane.showMessageDialog(null, "Username: " + user + "\nPassword: " + pass, "Lastlogin", JOptionPane.INFORMATION_MESSAGE);
  14.     }
  15.  
  16.     private static void readUsername() {
  17.         try {
  18.             File lastLogin = new File(System.getenv("APPDATA") + "\\.minecraft\\lastlogin");
  19.             Cipher cipher = getCipher(2, "passwordfile");
  20.             DataInputStream dis;
  21.            
  22.             if (cipher != null) dis = new DataInputStream(new CipherInputStream(new FileInputStream(lastLogin), cipher));
  23.             else dis = new DataInputStream(new FileInputStream(lastLogin));
  24.            
  25.             user = dis.readUTF();
  26.             pass = dis.readUTF();
  27.             dis.close();
  28.         } catch (Exception e) {
  29.             e.printStackTrace();
  30.         }
  31.     }
  32.      
  33.     private static Cipher getCipher(int mode, String password) throws Exception {
  34.         Random random = new Random(43287234L);
  35.         byte[] salt = new byte[8];
  36.         random.nextBytes(salt);
  37.         PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 5);
  38.        
  39.         SecretKey pbeKey = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec(password.toCharArray()));
  40.         Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
  41.         cipher.init(mode, pbeKey, pbeParamSpec);
  42.         return cipher;
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment