Skip to content

Instantly share code, notes, and snippets.

@0xa
Created July 10, 2012 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xa/3086304 to your computer and use it in GitHub Desktop.
Save 0xa/3086304 to your computer and use it in GitHub Desktop.
Minecraft lastlogin decrypt
import Crypto.Random
from Crypto.Cipher import DES
import hashlib
import struct
password = "passwordfile";
salt = "\x0c\x9d\x4a\xe4\x1e\x83\x15\xfc";
iteration_count = 5;
def decrypt(ciphertext):
key = password + salt
for i in range(iteration_count):
key = hashlib.md5(key).digest()
cipher = DES.new(key[:8], DES.MODE_CBC, IV=key[8:])
output = cipher.decrypt(ciphertext)
return output;
def parseOutput(out):
username_len = struct.unpack(">h", out[0:2])[0];
username = out[2:username_len+2];
password_len = struct.unpack(">h", out[username_len+2:username_len+4])[0];
password = out[username_len+4:username_len+password_len+4];
return (username, password);
file = open("lastlogin", "rb");
out = parseOutput(decrypt(file.read()));
file.close();
print "Username : ", out[0];
print "Password : ", out[1];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment