fix and added some things still in beta

This commit is contained in:
BasaiCorp
2025-03-22 15:23:30 +05:30
parent 492482199a
commit 9fe6d1ae2c
4 changed files with 1000 additions and 234 deletions

View File

@@ -141,6 +141,19 @@ class NewTempEmail:
# 加载被屏蔽域名列表
self.blocked_domains = self.get_blocked_domains()
# Instead of using the default email generation, let's create a custom one
# First try creating a custom email with legitimate-looking patterns
try:
legitimate_email = self.create_legitimate_looking_email()
if legitimate_email:
return legitimate_email
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.custom_email_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 创建自定义邮箱失败: {str(e)}, 尝试使用默认方式{Style.RESET_ALL}")
# Fallback to standard email generation if custom fails
# 访问网站
self.page.get("https://smailpro.com/")
time.sleep(2)
@@ -190,6 +203,332 @@ class NewTempEmail:
print(f"{Fore.RED}❌ 创建邮箱出错: {str(e)}{Style.RESET_ALL}")
return None
def create_legitimate_looking_email(self):
"""Create a legitimate-looking email address using a service like mailforspam.com or mail.tm"""
try:
# List of services to try in order of preference
services = [
self.try_tempmail, # Try temp-mail.org (highly rated)
self.try_10minutemail, # Try 10minutemail.com (looks legitimate)
self.try_emailondeck, # Try EmailOnDeck (professional looking)
self.try_yopmail, # Try YOPmail (allows custom domains)
self.try_throwawaymail, # Try ThrowAwayMail (48 hour lifespan)
self.try_mailforspam, # Try mailforspam.com (current implementation)
self.try_mailtm, # Try mail.tm (current implementation)
self.try_tempmail_plus # Try tempmail.plus (current implementation)
]
# Try each service until one works
for service in services:
try:
if self.translator:
print(f"{Fore.CYAN} {self.translator.get('email.trying_provider', provider=service.__name__.replace('try_', ''))}{Style.RESET_ALL}")
else:
print(f"{Fore.CYAN} 尝试使用 {service.__name__.replace('try_', '')} 创建邮箱...{Style.RESET_ALL}")
email = service()
if email and '@' in email:
# Check domain against blocked list
domain = email.split('@')[1]
if self.blocked_domains and domain in self.blocked_domains:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.domain_blocked')}: {domain}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 域名已被屏蔽: {domain},尝试另一个服务{Style.RESET_ALL}")
continue
# Log success
if self.translator:
print(f"{Fore.GREEN}{self.translator.get('email.create_success')}: {email}{Style.RESET_ALL}")
else:
print(f"{Fore.GREEN}✅ 创建邮箱成功: {email}{Style.RESET_ALL}")
return email
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {service.__name__} failed: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ {service.__name__} 失败: {str(e)}{Style.RESET_ALL}")
return None
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.legitimate_email_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 创建可信邮箱失败: {str(e)}{Style.RESET_ALL}")
return None
def generate_realistic_username(self):
"""Generate a realistic-looking email username that appears legitimate"""
# First names for more realistic looking usernames
first_names = [
"john", "sara", "michael", "emma", "david", "jennifer", "robert", "lisa", "william", "emily",
"james", "olivia", "benjamin", "sophia", "daniel", "ava", "matthew", "mia", "andrew", "charlotte",
"joseph", "amelia", "christopher", "harper", "ryan", "evelyn", "nicholas", "abigail", "tyler", "ella",
"alex", "grace", "nathan", "zoe", "ethan", "hannah", "jason", "lily", "kevin", "natalie"
]
# Last names for more realistic looking usernames
last_names = [
"smith", "johnson", "williams", "brown", "jones", "miller", "davis", "garcia", "wilson", "martinez",
"anderson", "taylor", "thomas", "moore", "jackson", "martin", "lee", "perez", "thompson", "white",
"harris", "sanchez", "clark", "ramirez", "lewis", "robinson", "walker", "young", "allen", "king",
"wright", "scott", "green", "baker", "adams", "nelson", "hill", "rivera", "campbell", "mitchell"
]
# Words that make names look professional
professional_words = [
"work", "pro", "business", "office", "design", "dev", "tech", "media", "creative", "digital",
"studio", "systems", "solutions", "consulting", "info", "contact", "support", "service", "help"
]
# Generate random components
first = random.choice(first_names)
last = random.choice(last_names)
year_full = random.randint(1970, 2001)
year_short = year_full % 100
random_num = random.randint(1, 999)
# Create patterns that look like legitimate personal email usernames
patterns = [
f"{first}.{last}", # john.smith
f"{first}{last}", # johnsmith
f"{first}.{last}{year_short:02d}", # john.smith89
f"{first}{last}{random_num}", # johnsmith123
f"{first}{year_short:02d}", # john89
f"{first[0]}{last}", # jsmith
f"{first}.{last}.{year_short:02d}", # john.smith.89
f"{first}_{last}", # john_smith
f"{first}{year_full}", # john1989
f"{last}.{first}", # smith.john
f"{first}.{last}.{random.choice(professional_words)}", # john.smith.work
f"{first}{last}{year_short:02d}", # johnsmith89
f"{first[0]}{last}{year_short:02d}", # jsmith89
f"{first}-{last}" # john-smith
]
return random.choice(patterns)
def try_tempmail(self):
"""Try to create an email using temp-mail.org (one of the top rated services)"""
try:
self.page.get("https://temp-mail.org/")
time.sleep(3)
# Check if there's a "Change" button which means we already have an email
change_button = self.page.ele('xpath://button[contains(text(), "Change")]') or self.page.ele('xpath://a[contains(text(), "Change")]')
if change_button:
# Already have an email, get it from the input field
email_field = self.page.ele('xpath://input[@id="mail"]')
if email_field:
email = email_field.attr('value')
if email and '@' in email:
return email
# If we didn't get an email yet, look for it on the page
email_field = self.page.ele('xpath://input[@id="mail"]')
if email_field:
email = email_field.attr('value')
if email and '@' in email:
return email
return None
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.tempmail_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ temp-mail.org 创建失败: {str(e)}{Style.RESET_ALL}")
return None
def try_10minutemail(self):
"""Try to create an email using 10minutemail.com"""
try:
self.page.get("https://10minutemail.com/")
time.sleep(3)
# Look for the email address
email_field = self.page.ele('xpath://input[@id="mailAddress"]')
if not email_field:
email_field = self.page.ele('xpath://div[contains(@class, "mail-address-container")]/input')
if email_field:
email = email_field.attr('value')
if email and '@' in email:
return email
# Try alternative selector
email_div = self.page.ele('xpath://span[@class="animace"]')
if email_div:
email = email_div.text
if email and '@' in email:
return email
return None
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.10minutemail_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 10minutemail.com 创建失败: {str(e)}{Style.RESET_ALL}")
return None
def try_emailondeck(self):
"""Try to create an email using EmailOnDeck"""
try:
self.page.get("https://www.emailondeck.com/")
time.sleep(3)
# Look for "Get Email" button
get_email_button = self.page.ele('xpath://button[contains(text(), "Get Email")]')
if get_email_button:
get_email_button.click()
time.sleep(3)
# Look for the email field
email_field = self.page.ele('xpath://input[@id="email"]')
if email_field:
email = email_field.attr('value')
if email and '@' in email:
return email
# Alternative selector
email_div = self.page.ele('xpath://span[@id="email"]')
if email_div:
email = email_div.text
if email and '@' in email:
return email
return None
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.emailondeck_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ EmailOnDeck 创建失败: {str(e)}{Style.RESET_ALL}")
return None
def try_yopmail(self):
"""Try to create an email using YOPmail"""
try:
# Generate a better looking username first
username = self.generate_realistic_username()
# Navigate to YOPmail
self.page.get("https://yopmail.com/")
time.sleep(2)
# Try to find the email input field
email_field = self.page.ele('xpath://input[@id="login"]')
if email_field:
email_field.click()
time.sleep(0.5)
self.page.type(username)
time.sleep(1)
# Click the check button
check_button = self.page.ele('xpath://button[@title="Check Inbox" or @class="sbut" or contains(@onclick, "ver")]')
if check_button:
check_button.click()
time.sleep(2)
return f"{username}@yopmail.com"
return None
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.yopmail_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ YOPmail 创建失败: {str(e)}{Style.RESET_ALL}")
return None
def try_throwawaymail(self):
"""Try to create an email using ThrowAwayMail"""
try:
self.page.get("https://throwawaymail.com/")
time.sleep(3)
# Look for the email element
email_element = self.page.ele('xpath://div[contains(@class, "email")]') or self.page.ele('xpath://input[@id="email"]')
if email_element:
email = email_element.text or email_element.attr('value')
if email and '@' in email:
return email
return None
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.throwawaymail_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ ThrowAwayMail 创建失败: {str(e)}{Style.RESET_ALL}")
return None
def try_mailforspam(self):
"""Create an email using mailforspam.com"""
try:
self.page.get("https://mailforspam.com/")
time.sleep(3)
# Try to find the email address element
email_elements = self.page.eles('xpath://input[contains(@class, "emailbox-addr")]')
if email_elements and len(email_elements) > 0:
email = email_elements[0].attr('value')
if email and '@' in email:
return email
return None
except Exception:
return None
def try_mailtm(self):
"""Create an email using mail.tm"""
try:
self.page.get("https://mail.tm/en/")
time.sleep(3)
# Generate a better looking username
username = self.generate_realistic_username()
# Click on the username field and enter the username
username_field = self.page.ele('xpath://input[@id="address"]')
if username_field:
username_field.click()
time.sleep(0.5)
self.page.type(username)
time.sleep(1)
# Click the Create button
create_button = self.page.ele('xpath://button[contains(text(), "Create account")]')
if create_button:
create_button.click()
time.sleep(3)
# Try to find the email address element
email_element = self.page.ele('xpath://input[@id="address"]')
if email_element:
email = email_element.attr('value')
if email and '@' in email:
return email
return None
except Exception:
return None
def try_tempmail_plus(self):
"""Create an email using tempmail.plus"""
try:
self.page.get("https://tempmail.plus/en/")
time.sleep(3)
# Find and click the random username button
random_button = self.page.ele('xpath://button[@title="Generate random email address"]')
if random_button:
random_button.click()
time.sleep(2)
# Get the email address
email_element = self.page.ele('xpath://input[@id="email"]')
if email_element:
email = email_element.attr('value')
if email and '@' in email:
return email
return None
except Exception:
return None
def close(self):
"""关闭浏览器"""
if self.page: