-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathadobe-grepper.py
105 lines (87 loc) · 2.67 KB
/
adobe-grepper.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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/bin/python
import argparse
import sys
import os.path
import subprocess
import re
parser = argparse.ArgumentParser(description="Grep out info from the adobe creds file")
parser.add_argument("term", help="Search term")
parser.add_argument("creds", help="Adobe creds file")
args = parser.parse_args()
if not args.creds:
parser.print_usage()
sys.exit(2)
def parseline(line):
# 103238704-|--|[email protected]|-r4Vp5iL2VbM=-|-maiden name|--
m = re.findall( '(([^\|]+)\|)', line )
rtn = {}
rtn['email'] = parsevalue(m[2][1])
rtn['pass'] = parsevalue(m[3][1])
rtn['hint'] = ''
for i in range(4,len(m)):
rtn['hint'] += parsevalue(m[i][1])+" "
return rtn
def parsevalue(val):
return re.sub('^-|-$','',val)
emaillist = []
print( 'Searching for '+args.term+' in '+args.creds+'...' )
sys.stdout.flush()
# First pass - get instances of term
result = subprocess.check_output( 'grep "' + args.term + '" ' + args.creds, shell=True )
print( 'Found ' + str(len(result.strip().split('\n'))) + ' results in search' )
print( result )
sys.stdout.flush()
for line in result.split('\n'):
line = line.strip()
if line == '':
continue
emaillist.append(parseline(line))
# Get unique list of passwords
passwords = {}
for info in emaillist:
if not info['pass'] in passwords:
if( info['pass'] != '' ):
passwords[info['pass']] = []
print( 'Searching for shared passwords...' )
sys.stdout.flush()
# Iterate over passwords, finding all other people who have that password
for password in passwords.keys():
if password == 'password':
continue
print( 'Searching for ' + password + '...' )
sys.stdout.flush()
result = subprocess.check_output('grep "' + password + '" ' + args.creds, shell=True )
print( 'Found ' + str(len(result.strip().split('\n'))) + ' uses' )
sys.stdout.flush()
for line in result.split('\n'):
line = line.strip()
if line == '':
continue
passwords[password].append(parseline(line))
print('')
print('Email addresses:')
print('================')
sys.stdout.flush()
for person in emaillist:
print(person['email'])
sys.stdout.flush()
print('')
print('Results:')
print('========')
sys.stdout.flush()
# Iterate over all people and output relevant password hints
for person in emaillist:
if person['pass'] == '':
continue;
print('')
extra = ''
if len( person['pass'] ) == 12:
extra += ' length <= 7'
elif 'ioxG6CatHBw==' in person['pass']:
extra += ' length == 8'
else:
extra += ' length > 8'
print( person['email'] + ': ' + person['pass'] + extra + ' ('+str(len(passwords[person['pass']]))+')' )
for hint in passwords[person['pass']]:
print( ' ' + hint['email'] + ': ' + hint['hint'] )
sys.stdout.flush()