-
Notifications
You must be signed in to change notification settings - Fork 0
/
customerParse.py
31 lines (27 loc) · 991 Bytes
/
customerParse.py
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
import sys
if len(sys.argv)<2:
sys.exit("Error: Must specify file to sort\n")
#open files
CustAll = open(sys.argv[1], 'r')
PassList = open('CustomerPasswordHashes.txt', 'w')
#parse customer csv for username and passHash
for line in CustAll:
#create dictionary from line
parseThis=line.split(',')
if parseThis[0].find('@')>=0:#checks is first element is email address
parsed={'username':'','passhash':'','salt':''}
parsed['username']=parseThis[0]
hashSalt=parseThis[14]#hash:salt
if hashSalt=='':
parsed['passhash']='go look this up'#might have the wrong index
else:
splitUp=hashSalt.split(':')
parsed['passhash']=splitUp[0]
parsed['salt']=splitUp[1]
#create string with username, passHash and salt formatted for john the ripper
writeThis=parsed['username']+':$dynamic_61$'+parsed['passhash']+'$'+parsed['salt']#dynamic_1017=md5(s.p); dynamic_61=sha256(s.p)
#write string to file
PassList.write(writeThis+'\n')
#close files
CustAll.close
PassList.close