forked from nitin42/Python-Automation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject16.py
More file actions
30 lines (24 loc) · 756 Bytes
/
project16.py
File metadata and controls
30 lines (24 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# A UNIX password cracker
# The following script uses SHA-512 hashing algorithm
import crypt
def test_password(crypted_password):
salt = crypted_password[0:2]
file_obj = open('dictionary.txt','r')
for word in file_obj.readlines():
word = word.split('\n')
crypt_pass = crypt.crypt(word, salt)
if crypt_pass == crypted_password:
print('[+] Password found:' + word + '\n')
return
print('[-] Password not found')
return
def main():
file_obj = open('passwords.txt')
for word in file_obj.readlines():
if ":" in word:
user = word.split(':')[0]
crypt_word = word.split(':')[1].strip(' ') # strip off any white space
print('[*] Cracking the UNIX password:'+ user)
test_password(crypt_word)
if __name__ == '__main__':
main()