#!/usr/bin/python
# getyourbots.com
# Only thing needed is to make sure that python-whois is installed
# and you have a file in the same directory with this script
# with the name webs.txt which contains domains (one per line)
import sys
try:
import whois
except:
print '[!] python-whois package not installed'
print '[+] Instructions'
print '-----------------'
print '[-] Linux: pip2.7 install python-whois'
print '[-] Windows: C:\Python2.7\Scripts\pip.exe install python-whois # if python installed in the default path, otherwise change Python2.7 with your Python installation folder.'
sys.exit(0)
running = True
def get_emails(w):
global running
emails = []
try:
wh = whois.whois(w)
l_e = len(wh['emails'])
if l_e == 0:
return
elif type(wh['emails']) == type(u's'):
emails.append(wh['emails'].encode('utf-8'))
return
for e in wh['emails']:
emails.append(e.encode('utf-8'))
except KeyboardInterrupt, e:
running = False
except Exception, e:
emails = []
finally:
return emails
def main():
print '[+] Whois emails scraper'
print '[+] getyourbots.com'
print ''
webs = []
# get websites from file
with open('webs.txt', 'rb') as f:
webs = f.readlines()
print '[+] Read {0} websites'.format(str(len(webs)))
for w in webs:
if not running:
print ''
print '[+] Stopped by user.'
return
w = w.replace('https://','').replace('http://','').replace('www.','').strip()
if w.endswith('/'):
w = ''.join(list(w)[0:-1])
sys.stdout.write('[+] {0} - '.format(w))
sys.stdout.flush()
emails = get_emails(w)
if not running:
continue
if len(emails) == 0:
print 'N/A'
continue
print str(len(emails))
for email in emails:
print '[+] - {0}'.format(email)
with open('emails.txt', 'a') as f:
f.write(email + '\r\n')
if __name__ == "__main__":
main()