Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. # dict_crack.py
  2. # Cracks a password has using a dictionary of common passwords.
  3. # Author: Euan McCall
  4. # November 2015
  5. # Last tested: November 28th 2015
  6. # Functional? NO
  7.  
  8.  
  9. import hashlib
  10.  
  11. passwd_hash = '4297f44b13955235245b2497399d7a93'
  12.  
  13. # user input type
  14. # passwd_hash = raw_input();
  15.  
  16. # set up list of common passwords
  17. dic = ['123','1234','12345','123456','1234567','12345678','password','qwerty','abc','abcd','abc123','111111','monkey','arsenal','letmein','trustno1','dragon','baseball','superman','iloveyou','starwars','montypython','cheese','123123','football','password','batman']
  18.  
  19. # Our dictionary attack subroutine, which does the checks and conversions.
  20. def dict_attack(password_hash):
  21. """ Checks pw hash, against a dictionary of common pw hashes. """
  22. # Calculate md5 from list of pws and compare with provided value passwd_hash
  23. passwd_found = False;
  24. print 'Finding matching hash for:', passwd_hash
  25.  
  26.  
  27.  
  28. # Iteration and conversion to md5
  29. for x in dic:
  30. #print "Checking Password: " +x;
  31. md5hash = hashlib.md5(x);
  32. #print "Hash: %s"% (md5hash.hexdigest())
  33.  
  34. # Conditional check for md5 (Doesn't work)
  35. if md5hash == passwd_hash:
  36. passwd_found = True;
  37. print "Hash found: %s"% (passwd_found) ;
  38. print passwd_hash;
  39. print x;
  40. else:
  41. passwd_found = False;
  42. print "No Match: %s"% (passwd_found);
  43.  
  44.  
  45. # Print respective message to user
  46. # if passwd_found == True:
  47. # print '[+] Pasword found: %s'% (passwd)
  48. #else:
  49. # print '[-] Password not found'
  50.  
  51.  
  52. def main():
  53. print '[dict_crack] Tests'
  54. dict_attack(passwd_hash)
  55.  
  56.  
  57.  
  58. if __name__=='__main__':
  59. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement