Skip to content

Commit

Permalink
output improvement+youtube plugin
Browse files Browse the repository at this point in the history
output improvement
youtube plugin added
  • Loading branch information
maldevel committed Apr 30, 2016
1 parent 932ca05 commit da2bc32
Show file tree
Hide file tree
Showing 16 changed files with 139 additions and 94 deletions.
43 changes: 22 additions & 21 deletions EmailHarvester.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
__copyright__ = "Copyright (c) 2016 @maldevel"
__credits__ = ["maldevel", "PaulSec", "cclauss", "Christian Martorella"]
__license__ = "GPLv3"
__version__ = "1.3.1"
__version__ = "1.3.2"
__maintainer__ = "maldevel"

################################
Expand Down Expand Up @@ -93,6 +93,7 @@ def __init__(self, userAgent, proxy):
self.proxy = proxy
self.userAgent = userAgent
self.parser = myparser()
self.activeEngine = "None"
path = "plugins/"
plugins = {}

Expand All @@ -112,14 +113,15 @@ def get_plugins(self):
def show_message(self, msg):
print(green(msg))

def init_search(self, url, word, limit, counterInit, counterStep):
def init_search(self, url, word, limit, counterInit, counterStep, engineName):
self.results = ""
self.totalresults = ""
self.limit = int(limit)
self.counter = int(counterInit)
self.url = url
self.step = int(counterStep)
self.word = word
self.activeEngine = engineName

def do_search(self):
try:
Expand All @@ -143,11 +145,11 @@ def process(self):
self.do_search()
time.sleep(1)
self.counter += self.step
print("\tSearching " + str(self.counter) + " results...")
print(green("[+] Searching in {}:".format(self.activeEngine)) + cyan(" {} results".format(str(self.counter))))

def get_emails(self):
self.parser.extract(self.totalresults, self.word)
return self.parser.emails()
return self.parser.emails()

###################################################################

Expand All @@ -160,6 +162,9 @@ def green(text):
def red(text):
return colored(text, 'red', attrs=['bold'])

def cyan(text):
return colored(text, 'cyan', attrs=['bold'])

def unique(data):
return list(set(data))

Expand Down Expand Up @@ -230,14 +235,12 @@ def checkDomain(value):

if args.listplugins:
path = "plugins/"
msg = "[+] Available plugins:"
print(green(msg))
print(green("-" * len(msg)))
print(green("[+] Available plugins"))
sys.path.insert(0, path)
for f in os.listdir(path):
fname, ext = os.path.splitext(f)
if ext == '.py':
print(fname)
print(green("[+] Plugin: ") + cyan(fname))
sys.exit(1)

if not args.domain:
Expand All @@ -248,10 +251,10 @@ def checkDomain(value):
userAgent = (args.uagent or
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1")

print("User-Agent in use: {}".format(yellow(userAgent)))
print(green("[+] User-Agent in use: ") + cyan(userAgent))

if args.proxy:
print("Proxy server in use: {}".format(yellow(args.proxy.scheme + "://" + args.proxy.netloc)))
print(green("[+] Proxy server in use: ") + cyan(args.proxy.scheme + "://" + args.proxy.netloc))

filename = args.filename or ""
limit = args.limit
Expand All @@ -264,40 +267,38 @@ def checkDomain(value):
if args.exclude:
excluded = args.exclude.split(',')
if engine == "all":
print(green("[+] Searching everywhere.."))
print(green("[+] Searching everywhere"))
for search_engine in plugins:
if search_engine not in excluded:
all_emails += plugins[search_engine]['search'](domain, limit)
elif engine not in plugins:
print(red("Search engine plugin not found"))
print(red("[-] Search engine plugin not found"))
sys.exit(3)
else:
all_emails = plugins[engine]['search'](domain, limit)
all_emails = unique(all_emails)

if not all_emails:
print(red("\nNo emails found!"))
print(red("[-] No emails found"))
sys.exit(4)

msg = "\n\n[+] {} emails found:".format(len(all_emails))
print(green(msg))
print(green("-" * len(msg)))
print(green("[+] Emails found: ") + cyan(len(all_emails)))

if not args.noprint:
for emails in all_emails:
print(emails)

if filename:
try:
print(green("\n[+] Saving files..."))
print(green("[+] Saving results to files"))
with open(filename, 'w') as out_file:
for email in all_emails:
try:
out_file.write(email + "\n")
except:
print(red("Exception " + email))
print(red("[-] Exception: " + email))
except Exception as e:
print(red("Error saving TXT file: " + e))
print(red("[-] Error saving TXT file: " + e))

try:
filename = filename.split(".")[0] + ".xml"
Expand All @@ -306,7 +307,7 @@ def checkDomain(value):
for email in all_emails:
out_file.write('<email>{}</email>'.format(email))
out_file.write('</EmailHarvester>')
print(green("Files saved!"))
print(green("[+] Files saved"))
except Exception as er:
print(red("Error saving XML file: " + er))
print(red("[-] Error saving XML file: " + er))

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Features
* Define your own User-Agent string.
* Use proxy server.
* Plugins system.
* Search in popular web sites using Search engines (Twitter, LinkedIn, Google+, Github, Instagram, Reddit).
* Search in popular web sites using Search engines (Twitter, LinkedIn, Google+, Github, Instagram, Reddit, Youtube).


Download/Installation
Expand All @@ -48,7 +48,7 @@ usage: EmailHarvester.py [-h] [-d DOMAIN] [-s FILE] [-e ENGINE] [-l LIMIT]
\____/|_| |_| |_| \__,_||_||_| \_| |_/ \__,_||_| \_/ \___||___/ \__|\___||_|
A tool to retrieve Domain email addresses from Search Engines | @maldevel
Version: 1.3.1
Version: 1.3.2
optional arguments:
-h, --help show this help message and exit
Expand Down
12 changes: 10 additions & 2 deletions plugins/ask.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,19 @@
import requests
import time
import sys
from termcolor import colored

config = None
app_emailharvester = None

def green(text):
return colored(text, 'green', attrs=['bold'])

def red(text):
return colored(text, 'red', attrs=['bold'])

def cyan(text):
return colored(text, 'cyan', attrs=['bold'])

class AskSearch(object):

Expand Down Expand Up @@ -65,15 +74,14 @@ def process(self):
time.sleep(1)
self.counter += 10
self.page += 1
print("\tSearching " + str(self.counter) + " results...")
print(green("[+] Searching in ASK:") + cyan(" {} results".format(str(self.counter))))

def get_emails(self):
app_emailharvester.parser.extract(self.totalresults, self.word)
return app_emailharvester.parser.emails()


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in ASK..\n")
url = "http://www.ask.com/web?q=%40{word}&page={page}"
search = AskSearch(url, domain, limit)
search.process()
Expand Down
3 changes: 1 addition & 2 deletions plugins/baidu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in Baidu..\n")
url = 'http://www.baidu.com/search/s?wd="%40{word}"&pn={counter}'
app_emailharvester.init_search(url, domain, limit, 0, 10)
app_emailharvester.init_search(url, domain, limit, 0, 10, 'Baidu')
app_emailharvester.process()
return app_emailharvester.get_emails()

Expand Down
3 changes: 1 addition & 2 deletions plugins/bing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in Bing..\n")
url = "http://www.bing.com/search?q=%40{word}&count=50&first={counter}"
app_emailharvester.init_search(url, domain, limit, 0, 50)
app_emailharvester.init_search(url, domain, limit, 0, 50, 'Bing')
app_emailharvester.process()
return app_emailharvester.get_emails()

Expand Down
3 changes: 1 addition & 2 deletions plugins/dogpile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in Dogpile..\n")
url = 'http://www.dogpile.com/search/web?qsi={counter}&q="%40{word}"'
app_emailharvester.init_search(url, domain, limit, 1, 10)
app_emailharvester.init_search(url, domain, limit, 1, 10, 'Dogpile')
app_emailharvester.process()
return app_emailharvester.get_emails()

Expand Down
3 changes: 1 addition & 2 deletions plugins/exalead.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in Exalead..\n")
url = "http://www.exalead.com/search/web/results/?q=%40{word}&elements_per_page=10&start_index={counter}"
app_emailharvester.init_search(url, domain, limit, 0, 50)
app_emailharvester.init_search(url, domain, limit, 0, 50, 'Exalead')
app_emailharvester.process()
return app_emailharvester.get_emails()

Expand Down
17 changes: 6 additions & 11 deletions plugins/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,30 @@

def search(domain, limit):
all_emails = []
app_emailharvester.show_message("\n[+] Searching in Github..\n")
app_emailharvester.show_message("[+] Searching in Github")

app_emailharvester.show_message("\n[+] Searching in Yahoo + Github..\n")
yahooUrl = "http://search.yahoo.com/search?p=site%3Agithub.com+%40{word}&n=100&ei=UTF-8&va_vt=any&vo_vt=any&ve_vt=any&vp_vt=any&vd=all&vst=0&vf=all&vm=p&fl=0&fr=yfp-t-152&xargs=0&pstart=1&b={counter}"
app_emailharvester.init_search(yahooUrl, domain, limit, 1, 100)
app_emailharvester.init_search(yahooUrl, domain, limit, 1, 100, 'Yahoo + Github')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Bing + Github..\n")
bingUrl = "http://www.bing.com/search?q=site%3Agithub.com+%40{word}&count=50&first={counter}"
app_emailharvester.init_search(bingUrl, domain, limit, 0, 50)
app_emailharvester.init_search(bingUrl, domain, limit, 0, 50, 'Bing + Github')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Google + Github..\n")
googleUrl = 'https://www.google.com/search?num=100&start={counter}&hl=en&q=site%3Agithub.com+"%40{word}"'
app_emailharvester.init_search(googleUrl, domain, limit, 0, 100)
app_emailharvester.init_search(googleUrl, domain, limit, 0, 100, 'Google + Github')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Baidu + Github..\n")
url = 'http://www.baidu.com/search/s?wd=site%3Agithub.com+"%40{word}"&pn={counter}'
app_emailharvester.init_search(url, domain, limit, 0, 10)
app_emailharvester.init_search(url, domain, limit, 0, 10, 'Baidu + Github')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Exalead + Github..\n")
url = "http://www.exalead.com/search/web/results/?q=site%3Agithub.com+%40{word}&elements_per_page=10&start_index={counter}"
app_emailharvester.init_search(url, domain, limit, 0, 50)
app_emailharvester.init_search(url, domain, limit, 0, 50, 'Exalead + Github')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

Expand Down
3 changes: 1 addition & 2 deletions plugins/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in Google..\n")
url = 'https://www.google.com/search?num=100&start={counter}&hl=en&q="%40{word}"'
app_emailharvester.init_search(url, domain, limit, 0, 100)
app_emailharvester.init_search(url, domain, limit, 0, 100, 'Google')
app_emailharvester.process()
return app_emailharvester.get_emails()

Expand Down
3 changes: 1 addition & 2 deletions plugins/googleplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@


def search(domain, limit):
app_emailharvester.show_message("\n[+] Searching in Google+..\n")
#search google+ only with google search engine
#who is gonna have google+ indexed better than google itself?
url = 'https://www.google.com/search?num=100&start={counter}&hl=en&q=site%3Aplus.google.com+intext:"Works at"+-inurl:photos+-inurl:about+-inurl:posts+-inurl:plusones+%40{word}'
app_emailharvester.init_search(url, domain, limit, 0, 100)
app_emailharvester.init_search(url, domain, limit, 0, 100, 'Google+')
app_emailharvester.process()
return app_emailharvester.get_emails()

Expand Down
17 changes: 6 additions & 11 deletions plugins/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,30 @@

def search(domain, limit):
all_emails = []
app_emailharvester.show_message("\n[+] Searching in Instagram..\n")
app_emailharvester.show_message("[+] Searching in Instagram")

app_emailharvester.show_message("\n[+] Searching in Yahoo + Instagram..\n")
yahooUrl = "http://search.yahoo.com/search?p=site%3Ainstagram.com+%40{word}&n=100&ei=UTF-8&va_vt=any&vo_vt=any&ve_vt=any&vp_vt=any&vd=all&vst=0&vf=all&vm=p&fl=0&fr=yfp-t-152&xargs=0&pstart=1&b={counter}"
app_emailharvester.init_search(yahooUrl, domain, limit, 1, 100)
app_emailharvester.init_search(yahooUrl, domain, limit, 1, 100, 'Yahoo + Instagram')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Bing + Instagram..\n")
bingUrl = "http://www.bing.com/search?q=site%3Ainstagram.com+%40{word}&count=50&first={counter}"
app_emailharvester.init_search(bingUrl, domain, limit, 0, 50)
app_emailharvester.init_search(bingUrl, domain, limit, 0, 50, 'Bing + Instagram')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Google + Instagram..\n")
googleUrl = 'https://www.google.com/search?num=100&start={counter}&hl=en&q=site%3Ainstagram.com+"%40{word}"'
app_emailharvester.init_search(googleUrl, domain, limit, 0, 100)
app_emailharvester.init_search(googleUrl, domain, limit, 0, 100, 'Google + Instagram')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Baidu + Instagram..\n")
url = 'http://www.baidu.com/search/s?wd=site%3Ainstagram.com+"%40{word}"&pn={counter}'
app_emailharvester.init_search(url, domain, limit, 0, 10)
app_emailharvester.init_search(url, domain, limit, 0, 10, 'Baidu + Instagram')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Exalead + Instagram..\n")
url = "http://www.exalead.com/search/web/results/?q=site%3Ainstagram.com+%40{word}&elements_per_page=10&start_index={counter}"
app_emailharvester.init_search(url, domain, limit, 0, 50)
app_emailharvester.init_search(url, domain, limit, 0, 50, 'Exalead + Instagram')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

Expand Down
17 changes: 6 additions & 11 deletions plugins/linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,30 @@

def search(domain, limit):
all_emails = []
app_emailharvester.show_message("\n[+] Searching in Linkedin..\n")
app_emailharvester.show_message("[+] Searching in Linkedin")

app_emailharvester.show_message("\n[+] Searching in Yahoo + Linkedin..\n")
yahooUrl = "http://search.yahoo.com/search?p=site%3Alinkedin.com+%40{word}&n=100&ei=UTF-8&va_vt=any&vo_vt=any&ve_vt=any&vp_vt=any&vd=all&vst=0&vf=all&vm=p&fl=0&fr=yfp-t-152&xargs=0&pstart=1&b={counter}"
app_emailharvester.init_search(yahooUrl, domain, limit, 1, 100)
app_emailharvester.init_search(yahooUrl, domain, limit, 1, 100, 'Yahoo + Linkedin')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Bing + Linkedin..\n")
bingUrl = "http://www.bing.com/search?q=site%3Alinkedin.com+%40{word}&count=50&first={counter}"
app_emailharvester.init_search(bingUrl, domain, limit, 0, 50)
app_emailharvester.init_search(bingUrl, domain, limit, 0, 50, 'Bing + Linkedin')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Google + Linkedin..\n")
googleUrl = 'https://www.google.com/search?num=100&start={counter}&hl=en&q=site%3Alinkedin.com+"%40{word}"'
app_emailharvester.init_search(googleUrl, domain, limit, 0, 100)
app_emailharvester.init_search(googleUrl, domain, limit, 0, 100, 'Google + Linkedin')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Baidu + Linkedin..\n")
url = 'http://www.baidu.com/search/s?wd=site%3Alinkedin.com+"%40{word}"&pn={counter}'
app_emailharvester.init_search(url, domain, limit, 0, 10)
app_emailharvester.init_search(url, domain, limit, 0, 10, 'Baidu + Linkedin')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

app_emailharvester.show_message("\n[+] Searching in Exalead + Linkedin..\n")
url = "http://www.exalead.com/search/web/results/?q=site%3Alinkedin.com+%40{word}&elements_per_page=10&start_index={counter}"
app_emailharvester.init_search(url, domain, limit, 0, 50)
app_emailharvester.init_search(url, domain, limit, 0, 50, 'Exalead + Linkedin')
app_emailharvester.process()
all_emails += app_emailharvester.get_emails()

Expand Down
Loading

0 comments on commit da2bc32

Please sign in to comment.