Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # dict_crack.py
- # Cracks a password has using a dictionary of common passwords.
- # Author: Euan McCall
- # November 2015
- # Last tested: November 28th 2015
- # Functional? NO
- import hashlib
- passwd_hash = '4297f44b13955235245b2497399d7a93'
- # user input type
- # passwd_hash = raw_input();
- # set up list of common passwords
- 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']
- # Our dictionary attack subroutine, which does the checks and conversions.
- def dict_attack(password_hash):
- """ Checks pw hash, against a dictionary of common pw hashes. """
- # Calculate md5 from list of pws and compare with provided value passwd_hash
- passwd_found = False;
- print 'Finding matching hash for:', passwd_hash
- # Iteration and conversion to md5
- for x in dic:
- #print "Checking Password: " +x;
- md5hash = hashlib.md5(x);
- #print "Hash: %s"% (md5hash.hexdigest())
- # Conditional check for md5 (Doesn't work)
- if md5hash == passwd_hash:
- passwd_found = True;
- print "Hash found: %s"% (passwd_found) ;
- print passwd_hash;
- print x;
- else:
- passwd_found = False;
- print "No Match: %s"% (passwd_found);
- # Print respective message to user
- # if passwd_found == True:
- # print '[+] Pasword found: %s'% (passwd)
- #else:
- # print '[-] Password not found'
- def main():
- print '[dict_crack] Tests'
- dict_attack(passwd_hash)
- if __name__=='__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement