-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdehashedparse.py
More file actions
85 lines (80 loc) · 3.07 KB
/
dehashedparse.py
File metadata and controls
85 lines (80 loc) · 3.07 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import argparse
import json
# add arguments
parser = argparse.ArgumentParser(description='Sift through dehashed json and output email, password, or both.')
parser.add_argument('-e', '--email', help='Output just emails.', action='store_true')
parser.add_argument('-p', '--passwd', help='Output just passwords.', action='store_true')
parser.add_argument('-c', '--creds', help='Output both as email:password', action='store_true')
parser.add_argument('-o', '--output', help='Output the output to a file.')
parser.add_argument(help='JSON file to parse.', dest='filename', type=argparse.FileType('r'))
args = parser.parse_args()
if args.email:
#do email things
with args.filename as json_file:
data = json.load(json_file)
elist = []
for entry in data['entries']:
emails = entry['email']
if args.output:
with open(args.output, 'a') as output_file:
if emails.lower() not in elist:
elist.append(emails.lower())
output_file.write(emails.lower() + "\n")
else:
continue
else:
if emails.lower() not in elist:
elist.append(emails.lower())
print(emails.lower())
else:
continue
elif args.passwd:
#do password things
with args.filename as json_file:
data = json.load(json_file)
plist = []
for entry in data['entries']:
passwords = entry['password']
if passwords == "":
continue
else:
if args.output:
with open(args.output, 'a') as output_file:
if passwords not in plist:
plist.append(passwords)
output_file.write(passwords + "\n")
else:
continue
else:
if passwords not in plist:
plist.append(passwords)
print(passwords)
else:
continue
elif args.creds:
#do creds things
with args.filename as json_file:
data = json.load(json_file)
clist = []
for entry in data['entries']:
emails = entry['email']
passwords = entry['password']
if passwords == "":
continue
else:
creds = emails.lower() + ":" + passwords
if args.output:
with open(args.output, 'a') as output_file:
if creds not in clist:
clist.append(creds)
output_file.write(creds + "\n")
else:
continue
else:
if creds not in clist:
clist.append(creds)
print(creds)
else:
continue
else:
args.print_help()