def __init__(self): colors = Colors() green = colors.green() reset = colors.reset() print green + """ Simple Email Harvester This tools allows to scrape websites for emails Usage: ./email_harvester.py --url http://www.example.com --file example_emails.txt """ + reset
def main(self): if not self.argv: logging.error("No test file!") return False # for arg in self.argv: try: logging.info(Colors.blue("Test on %s:" % arg)) err, tot = self.test(arg) self._errors += err self._total += tot except TR_Exception as e: logging.error(str(e)) # logging.info("") if self._errors == 0: logging.error(Colors.green("All test files passed! %d/%d" % (self._total - self._errors, self._total))) else: logging.error(Colors.fail("Some test files failed! %d/%d" % (self._total - self._errors, self._total))) # return self._errors == 0;
def DrawGrid(self, color=Colors.green()): """Draws grid.""" self._DrawVerticalGrid(color=color) self._DrawHorizontalGrid(color=color)
def print_result(self, errors, total): args = (self.name, total - errors, total) if errors == 0: logging.warning(Colors.green("Test '%s' passed! %d/%d" % args)) else: logging.warning(Colors.fail("Test '%s' failed! %d/%d" % args))
try: from banner import Banner from colors import Colors from bs4 import BeautifulSoup import re import requests import requests.exceptions from collections import deque except ImportError: print 'Install all required libraries' sys.exit(1) colors = Colors() RED = colors.red() GREEN = colors.green() BLUE = colors.blue() RESET = colors.reset() class EmailHarvester: def __init__(self, urls): self.urls = urls self.completed_urls = set() self.scrapped_emails = set() self.tmp_emails = set() def scrape_emails(self): try: while len(self.urls): url = self.urls.popleft()