At its core, MailKeker.py is a multi-threaded, Python-based email validation and enumeration tool. The name is likely a portmanteau of "Mail" and "Keker" (slang for a powerful check or "kek" – a laugh), suggesting its primary function: aggressively checking the validity of email addresses against mail exchange (MX) servers without triggering a full email send.
Unlike simply pinging an SMTP server with HELO, MailKeker.py utilizes sophisticated verification techniques to determine if an email address exists, is catch-all, or is a honeypot. It is frequently used in two distinct scenarios:
A unique feature distinguishing MailKeker.py from simpler tools is its Catch-All detection engine. A catch-all server accepts every email address, making enumeration seem impossible. To detect this, MailKeker.py generates a statistically improbable random string (e.g., iuahsd9823hj@target.com) and sends it to the server. If the server accepts that clearly fake address, the script flags the entire domain as "Catch-All" and marks previous results as potentially unreliable. MailKeker.py
Greylisting (temp-failing first-time connections) confuses MailKeker.py because the tool rarely implements a full retry queue. It sees 451 Temporary failure and marks the address as "Unknown," ruining the attacker's dataset.
The script processes an input source (e.g., emails.txt or combo.txt). At its core, MailKeker
A script of this nature typically relies on standard Python libraries for networking and potentially third-party libraries for HTML parsing or proxy handling.
import smtplib # For sending mail / SMTP validation
import imaplib # For reading mail / IMAP validation
import socket # For low-level network connections
import threading # For concurrent checking (multithreading)
import time # For delays and timeouts
import sys # For command line arguments
import re # Regular expressions for email formatting validation
# Optional: import requests # If checking against a web API
The script queries Domain Name System (DNS) servers to find the Mail Exchange (MX) records for the target domain. The script queries Domain Name System (DNS) servers
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class MailKeker: def init(self, smtp_server: str, smtp_port: int, username: str, password: str, use_tls: bool = True): self.smtp_server = smtp_server self.smtp_port = smtp_port self.username = username self.password = password self.use_tls = use_tls
def send_email(self, to_emails: List[str], subject: str, body: str, html: Optional[str] = None,
attachments: Optional[List[str]] = None, cc: Optional[List[str]] = None,
bcc: Optional[List[str]] = None) -> bool:
"""
Complete email sending feature with:
- Plain text & HTML support
- Multiple recipients (to, cc, bcc)
- File attachments
- Error handling & logging
"""
try:
# Create message
msg = MIMEMultipart('alternative' if html else 'mixed')
msg['From'] = self.username
msg['To'] = ", ".join(to_emails)
if cc:
msg['Cc'] = ", ".join(cc)
msg['Subject'] = subject
# Attach plain text part
msg.attach(MIMEText(body, 'plain'))
# Attach HTML part if provided
if html:
msg.attach(MIMEText(html, 'html'))
# Attach files
if attachments:
for file_path in attachments:
if os.path.exists(file_path):
with open(file_path, 'rb') as attachment:
part = MIMEBase('application', 'octet-stream')
part.set_payload(attachment.read())
encoders.encode_base64(part)
part.add_header(
'Content-Disposition',
f'attachment; filename=os.path.basename(file_path)'
)
msg.attach(part)
else:
logging.warning(f"Attachment not found: file_path")
# Prepare recipient list (to + cc + bcc)
all_recipients = to_emails + (cc or []) + (bcc or [])
# Send email
context = ssl.create_default_context() if self.use_tls else None
with smtplib.SMTP(self.smtp_server, self.smtp_port) as server:
if self.use_tls:
server.starttls(context=context)
server.login(self.username, self.password)
server.sendmail(self.username, all_recipients, msg.as_string())
logging.info(f"Email sent successfully to len(all_recipients) recipient(s)")
return True
except Exception as e:
logging.error(f"Failed to send email: str(e)")
return False