Ashley Madison Contacts Lookup

Wouldn’t it be interesting to find out if you personally know any of Ashley Madison members? With some elementary knowledge of Python you can!

The amount of information produced in the Ashley Madison security breach is staggering, but not outside of reach of a patient data forensics hobbyist.

In this tutorial we will avoid setting up a robust MySQL server that would be necessary to sift through the mountains of data. Instead we’ll use Python and a text editor.

Consider that there are many fake accounts in the Ashley Madison database, including President Obama and Donald Trump accounts. Just because someone’s email address was used in creation of an account it doesn’t mean the person in question has had anything to do with it. Even if an account is real, it does not mean the member has done anything immoral or illegal.

What We Need

  1. Python 2.7 (preinstalled on OS X and many Linux distros)
  2. text editor
  3. aaminno_member_email.dump file
  4. contacts.csv from your Gmail account, saved in Outlook format

The Process

We will cleanup the dump file into a smaller, human readable file. Then we will compare your Gmail contacts email addresses to the email addresses in the cleaned Ashley Madison email file.

Step 1. Tidy Up the File

Copy and paste this Python script into a text editor and save as amcleaner.py. Unless you are running Windows give the file executable permissions. Make sure to save the file in the same location as the aaminno_member_email.dump file.

amcleaner.py
 
  1. #! /usr/bin/env python
  2. # amcleaner.py
  3. # Cleans up Ashley Madison email dump to a readable list.
  4. # www.skifactz.com/wifi
  5. sourcefile = open('aminno_member_email.dump', 'r')
  6. cleanfile = open('emailcleaned.txt', 'w')
  7. cellDelimiter = '),('
  8. for line in sourcefile:
  9.       try:
  10.             user = line.split(cellDelimiter)
  11.             for i in user:
  12.                   email = i.split(',')[1]
  13.                   email = email[1:-1]
  14.                   print email
  15.                   cleanfile.write(email + '\n')
  16.       except:
  17.             pass
  18. sourcefile.close()
  19. cleanfile.close()
  20. print 'Created emaicleaned.txt.'

 

Amcleaner will load the Ashley Madison email dump file, strip off excess information and save a file called emailcleaned.txt. The script looks for a particular pattern in the MySQL dump file, splits, and deletes the contents based on this pattern.

Double click amcleaner.py or run from command line to see progress feedback. The process may take quite a bit of time to complete. If you double clicked the script there will be no particular notification of completion. Monitor the changing size of emailcleaned.txt to determine when the process is finished.

Emailcleaned.txt is still going to be a large file that may overwhelm the text editor, but you could try opening it.

Step 2. Compare to Gmail Addresses

Copy and paste this Python script into a text editor and save as amcompare.py. Unless you are running Windows give the file executable permissions. Make sure to save amcompare.py in the same directory as emailcleaned.txt file created in the previous step.

amcompare.py
 
  1. #! /usr/bin/env python
  2. import time
  3. import csv
  4. # amcompare.py
  5. # Compares your Gmail/Outlook contacts against Ashley Madison email list.
  6. # www.skifactz.com/wifi
  7. def etc(state, passes):
  8.       '''Estimated time of completion in minutes.'''
  9.       global tStartTime
  10.       if state == 'start':
  11.             tStartTime = time.time()
  12.       if state == 'check':
  13.             etc = (time.time() - tStartTime) * passes
  14.             return int(etc / 60)
  15. # Open Gmail contacts file
  16. gmailcontacts = open('contacts.csv', 'rb')
  17. reader = csv.reader(gmailcontacts)
  18. # Place email addresses into mycontacts list
  19. mycontacts = []
  20. for row in reader:
  21.       if row[14] != '':
  22.             mycontacts.append(row[14].lower())
  23.       if row[15] != '':
  24.             mycontacts.append(row[15].lower())
  25.       if row[16] != '':
  26.             mycontacts.append(row[16].lower())
  27. gmailcontacts.close()
  28. print 'Gmail file is loaded.'
  29. # Load clean AM emails file and place into a tuple
  30. amaddress = open('emailcleaned.txt', 'r')
  31. amemails = tuple(amaddress)
  32. amaddress.close()
  33. print 'AM email file is loaded.'
  34. # Create output file
  35. matched = open('matched.txt', 'w')
  36. # Initiate estimated time of completion
  37. passes = len(mycontacts)
  38. etc('start', None)
  39. # Iterate through AM emails looking for matches, write to file if found
  40. for i in mycontacts:
  41.       print 'Scanning: %s' %i
  42.       for email in amemails:
  43.             if i == email[:-1]:
  44.                   print 'Found match: %s' %i
  45.                   matched.write(i + '\n')
  46.       
  47.       t = etc('check', passes)
  48.       passes -= 1
  49.       print '%s minutes to completion' %t
  50. matched.close()
  51. print 'Finished. Read matched.txt for matches.'

 

Save contacts.csv in Outlook format from your Gmail contacts. Make sure to save the file to the same directory as amcompare.py.

Run amcompare.py by double clicking the script. The script will extract all your Gmail email addresses and compare them to the Ashley Madison members’ email addresses. Any positive matches will be saved in a file called matched.txt. This process may take a while too so let it cook for a while,  or start it from the command line for progress feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *