0% found this document useful (0 votes)
29 views2 pages

Email Domain Environment Checker

fsadf

Uploaded by

zeusreborn2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Email Domain Environment Checker

fsadf

Uploaded by

zeusreborn2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import threading

import requests
import logging
import colorlog
from queue import Queue
import re
import time

# Configuração do logging com colorlog


def setup_custom_logger():
handler = [Link]()
[Link]([Link](
'%(log_color)s%(asctime)s - %(levelname)s - %(message)s',
log_colors={
'DEBUG': 'cyan',
'INFO': 'green',
'WARNING': 'yellow',
'ERROR': 'red',
'CRITICAL': 'bold_red'
}
))
logger = [Link]()
[Link](handler)
[Link]([Link])
return logger

logger = setup_custom_logger()

# Fila para gerenciar as URLs


url_queue = Queue()

# Leitura do arquivo de emails


with open('[Link]', 'r') as f:
emails = [Link]()

# Extração de domínios dos emails


domains = set()
for email in emails:
domain = [Link]('@')[1].strip()
[Link](f'[Link]

# Função que verifica se a informação existe na página


def check_env(url):
retries = 3 # Número de tentativas
for attempt in range(retries):
try:
response = [Link](url, timeout=5)
if response.status_code == 200:
content = [Link]
if [Link](r'MAIL_MAILER=smtp', content):
with open('[Link]', 'a') as f:
[Link](f'{url}\n')
[Link](f'Encontrado: {url}')
return
else:
[Link](f'Não encontrado: {url}')
return
else:
[Link](f'Falha ao acessar: {url} (Status Code:
{response.status_code})')
except [Link] as e:
[Link](f'Erro ao acessar {url}: {e}')
[Link](2) # Espera 2 segundos antes de tentar novamente
[Link](f'Falha após {retries} tentativas: {url}')

# Função que será executada por cada thread


def worker():
while not url_queue.empty():
url = url_queue.get()
check_env(url)
url_queue.task_done()

# Populando a fila com as URLs


for domain in domains:
url_queue.put(domain)

# Criando as threads
threads = []
for _ in range(50):
thread = [Link](target=worker)
[Link]()
[Link](thread)

# Aguardando as threads terminarem


for thread in threads:
[Link]()

[Link]('Processo concluído.')

You might also like