File tree 1 file changed +45
-0
lines changed
EthicalHackingScripts/password-cracker
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ import hashlib
2
+ print ("**************PASSWORD CRACKER ******************" )
3
+
4
+ # To check if the password
5
+ # found or not.
6
+ pass_found = 0
7
+
8
+ input_hash = input ("Enter the hashed password:" )
9
+
10
+ pass_doc = input ("\n Enter passwords filename including path(root / home/):" )
11
+
12
+ try :
13
+ # trying to open the password file.
14
+ pass_file = open (pass_doc , 'r' )
15
+ except :
16
+ print ("Error:" )
17
+ print (pass_doc , "is not found.\n Please give the path of file correctly." )
18
+ quit ()
19
+
20
+
21
+ # comparing the input_hash with the hashes
22
+ # of the words in password file,
23
+ # and finding password.
24
+
25
+ for word in pass_file :
26
+ # encoding the word into utf-8 format
27
+ enc_word = word .encode ('utf-8' )
28
+
29
+ # Hashing a word into md5 hash
30
+ hash_word = hashlib .md5 (enc_word .strip ())
31
+
32
+ # digesting that hash into a hexa decimal value
33
+ digest = hash_word .hexdigest ()
34
+
35
+ if digest == input_hash :
36
+ # comparing hashes
37
+ print ("Password found.\n The password is:" , word )
38
+ pass_found = 1
39
+ break
40
+
41
+ # if password is not found.
42
+ if not pass_found :
43
+ print ("Password is not found in the" , pass_doc , "file" )
44
+ print ('\n ' )
45
+ print ("***************** Thank you **********************" )
You can’t perform that action at this time.
0 commit comments