Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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];
Add Comment
Please, Sign In to add comment