Book Image

Python Web Penetration Testing Cookbook

By : Benjamin May, Cameron Buchanan, Andrew Mabbitt, Dave Mound, Terry Ip
Book Image

Python Web Penetration Testing Cookbook

By: Benjamin May, Cameron Buchanan, Andrew Mabbitt, Dave Mound, Terry Ip

Overview of this book

Table of Contents (16 chapters)
Python Web Penetration Testing Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Generating e-mail addresses from names


In some scenarios, you may have a list of employees for a target company and you want to generate a list of e-mail addresses. E-mail addresses can be potentially useful. You might want to use them to perform a phishing attack, or you might want to use them to try and log on to a company's application, such as an e-mail or a corporate portal containing sensitive internal documentation.

Getting ready

Before you can use this recipe, you will want to have a list of names to work with. If you don't have a list of names, you might want to consider first performing an open source intelligence exercise on your target.

How to do it…

The following code will take a file containing a list of names and generate a list of e-mail addresses in varying formats:

import sys

if len(sys.argv) !=3:
  print "usage: %s name.txt email suffix" % (sys.argv[0])
  sys.exit(0)
for line in open(sys.argv[1]):
  name = ''.join([c for c in line if c == " " or c.isalpha()])
  tokens = name...