-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpwcracker.py
More file actions
51 lines (40 loc) · 1.41 KB
/
pwcracker.py
File metadata and controls
51 lines (40 loc) · 1.41 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
'''
This is my quick and dirty password cracker
By Keith
you can manually select the dict file by the arg following the program, if you do not use one rock you will be selected by default from:
/usr/share/wordlists/rockyou.txt
'''
import crypt, sys
fshadow = '/etc/shadow'
fdic = '/usr/share/wordlists/rockyou.txt'
cracked = {}
if len(sys.argv)==2:
if len(sys.argv[1])>1:
fdic = sys.argv[1]
print "Dictionary file = " + fdic
try:
with open(fshadow) as u:
users = u.readlines()
for user in users:
if "*" not in user and "!" not in user:
usersplit = user.split(":")
tmpuser = usersplit[0]
tmpsalt = usersplit[1][:27]
tmphash = usersplit[1]
with open(fdic) as d:
pwds = d.readlines()
for pwd in pwds:
if ( crypt.crypt(pwd[:-1],tmpsalt) == tmphash ):
#print("User: %s | Pass: %s" % (tmpuser,pwd))
cracked[tmpuser] = pwd[:-1]
break
print "User | Password"
print "---------------"
for user in cracked:
print user+" | "+cracked[user]
print("---------------")
print("%s passwords cracked" % len(cracked))
except:
print('[-] Error... "%s [/path/file.txt]"' % sys.argv[0] )
exit(-1)