@@ -55,16 +55,16 @@ def bruteforce(hashed_password, hash_type, bruteforce_range, hashlist=False):
5555 print (f'{ hashed_password } doesn\' t exist' )
5656 exit ()
5757
58- t0 = time ()
5958 try :
6059 for h in hashes :
60+ t0 = time ()
61+ print (f'[?] Attempting to crack: { h } ' )
6162 while True :
6263 #generate random string based on bruteforce range and chars
6364 pw = '' .join ([choice (chars ) for i in range (choice (bruteforce_range ))])
64- print (pw )
6565 if h == hash_password (pw , hash_type ):
6666 t1 = time ()
67- print (f'password is: { pw } \n password was found in: { t1 - t0 } seconds' )
67+ print (f'[~] password is: { pw } [~] password was found in: { t1 - t0 } seconds' )
6868 if not hashlist :
6969 #save the password in a text file then exit
7070 with open ('result.txt' , 'w' ) as res :
@@ -103,35 +103,40 @@ def crack_hash(hash_type=None, hashed_password=None, password_list=None, hashlis
103103 hashes = h_list .readlines ()
104104 hashes = [i .replace ('\n ' , '' ) for i in hashes ]
105105 except FileNotFoundError :
106- print (f'{ password_list } or $ { hashed_password } doesn\' t exist' )
106+ print (f'{ password_list } or { hashed_password } doesn\' t exist' )
107107 exit ()
108108
109109 #loop through all passwords and compare the hashed versions of them with the
110110 #hashed password
111- t0 = time ()
112111 try :
113112 #check if a hash list is being used
114113 if not hashlist :
114+ t0 = time ()
115+ print (f'[?] Attempting to crack: { hashed_password } ' )
115116 for pw in passwords :
116- print (pw .replace ('\n ' , '' ))
117117 if hashed_password == hash_password (pw .replace ('\n ' , '' ), hash_type ):
118118 t1 = time ()
119- print (f'password is: { pw } \n password was found in: { t1 - t0 } seconds' )
119+ print (f'[~] password is: { pw } [~] password was found in: { t1 - t0 } seconds' )
120120 #save the password in a text file then exit
121121 with open ('result.txt' , 'w' ) as res :
122122 res .write (pw )
123123 exit ()
124+ print (f'[!] Failed to crack { hashed_password } with { password_list } \n ' )
124125 else :
125126 for h in hashes :
127+ t0 , result = time (), False
128+ print (f'[?] Attempting to crack: { h } ' )
126129 for pw in passwords :
127- print (pw .replace ('\n ' , '' ))
128130 if h == hash_password (pw .replace ('\n ' , '' ), hash_type ):
129- t1 = time ()
130- print (f'password is: { pw } \n password was found in: { t1 - t0 } seconds' )
131+ t1 , result = time (), True
132+ print (f'[~] password is: { pw } [~] password was found in: { t1 - t0 } seconds\n ' )
131133 #save the password in a text file then move onto the next hash
132134 with open ('result.txt' , 'a' ) as res :
133135 res .write (pw + '\n ' )
134136 break
137+ #print fail message if hash is not found
138+ if not result :
139+ print (f'[!] Failed to crack { h } with { password_list } \n ' )
135140 except KeyboardInterrupt :
136141 t1 = time ()
137142 print (f'Password could not be found, tried for: { t1 - t0 } seconds' )
0 commit comments