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 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.

 #! /usr/bin/env python

# Cleans up Ashley Madison email dump to a readable list.

sourcefile = open('aminno_member_email.dump', 'r')
cleanfile = open('emailcleaned.txt', 'w')

cellDelimiter = '),('
for line in sourcefile:
            user = line.split(cellDelimiter)
            for i in user:
                  email = i.split(',')[1]
                  email = email[1:-1]
                  print email
                  cleanfile.write(email + '\n')


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 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 Unless you are running Windows give the file executable permissions. Make sure to save in the same directory as emailcleaned.txt file created in the previous step.

 #! /usr/bin/env python
import time
import csv

# Compares your Gmail/Outlook contacts against Ashley Madison email list.

def etc(state, passes):
      '''Estimated time of completion in minutes.'''
      global tStartTime
      if state == 'start':
            tStartTime = time.time()
      if state == 'check':
            etc = (time.time() - tStartTime) * passes
            return int(etc / 60)

# Open Gmail contacts file
gmailcontacts = open('contacts.csv', 'rb')
reader = csv.reader(gmailcontacts)

# Place email addresses into mycontacts list
mycontacts = []
for row in reader:
      if row[14] != '':
      if row[15] != '':
      if row[16] != '':

print 'Gmail file is loaded.'

# Load clean AM emails file and place into a tuple
amaddress = open('emailcleaned.txt', 'r')
amemails = tuple(amaddress)
print 'AM email file is loaded.'

# Create output file
matched = open('matched.txt', 'w')

# Initiate estimated time of completion
passes = len(mycontacts)
etc('start', None)

# Iterate through AM emails looking for matches, write to file if found
for i in mycontacts:
      print 'Scanning: %s' %i
      for email in amemails:
            if i == email[:-1]:
                  print 'Found match: %s' %i
                  matched.write(i + '\n')
      t = etc('check', passes)
      passes -= 1
      print '%s minutes to completion' %t

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

Run 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 *