Пример #1
0
    def response(self, flow: http.HTTPFlow) -> None:
        try:
            emails = []
            if "html" in flow.response.headers["Content-Type"] and len(
                    flow.response.content):
                if "google.com" in flow.request.host:
                    names = google(flow.response.content)
                elif "bing.com" in flow.request.host:
                    names = bing(flow.response.content)
                else:
                    return

                for name in names:
                    first, last = name
                    email = f"{ctx.options.email_format.format(first=first, last=last, f=first[:1], l=last[:1])}@{ctx.options.domain}".lower(
                    )
                    emails.append(email)

                ctx.log.info(print_good(f"Generated {len(emails)} email(s)"))

                asyncio.ensure_future(
                    self.atomizer.atomize([
                        email for email in emails if email not in self.emails
                    ]))
                self.emails |= set(emails)
        except KeyError:
            pass
Пример #2
0
    def shutdown(self):
        with open('imap_valid_accounts.txt', 'a+') as account_file:
            for pair in self.valid_accounts:
                account_file.write(':'.join(pair) + '\n')

        self.log.info(
            print_good(
                f"Dumped {len(self.valid_accounts)} valid accounts to imap_valid_accounts.txt"
            ))
Пример #3
0
    def shutdown(self):
        with open("emails.txt", "a+") as email_file:
            for email in self.emails:
                email_file.write(email + '\n')

        ctx.log.info(
            print_good(f"Dumped {len(self.emails)} email(s) to emails.txt"))
        self.atomizer.shutdown()
        self.loop.stop()
        pending = asyncio.Task.all_tasks()
        self.loop.run_until_complete(asyncio.gather(*pending))
Пример #4
0
 def response(self, flow: http.HTTPFlow) -> None:
     try:
         if "html" in flow.response.headers["Content-Type"] and len(
                 flow.response.content):
             if ctx.options.target in flow.request.host:
                 html = lxml.html.fromstring(flow.response.content)
                 the_best_words = set(html.xpath('//text()'))
                 ctx.log.info(
                     print_good(
                         f"Got {len(the_best_words)} words, the best words..."
                     ))
                 self.words |= the_best_words
     except KeyError:
         pass
Пример #5
0
 def auth_O365(self, username, password):
     log = logging.getLogger(f"auth_imap_O365({username})")
     try:
         server = imapclient.IMAPClient(self.target,
                                        port=self.port,
                                        ssl=True,
                                        timeout=3)
         server.login(username, password)
         self.valid_accounts.add((username, password))
         log.info(print_good(f"Found credentials: {username}:{password}"))
     except imapclient.exceptions.LoginError:
         log.info(
             print_bad(
                 f"Authentication failed: {username}:{password} (Login failed)"
             ))
     except Exception as e:
         self.log.error(
             print_bad(f"Error communicating with the IMAP server"))
         self.log.error(f"    Full error: {e}\n")