Guest User

Untitled

a guest
Nov 23rd, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import Crypto.Random
  2. from Crypto.Cipher import DES
  3. import hashlib
  4. import struct
  5.  
  6. password = "passwordfile";
  7. salt = "\x0c\x9d\x4a\xe4\x1e\x83\x15\xfc";
  8. iteration_count = 5;
  9.  
  10. def decrypt(ciphertext):
  11. key = password + salt
  12. for i in range(iteration_count):
  13. key = hashlib.md5(key).digest()
  14. cipher = DES.new(key[:8], DES.MODE_CBC, IV=key[8:])
  15. output = cipher.decrypt(ciphertext)
  16. return output;
  17.  
  18. def parseOutput(out):
  19. username_len = struct.unpack(">h", out[0:2])[0];
  20. username = out[2:username_len+2];
  21. password_len = struct.unpack(">h", out[username_len+2:username_len+4])[0];
  22. password = out[username_len+4:username_len+password_len+4];
  23. return (username, password);
  24.  
  25. file = open("lastlogin", "rb");
  26. out = parseOutput(decrypt(file.read()));
  27. file.close();
  28. print "Username : ", out[0];
  29. print "Password : ", out[1];
Add Comment
Please, Sign In to add comment