Compare commits

...

3 Commits

Author SHA1 Message Date
yeongpin
637f923c16 change changelog 2025-02-13 11:42:48 +08:00
yeongpin
1cc93ffc22 fix & optimize 2025-02-13 11:33:20 +08:00
yeongpin
887239d80c change other mail site 2025-02-13 11:11:08 +08:00
15 changed files with 595 additions and 587 deletions

4
.env
View File

@@ -1,2 +1,2 @@
version=1.1.01
VERSION=1.1.01
version=1.2.01
VERSION=1.2.01

145
CHANGELOG.md Normal file
View File

@@ -0,0 +1,145 @@
# Change Log
## v1.2.01
1. Fix Cursor Cloudflare Human Verification Problem | 修復Cursor Cloudflare人機驗證問題
2. Change to automatic registration account | 全面改為自動註冊賬號
3. Change Mail Site | 改變郵箱網站
4. Fix Cursor Cloudflare Problem | 修復Cursor Cloudflare問題
## v1.1.01
<p align="center">
<img src="./images/cloudflare_2025-02-12_13-43-21.png" alt="free" width="400"/><br>
</p>
1. Hot Fix Cursor Cloudflare Problem | 修復Cursor Cloudflare問題
2. Fix Cursor Cloudflare Human Verification Problem | 修復Cursor Cloudflare人機驗證問題
3. Remake signup logic | 重做註冊邏輯
## v1.0.10
1. Hot Fix Mac Chrome Problem | 修復Mac Chrome問題
2. Fix Linux Start Donet Problem | 修復Linux啟動開發者問題
## v1.0.9
<p align="center">
<img src="./images/cloudflare_2025-02-12_13-43-21.png" alt="free" width="400"/><br>
</p>
1. Fixed New 0.45.x Version Reset Machine | 修復新0.45版本重置機器
2. Fix Locale Language | 修復多語言
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
4. Add Remake main.js | 重做main.js
## v1.0.8
1. Fix New 0.45 Version Reset Machine | 修復新0.45版本重置機器
2. Fix Locale Language | 修復多語言
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
## v1.0.7 - HotFix
1. Fix Reset Machine | 修復重置機器
2. Fix Locale Language | 修復多語言
## v1.0.7
1. Add Locale Language Support | 增加多語言支持
<p align="center">
<img src="./images/locale_2025-01-15_13-40-08.png" alt="locale" width="400"/><br>
</p>
## v1.0.6
1. Add Quit Cursor Option | 增加退出Cursor選項
2. Add Recaptcha Path Patch | 增加Recaptcha路徑修復
3. Fix Admin Permission | 修復管理員權限問題
4. Remove all need admin permission | 移除所有需要管理員權限
## v1.0.5 - HotFix
1. Fix: Mac Browser Control | 修復Mac瀏覽器控制問題
2. Fix: Verification Code Cant Patch | 修復驗證碼無法修復問題
3. Add Linux Support | 增加Linux支持
<p align="center">
<img src="./images/fix_2025-01-14_21-30-43.png" alt="fix" width="400"/><br>
</p>
## v1.0.5
1. Remove MachineID | 移除機器碼ID
2. Change to automatic registration account | 全面改為自動註冊賬號
3. Use your own exclusive new account | 使用自己獨享的新賬號
4. Fully automatic reset machine configuration | 全面自動化重置機器配置
<p align="center">
<img src="./images/pro_2025-01-14_14-40-37.png" alt="Why" width="400"/><br>
</p>
## v1.0.4
1. Fix: Cursor's configuration | 修復Cursor的配置問題
2. Fix Cloud Lame | 修復雲端慢速模式
## v1.0.3
1. Fix: Cursor's configuration | 修復Cursor的配置問題
2. Add Manual Reset Machine | 增加手動重置機器
3. Add CDN Cloud Control WatchDog | 增加CDN雲端控制WatchDog
4. Add Mac OS Support | 增加Mac OS支持
5. 759 ++ People use , but star only a few | 759 ++人使用,但只有幾個人點贊
<p align="center">
<img src="./images/what_2025-01-13_13-32-54.png" alt="Why" width="400"/><br>
</p>
## v1.0.2
1. Fix: Some known issues | 修復了一些已知問題
2. Add cloud control device code | 增加雲端控制設備碼
3. Cloud reset device code | 雲端重置設備碼
4. Remove official WatchDog monitoring | 移除官方WatchDog監控
5. Remove Proxy official prompt | 移除Proxy 官方提示
6. Fix: Too Many Computer | 修復Too Many Computer 問題
7. Fix Billing Issue | 修復計費問題
8. Fix: Cursor's configuration | 修復Cursor的配置問題
9. Fix cursor-slow mode | 修復cursor-slow模式
## v1.0.1
1. Fix: Reset machine ID | 修復了重置機器ID的問題
2. Fix: Bypass membership check | 修復了 繞過會員檢查的問題
3. Fix: Auto upgrade to "pro" membership | 修復了 自動升級為pro會員的問題
4. Fix: Real-time send Token request | 修復了 實時發送Token請求的問題
5. Fix: Reset Cursor's configuration | 修復了 重置Cursor的配置的問題
## v1.0
1. Preview Image | 預覽圖<br>
<p align="center">
<img src="./images/pro_2025-01-11_00-50-40.png" alt="Cursor Pro Logo" width="400"/><br>
</p>
<p align="center">
<img src="./images/pro_2025-01-11_00-51-07.png" alt="Cursor Pro Logo" width="400"/><br>
</p>
2. Add usage period,but can be contacted by leaving MachineID | 不得已才添加但可以通過留下MachineID 聯繫作者
<br>
<p align="center">
<img src="./images/pro_2025-01-11_16-24-03.png" alt="Cursor Pro Logo" width="400"/><br>
</p>

154
README.md
View File

@@ -13,7 +13,7 @@
</p>
<h4>Support Latest 0.45.11 Version | 支持最新0.45.11版本</h4>
This is a tool to automatically register (except for Google verification code), support Windows and macOS systems, complete Auth verification, and reset Cursor's configuration.
This is a tool to automatically register , support Windows and macOS systems, complete Auth verification, and reset Cursor's configuration.
這是一個自動化工具自動註冊除了Google驗證碼),支持 Windows 和 macOS 系統完成Auth驗證重置Cursor的配置。
@@ -21,169 +21,21 @@ This is a tool to automatically register (except for Google verification code),
<img src="./images/new107_2025-01-15_13-53-56.png" alt="new" width="400"/><br>
</p>
<br>
<p align="center">
<img src="./images/free_2025-01-14_14-59-15.png" alt="free" width="400"/><br>
</p>
##### ⚠️ Google Recaptcha need to be manually verified, don't be lazy, move your fingers, verify it, otherwise it will keep prompting you to verify ⚠️
##### If you dont have google chrome , you can download it from [here](https://www.google.com/intl/en_pk/chrome/)
##### ⚠️ 郵箱驗證 需要手動驗證,不要那麼懶,動一動手指,驗證一下,不然會一直提示你驗證 ⚠️
##### 如果沒有Google Chrome可以從[這裡](https://www.google.com/intl/en_pk/chrome/)下載
</p>
</div>
## 🔄 更新日志
<details open>
<summary>v1.1.01</summary>
<p align="center">
<img src="./images/cloudflare_2025-02-12_13-43-21.png" alt="free" width="400"/><br>
</p>
1. Hot Fix Cursor Cloudflare Problem | 修復Cursor Cloudflare問題
2. Fix Cursor Cloudflare Human Verification Problem | 修復Cursor Cloudflare人機驗證問題
3. Remake signup logic | 重做註冊邏輯
</details>
<details>
<summary>Other Version Change Log</summary>
<details>
<summary>v1.0.10</summary>
1. Hot Fix Mac Chrome Problem | 修復Mac Chrome問題
2. Fix Linux Start Donet Problem | 修復Linux啟動開發者問題
</details>
<details>
<summary>v1.0.9</summary>
<p align="center">
<img src="./images/cloudflare_2025-02-12_13-43-21.png.png" alt="free" width="400"/><br>
</p>
1. Fixed New 0.45.x Version Reset Machine | 修復新0.45版本重置機器
2. Fix Locale Language | 修復多語言
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
4. Add Remake main.js | 重做main.js
</details>
<details>
<summary>v1.0.8</summary>
1. Fix New 0.45 Version Reset Machine | 修復新0.45版本重置機器
2. Fix Locale Language | 修復多語言
3. Add Support Crypto Machine Regedit | 增加支持加密機器註冊
</details>
<details>
<summary>v1.0.7 - HotFix</summary>
1. Fix Reset Machine | 修復重置機器
2. Fix Locale Language | 修復多語言
</details>
<details>
<summary>v1.0.7</summary>
1. Add Locale Language Support | 增加多語言支持
<p align="center">
<img src="./images/locale_2025-01-15_13-40-08.png" alt="locale" width="400"/><br>
</p>
</details>
<details>
<summary>v1.0.6</summary>
1. Add Quit Cursor Option | 增加退出Cursor選項
2. Add Recaptcha Path Patch | 增加Recaptcha路徑修復
3. Fix Admin Permission | 修復管理員權限問題
4. Remove all need admin permission | 移除所有需要管理員權限
</details>
<details>
<summary>v1.0.5 - HotFix</summary>
1. Fix: Mac Browser Control | 修復Mac瀏覽器控制問題
2. Fix: Verification Code Cant Patch | 修復驗證碼無法修復問題
3. Add Linux Support | 增加Linux支持
<p align="center">
<img src="./images/fix_2025-01-14_21-30-43.png" alt="fix" width="400"/><br>
</p>
</details>
<details>
<summary>v1.0.5</summary>
1. Remove MachineID | 移除機器碼ID
2. Change to automatic registration account | 全面改為自動註冊賬號
3. Use your own exclusive new account | 使用自己獨享的新賬號
4. Fully automatic reset machine configuration | 全面自動化重置機器配置
<p align="center">
<img src="./images/pro_2025-01-14_14-40-37.png" alt="Why" width="400"/><br>
</p>
</details>
<details>
<summary>v1.0.4</summary>
1. Fix: Cursor's configuration | 修復Cursor的配置問題
2. Fix Cloud Lame | 修復雲端慢速模式
</details>
<details>
<summary>v1.0.3</summary>
1. Fix: Cursor's configuration | 修復Cursor的配置問題
2. Add Manual Reset Machine | 增加手動重置機器
3. Add CDN Cloud Control WatchDog | 增加CDN雲端控制WatchDog
4. Add Mac OS Support | 增加Mac OS支持
5. 759 ++ People use , but star only a few | 759 ++人使用,但只有幾個人點贊
<p align="center">
<img src="./images/what_2025-01-13_13-32-54.png" alt="Why" width="400"/><br>
</p>
</details>
<details>
<summary>v1.0.2</summary>
1. Fix: Some known issues | 修復了一些已知問題
2. Add cloud control device code | 增加雲端控制設備碼
3. Cloud reset device code | 雲端重置設備碼
4. Remove official WatchDog monitoring | 移除官方WatchDog監控
5. Remove Proxy official prompt | 移除Proxy 官方提示
6. Fix: Too Many Computer | 修復Too Many Computer 問題
7. Fix Billing Issue | 修復計費問題
8. Fix: Cursor's configuration | 修復Cursor的配置問題
9. Fix cursor-slow mode | 修復cursor-slow模式
</details>
<details>
<summary>v1.0.1</summary>
1. Fix: Reset machine ID | 修復了重置機器ID的問題
2. Fix: Bypass membership check | 修復了 繞過會員檢查的問題
3. Fix: Auto upgrade to "pro" membership | 修復了 自動升級為pro會員的問題
4. Fix: Real-time send Token request | 修復了 實時發送Token請求的問題
5. Fix: Reset Cursor's configuration | 修復了 重置Cursor的配置的問題
</details>
<details>
<summary>v1.0</summary>
1. Preview Image | 預覽圖<br>
<p align="center">
<img src="./images/pro_2025-01-11_00-50-40.png" alt="Cursor Pro Logo" width="400"/><br>
</p>
<p align="center">
<img src="./images/pro_2025-01-11_00-51-07.png" alt="Cursor Pro Logo" width="400"/><br>
</p>
2. Add usage period,but can be contacted by leaving MachineID | 不得已才添加但可以通過留下MachineID 聯繫作者
<br>
<p align="center">
<img src="./images/pro_2025-01-11_16-24-03.png" alt="Cursor Pro Logo" width="400"/><br>
</p>
</details>
</details>
## 🔄 Change Log | 更新日志
[Watch Change Log | 查看更新日志](CHANGELOG.md)
## ✨ Features | 功能特點
* Automatically register Cursor membership<br>自動註冊Cursor會員<br>
* Except for Google verification code<br>除了Google驗證碼<br>
* Support Windows and macOS systems<br>支持 Windows 和 macOS 系統<br>
* Complete Auth verification<br>完成Auth驗證<br>

View File

@@ -1,5 +0,0 @@
fr.nf
yopmail.com
1s.fr
xl.cx
fr.cr

View File

@@ -32,11 +32,6 @@ class BrowserManager:
extension_block_path = self.get_extension_block()
co.add_extension(extension_block_path)
co.set_argument("--allow-extensions-in-incognito")
extension_recaptcha_path = self.get_extension_recaptcha()
co.add_extension(extension_recaptcha_path)
co.set_argument("--allow-extensions-in-incognito")
except FileNotFoundError as e:
logging.warning(f"警告: {e}")
@@ -47,35 +42,6 @@ class BrowserManager:
# 基本设置
co.set_pref("credentials_enable_service", False)
co.set_pref("profile.password_manager_enabled", False)
# 禁用自动化标志
co.set_pref("useAutomationExtension", False)
co.set_pref("excludeSwitches", ["enable-automation"])
# WebGL 和 GPU 设置
co.set_pref("webgl.disabled", False)
co.set_pref("webgl.enable_webgl2", True)
# 设置语言和地区
co.set_pref("intl.accept_languages", "en-US,en")
# 基本命令行参数
co.set_argument("--disable-blink-features=AutomationControlled")
co.set_argument("--hide-crash-restore-bubble")
co.set_argument("--no-first-run")
co.set_argument("--no-default-browser-check")
co.set_argument("--disable-popup-blocking")
# 性能和稳定性参数
co.set_argument("--disable-dev-shm-usage")
co.set_argument("--disable-gpu")
co.set_argument("--no-sandbox")
co.set_argument("--ignore-certificate-errors")
# WebGL 相关参数
co.set_argument("--use-gl=swiftshader")
co.set_argument("--enable-webgl")
# 随机端口
co.auto_port()
@@ -87,7 +53,6 @@ class BrowserManager:
elif sys.platform == "win32": # Windows
co.set_argument("--disable-software-rasterizer")
# 设置窗口大小
window_width = random.randint(1024, 1920)
window_height = random.randint(768, 1080)
@@ -121,19 +86,6 @@ class BrowserManager:
return extension_path
def get_extension_recaptcha(self):
"""获取插件路径"""
root_dir = os.getcwd()
extension_path = os.path.join(root_dir, "recaptchaPatch")
if hasattr(sys, "_MEIPASS"):
extension_path = os.path.join(sys._MEIPASS, "recaptchaPatch")
if not os.path.exists(extension_path):
raise FileNotFoundError(f"插件不存在: {extension_path}")
return extension_path
def quit(self):
"""关闭浏览器"""
if self.browser:

View File

@@ -24,7 +24,6 @@ a = Analysis(
binaries=[],
datas=[
('turnstilePatch', 'turnstilePatch'),
('recaptchaPatch', 'recaptchaPatch'),
('uBlock0.chromium', 'uBlock0.chromium'),
('locales', 'locales'),
('cursor_auth.py', '.'),
@@ -32,8 +31,7 @@ a = Analysis(
('cursor_register.py', '.'),
('browser.py', '.'),
('control.py', '.'),
('.env', '.'),
('blacklist.txt', '.')
('.env', '.')
],
hiddenimports=[
'cursor_auth',

View File

@@ -58,97 +58,7 @@ class BrowserControl:
def get_current_tab(self):
"""获取当前标签页"""
return self.browser
def generate_new_email(self):
"""点击新的按钮生成新邮箱"""
try:
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.generate_email')}...{Style.RESET_ALL}")
new_button = self.browser.ele('xpath://button[contains(@class, "egenbut")]')
if new_button:
new_button.click()
time.sleep(1) # 等待生成
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.generate_email_success')}{Style.RESET_ALL}")
return True
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.generate_email_failed')}{Style.RESET_ALL}")
return False
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.browser_error', error=str(e))}{Style.RESET_ALL}")
return False
def select_email_domain(self, domain_index=None):
"""选择邮箱域名如果不指定index则随机选择"""
try:
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.select_email_domain')}...{Style.RESET_ALL}")
# 读取黑名单域名
blacklist = []
try:
with open('blacklist.txt', 'r', encoding='utf-8') as f:
blacklist = [line.strip().lower() for line in f if line.strip()]
except FileNotFoundError:
# 如果文件不存在,创建一个包含已知黑名单域名的文件
with open('blacklist.txt', 'w', encoding='utf-8') as f:
f.write("fr.nf\nyopmail.com\n1s.fr\nfr.cr")
blacklist = ["fr.nf", "yopmail.com", "1s.fr", "fr.cr"]
# 找到下拉框
select_element = self.browser.ele('xpath://select[@id="seldom"]')
if select_element:
# 获取所有选项
all_options = []
new_options = self.browser.eles('xpath://select[@id="seldom"]/optgroup[@label="-- 新的 --"]/option')
other_options = self.browser.eles('xpath://select[@id="seldom"]/optgroup[@label="-- 其他 --"]/option')
all_options.extend(new_options)
all_options.extend(other_options)
if all_options:
max_attempts = 5
attempt = 0
while attempt < max_attempts:
if domain_index is None:
domain_index = random.randint(0, len(all_options) - 1)
if domain_index < len(all_options):
selected_domain = all_options[domain_index].text.lower()
# 检查域名是否在黑名单中
is_blacklisted = False
for blocked_domain in blacklist:
if blocked_domain in selected_domain:
print(f"{Fore.YELLOW}{EMOJI['INFO']} {self.translator.get('control.blocked_domain', domain=blocked_domain)}{Style.RESET_ALL}")
domain_index = None
attempt += 1
is_blacklisted = True
break
if is_blacklisted:
continue
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.select_email_domain')}: {selected_domain}{Style.RESET_ALL}")
# 点击选择
all_options[domain_index].click()
time.sleep(1)
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.select_email_domain_success')}{Style.RESET_ALL}")
return True
attempt += 1
print(f"{Fore.RED}{EMOJI['ERROR']} 无法找到可用的域名{Style.RESET_ALL}")
return False
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_available_domain_options', count=len(all_options))}{Style.RESET_ALL}")
return False
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_domain_select_box')}{Style.RESET_ALL}")
return False
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.select_email_domain_failed', error=str(e))}{Style.RESET_ALL}")
return False
def wait_for_page_load(self, seconds=2):
"""等待页面加载"""
time.sleep(seconds)
@@ -164,80 +74,6 @@ class BrowserControl:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.browser_error', error=str(e))}{Style.RESET_ALL}")
return False
def copy_and_get_email(self):
"""获取邮箱地址"""
try:
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.generate_email')}...{Style.RESET_ALL}")
# 等待元素加载
time.sleep(1)
# 获取邮箱名称
try:
email_div = self.browser.ele('xpath://div[@class="segen"]//div[contains(@style, "color: #e5e5e5")]')
if email_div:
email_name = email_div.text.split()[0]
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.get_email_name')}: {email_name}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.get_email_name_failed')}{Style.RESET_ALL}")
return None
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.get_email_name_failed', error=str(e))}{Style.RESET_ALL}")
return None
# 直接使用上一步选择的域名
try:
domain = self.browser.ele('xpath://select[@id="seldom"]').value
if not domain: # 如果获取不到value尝试获取选中的选项文本
selected_option = self.browser.ele('xpath://select[@id="seldom"]/option[1]')
domain = selected_option.text if selected_option else "@yopmail.com" # 使用默认域名作为后备
except:
domain = "@yopmail.com" # 如果出错,使用默认域名
# 组合完整邮箱地址
full_email = f"{email_name}{domain}"
print(f"{Fore.GREEN}{EMOJI['MAIL']} {self.translator.get('control.get_email_address')}: {full_email}{Style.RESET_ALL}")
return full_email
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.get_email_address_failed', error=str(e))}{Style.RESET_ALL}")
return None
def view_mailbox(self):
"""点击查看邮箱按钮"""
try:
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.enter_mailbox')}...{Style.RESET_ALL}")
view_button = self.browser.ele('xpath://button[contains(@class, "egenbut") and contains(.//span, "查看邮箱")]')
if view_button:
view_button.click()
time.sleep(2) # 等待页面加载
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.enter_mailbox_success')}{Style.RESET_ALL}")
return True
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_view_mailbox_button')}{Style.RESET_ALL}")
return False
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.enter_mailbox_failed', error=str(e))}{Style.RESET_ALL}")
return False
def refresh_mailbox(self):
"""刷新邮箱获取最新信息"""
try:
print(f"{Fore.CYAN}{EMOJI['MAIL']} {self.translator.get('control.refresh_mailbox')}...{Style.RESET_ALL}")
refresh_button = self.browser.ele('xpath://button[@id="refresh"]')
if refresh_button:
refresh_button.click()
time.sleep(2) # 等待刷新完成
print(f"{Fore.GREEN}{EMOJI['SUCCESS']} {self.translator.get('control.refresh_mailbox_success')}{Style.RESET_ALL}")
return True
else:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.no_refresh_button')}{Style.RESET_ALL}")
return False
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('control.refresh_mailbox_failed', error=str(e))}{Style.RESET_ALL}")
return False
def get_verification_code(self):
"""从邮件中获取验证码"""
try:

View File

@@ -65,33 +65,26 @@ class CursorRegistration:
"""设置邮箱"""
try:
print(f"{Fore.CYAN}{EMOJI['START']} {self.translator.get('register.browser_start')}...{Style.RESET_ALL}")
self.browser = self.browser_manager.init_browser()
self.controller = BrowserControl(self.browser, self.translator)
# 打开邮箱生成器页面(第一个标签页)
self.controller.navigate_to(self.mail_url)
self.email_tab = self.browser # 保存邮箱标签页
self.controller.email_tab = self.email_tab # 同时保存到controller
# 使用 new_tempemail 创建临时邮箱,传入 translator
from new_tempemail import NewTempEmail
self.temp_email = NewTempEmail(self.translator) # 传入 translator
# 生成新邮箱
self.controller.generate_new_email()
# 创建临时邮箱
email_address = self.temp_email.create_email()
if not email_address:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.email_create_failed')}{Style.RESET_ALL}")
return False
# 选择随机域名
self.controller.select_email_domain()
# 保存邮箱地址和浏览器实例
self.email_address = email_address
self.email_tab = self.temp_email # 传递 NewTempEmail 实例而不是 page
self.controller = BrowserControl(self.temp_email.page, self.translator)
# 获取邮箱地址
self.email_address = self.controller.copy_and_get_email()
if self.email_address:
print(f"{EMOJI['MAIL']}{Fore.CYAN} {self.translator.get('register.get_email_address')}: {self.email_address}{Style.RESET_ALL}")
# 进入邮箱
if self.controller.view_mailbox():
return True
return False
return True
except Exception as e:
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.setup_error', error=str(e))}{Style.RESET_ALL}")
print(f"{Fore.RED}{EMOJI['ERROR']} {self.translator.get('register.email_setup_failed', error=str(e))}{Style.RESET_ALL}")
return False
def register_cursor(self):
@@ -233,8 +226,12 @@ class CursorRegistration:
return True
return False
finally:
if self.browser_manager:
self.browser_manager.quit()
# 关闭邮箱标签页
if hasattr(self, 'temp_email'):
try:
self.temp_email.close()
except:
pass
def update_cursor_auth(self, email=None, access_token=None, refresh_token=None):
"""更新Cursor的认证信息的便捷函数"""

View File

@@ -122,7 +122,8 @@
"save_account_info_failed": "Save Account Info Failed",
"get_email_address": "Get Email Address",
"update_cursor_auth_info": "Update Cursor Auth Info",
"register_process_error": "Register Process Error: {error}"
"register_process_error": "Register Process Error: {error}",
"setting_password": "Setting Password"
},
"auth": {
"title": "Cursor Auth Manager",
@@ -174,5 +175,23 @@
"database_updated_successfully": "Database Updated Successfully",
"database_connection_closed": "Database Connection Closed",
"no_valid_verification_code": "No Valid Verification Code"
},
"email": {
"starting_browser": "Starting Browser",
"visiting_site": "Visiting smailpro.com",
"create_success": "Email Created Successfully",
"create_failed": "Failed to Create Email",
"create_error": "Email Creation Error: {error}",
"refreshing": "Refreshing Email",
"refresh_success": "Email Refreshed Successfully",
"refresh_error": "Email Refresh Error: {error}",
"refresh_button_not_found": "Refresh Button Not Found",
"verification_found": "Verification Found",
"verification_not_found": "Verification Not Found",
"verification_error": "Verification Error: {error}",
"verification_code_found": "Verification Code Found",
"verification_code_not_found": "Verification Code Not Found",
"verification_code_error": "Verification Code Error: {error}",
"address": "Email Address"
}
}

View File

@@ -122,7 +122,8 @@
"save_account_info_failed": "保存账户信息失败",
"get_email_address": "获取邮箱地址",
"register_process_error": "注册流程错误: {error}",
"update_cursor_auth_info": "更新Cursor认证信息"
"update_cursor_auth_info": "更新Cursor认证信息",
"setting_password": "设置密码"
},
"auth": {
"title": "Cursor 认证管理器",
@@ -171,5 +172,23 @@
"get_cursor_session_token_failed": "获取Cursor Session Token失败",
"save_token_failed": "保存Token失败",
"no_valid_verification_code": "没有有效的验证码"
},
"email": {
"starting_browser": "启动浏览器",
"visiting_site": "访问 smailpro.com",
"create_success": "邮箱创建成功",
"create_failed": "邮箱创建失败",
"create_error": "邮箱创建错误: {error}",
"refreshing": "刷新邮箱",
"refresh_success": "邮箱刷新成功",
"refresh_error": "邮箱刷新错误: {error}",
"refresh_button_not_found": "未找到刷新按钮",
"verification_found": "找到验证码",
"verification_not_found": "未找到验证码",
"verification_error": "验证错误: {error}",
"verification_code_found": "找到验证码",
"verification_code_not_found": "未找到验证码",
"verification_code_error": "验证码错误: {error}",
"address": "邮箱地址"
}
}

View File

@@ -122,7 +122,8 @@
"save_account_info_failed": "保存賬戶信息失敗",
"get_email_address": "獲取郵箱地址",
"register_process_error": "註冊流程錯誤: {error}",
"update_cursor_auth_info": "更新Cursor認證信息"
"update_cursor_auth_info": "更新Cursor認證信息",
"setting_password": "設置密碼"
},
"auth": {
"title": "Cursor 認證管理器",
@@ -171,5 +172,24 @@
"save_token_failed": "保存Token失敗",
"blocked_domain": "被屏蔽的域名",
"no_valid_verification_code": "沒有有效的驗證碼"
}
},
"email": {
"starting_browser": "啟動瀏覽器",
"visiting_site": "訪問 smailpro.com",
"create_success": "郵箱創建成功",
"create_failed": "郵箱創建失敗",
"create_error": "郵箱創建錯誤: {error}",
"refreshing": "刷新郵箱",
"refresh_success": "郵箱刷新成功",
"refresh_error": "郵箱刷新錯誤: {error}",
"refresh_button_not_found": "未找到刷新按鈕",
"verification_found": "找到驗證碼",
"verification_not_found": "未找到驗證碼",
"verification_error": "驗證錯誤: {error}",
"verification_code_found": "找到驗證碼",
"verification_code_not_found": "未找到驗證碼",
"verification_code_error": "驗證碼錯誤: {error}",
"address": "郵箱地址"
}
}

View File

@@ -3,6 +3,7 @@ import time
import os
import signal
import random
from colorama import Fore, Style
# 在文件开头添加全局变量
_translator = None
@@ -19,7 +20,7 @@ def cleanup_chrome_processes(translator=None):
os.system('pkill -f chromedriver')
except Exception as e:
if translator:
print(f"{translator.get('register.cleanup_error', error=str(e))}")
print(f"{Fore.RED}{translator.get('register.cleanup_error', error=str(e))}{Style.RESET_ALL}")
else:
print(f"清理进程时出错: {e}")
@@ -27,7 +28,7 @@ def signal_handler(signum, frame):
"""处理Ctrl+C信号"""
global _translator
if _translator:
print(f"{_translator.get('register.exit_signal')}")
print(f"{Fore.CYAN}{_translator.get('register.exit_signal')}{Style.RESET_ALL}")
else:
print("\n接收到退出信号,正在关闭...")
cleanup_chrome_processes(_translator)
@@ -36,7 +37,7 @@ def signal_handler(signum, frame):
def simulate_human_input(page, url, translator=None):
"""访问网址"""
if translator:
print(f"{translator.get('register.visiting_url')}: {url}")
print(f"{Fore.CYAN}🚀 {translator.get('register.visiting_url')}: {url}{Style.RESET_ALL}")
else:
print("正在访问网址...")
@@ -52,7 +53,7 @@ def fill_signup_form(page, first_name, last_name, email, translator=None):
"""填写注册表单"""
try:
if translator:
print(f"{translator.get('register.filling_form')}")
print(f"{Fore.CYAN}📧 {translator.get('register.filling_form')}{Style.RESET_ALL}")
else:
print("\n正在填写注册表单...")
@@ -81,14 +82,14 @@ def fill_signup_form(page, first_name, last_name, email, translator=None):
time.sleep(random.uniform(2.0, 3.0))
if translator:
print(f"{translator.get('register.form_success')}")
print(f"{Fore.GREEN}{translator.get('register.form_success')}{Style.RESET_ALL}")
else:
print("表单填写完成")
return True
except Exception as e:
if translator:
print(f"{translator.get('register.form_error', error=str(e))}")
print(f"{Fore.RED}{translator.get('register.form_error', error=str(e))}{Style.RESET_ALL}")
else:
print(f"填写表单时出错: {e}")
return False
@@ -103,7 +104,7 @@ def setup_driver(translator=None):
# 设置随机端口
co.auto_port()
# 使用有头模式
# 使用有头模式(一定要设置为False模擬人類操作)
co.headless(False)
try:
@@ -114,12 +115,12 @@ def setup_driver(translator=None):
co.add_extension(extension_path)
except Exception as e:
if translator:
print(f"{translator.get('register.extension_load_error', error=str(e))}")
print(f"{Fore.RED}{translator.get('register.extension_load_error', error=str(e))}{Style.RESET_ALL}")
else:
print(f"加载插件失败: {e}")
if translator:
print(f"{translator.get('register.starting_browser')}")
print(f"{Fore.CYAN}🚀 {translator.get('register.starting_browser')}{Style.RESET_ALL}")
else:
print("正在启动浏览器...")
page = ChromiumPage(co)
@@ -130,7 +131,7 @@ def handle_turnstile(page, translator=None):
"""处理 Turnstile 验证"""
try:
if translator:
print(f"{translator.get('register.handling_turnstile')}")
print(f"{Fore.CYAN}🔄 {translator.get('register.handling_turnstile')}{Style.RESET_ALL}")
else:
print("\n正在处理 Turnstile 验证...")
@@ -140,7 +141,7 @@ def handle_turnstile(page, translator=None):
while retry_count < max_retries:
retry_count += 1
if translator:
print(f"{translator.get('register.retry_verification', attempt=retry_count)}")
print(f"{Fore.CYAN}🔄 {translator.get('register.retry_verification', attempt=retry_count)}{Style.RESET_ALL}")
else:
print(f"{retry_count} 次尝试验证...")
@@ -160,7 +161,7 @@ def handle_turnstile(page, translator=None):
if challenge_check:
if translator:
print(f"{translator.get('register.detect_turnstile')}")
print(f"{Fore.CYAN}🔄 {translator.get('register.detect_turnstile')}{Style.RESET_ALL}")
else:
print("检测到验证框...")
@@ -172,21 +173,21 @@ def handle_turnstile(page, translator=None):
# 检查验证结果
if check_verification_success(page, translator):
if translator:
print(f"{translator.get('register.verification_success')}")
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("验证通过!")
return True
except Exception as e:
if translator:
print(f"{translator.get('register.verification_failed')}")
print(f"{Fore.RED}{translator.get('register.verification_failed')}{Style.RESET_ALL}")
else:
print(f"验证尝试失败: {e}")
# 检查是否已经验证成功
if check_verification_success(page, translator):
if translator:
print(f"{translator.get('register.verification_success')}")
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("验证通过!")
return True
@@ -194,14 +195,14 @@ def handle_turnstile(page, translator=None):
time.sleep(random.uniform(1, 2))
if translator:
print(f"{translator.get('register.verification_failed')}")
print(f"{Fore.RED}{translator.get('register.verification_failed')}{Style.RESET_ALL}")
else:
print("超出最大重试次数")
return False
except Exception as e:
if translator:
print(f"{translator.get('register.verification_error', error=str(e))}")
print(f"{Fore.RED}{translator.get('register.verification_error', error=str(e))}{Style.RESET_ALL}")
else:
print(f"验证过程出错: {e}")
return False
@@ -239,7 +240,10 @@ def generate_password(length=12):
def fill_password(page, password, translator=None):
"""填写密码"""
try:
print("\n正在设置密码...")
if translator:
print(f"{Fore.CYAN}🔑 {translator.get('register.setting_password')}{Style.RESET_ALL}")
else:
print("\n正在设置密码...")
password_input = page.ele("@name=password")
if password_input:
password_input.input(password)
@@ -251,14 +255,14 @@ def fill_password(page, password, translator=None):
time.sleep(random.uniform(2.0, 3.0))
if translator:
print(f"{translator.get('register.password_success')}")
print(f"{Fore.GREEN}{translator.get('register.password_success')}{Style.RESET_ALL}")
else:
print(f"密码设置完成: {password}")
return True
except Exception as e:
if translator:
print(f"{translator.get('register.password_error', error=str(e))}")
print(f"{Fore.RED}{translator.get('register.password_error', error=str(e))}{Style.RESET_ALL}")
else:
print(f"设置密码时出错: {e}")
return False
@@ -267,13 +271,54 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
"""处理验证码"""
try:
if translator:
print(f"\n{translator.get('register.waiting_for_verification_code')}")
print(f"\n{Fore.CYAN}{translator.get('register.waiting_for_verification_code')}{Style.RESET_ALL}")
else:
print("\n等待并获取验证码...")
# 添加调试信息
print(f"\n{Fore.CYAN}DEBUG: email_tab exists: {email_tab is not None}{Style.RESET_ALL}")
time.sleep(5) # 等待验证码邮件
# 刷新邮箱页面
email_tab.refresh()
# 使用已有的 email_tab 刷新邮箱
email_tab.refresh_inbox()
time.sleep(3)
# 检查邮箱是否有验证码邮件
if email_tab.check_for_cursor_email():
verification_code = email_tab.get_verification_code()
if verification_code:
# 在注册页面填写验证码
for i, digit in enumerate(verification_code):
browser_tab.ele(f"@data-index={i}").input(digit)
time.sleep(random.uniform(0.1, 0.3))
if translator:
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("验证码填写完成")
time.sleep(3)
# 处理最后一次 Turnstile 验证
if handle_turnstile(browser_tab, translator):
if translator:
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("最后一次验证通过!")
time.sleep(2)
# 访问设置页面
if translator:
print(f"{Fore.CYAN}🔑 {translator.get('register.visiting_url')}: https://www.cursor.com/settings{Style.RESET_ALL}")
else:
print("访问设置页面...")
browser_tab.get("https://www.cursor.com/settings")
time.sleep(3) # 等待页面加载
return True
else:
print("最后一次验证失败")
return False
return False
# 获取验证码,设置超时
verification_code = None
@@ -283,7 +328,7 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
timeout = 160
if translator:
print(f"\n{translator.get('register.start_getting_verification_code')}")
print(f"{Fore.CYAN}{translator.get('register.start_getting_verification_code')}{Style.RESET_ALL}")
else:
print("开始获取验证码...")
@@ -291,7 +336,7 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
# 检查是否超时
if time.time() - start_time > timeout:
if translator:
print(f"{translator.get('register.verification_timeout')}")
print(f"{Fore.RED}{translator.get('register.verification_timeout')}{Style.RESET_ALL}")
else:
print("获取验证码超时...")
break
@@ -299,19 +344,19 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
verification_code = controller.get_verification_code()
if verification_code:
if translator:
print(f"{translator.get('register.verification_success')}")
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print(f"成功获取验证码: {verification_code}")
break
remaining_time = int(timeout - (time.time() - start_time))
if translator:
print(f"{translator.get('register.try_get_code', attempt=attempt + 1, time=remaining_time)}")
print(f"{Fore.CYAN}{translator.get('register.try_get_code', attempt=attempt + 1, time=remaining_time)}{Style.RESET_ALL}")
else:
print(f"{attempt + 1} 次尝试获取验证码,剩余时间: {remaining_time}秒...")
# 刷新邮箱
email_tab.refresh()
email_tab.refresh_inbox()
time.sleep(retry_interval)
if verification_code:
@@ -321,7 +366,7 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
time.sleep(random.uniform(0.1, 0.3))
if translator:
print(f"{translator.get('register.verification_success')}")
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("验证码填写完成")
time.sleep(3)
@@ -329,14 +374,14 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
# 处理最后一次 Turnstile 验证
if handle_turnstile(browser_tab, translator):
if translator:
print(f"{translator.get('register.verification_success')}")
print(f"{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("最后一次验证通过!")
time.sleep(2)
# 直接访问设置页面
if translator:
print(f"{translator.get('register.visiting_url')}: https://www.cursor.com/settings")
print(f"{Fore.CYAN}{translator.get('register.visiting_url')}: https://www.cursor.com/settings{Style.RESET_ALL}")
else:
print("访问设置页面...")
browser_tab.get("https://www.cursor.com/settings")
@@ -347,7 +392,7 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
else:
if translator:
print(f"{translator.get('register.verification_failed')}")
print(f"{Fore.RED}{translator.get('register.verification_failed')}{Style.RESET_ALL}")
else:
print("最后一次验证失败")
return False
@@ -356,11 +401,60 @@ def handle_verification_code(browser_tab, email_tab, controller, email, password
except Exception as e:
if translator:
print(f"{translator.get('register.verification_error', error=str(e))}")
print(f"{Fore.RED}{translator.get('register.verification_error', error=str(e))}{Style.RESET_ALL}")
else:
print(f"处理验证码时出错: {e}")
return False
def handle_sign_in(browser_tab, email, password, translator=None):
"""处理登录流程"""
try:
# 检查是否在登录页面
sign_in_header = browser_tab.ele('xpath://h1[contains(text(), "Sign in")]')
if not sign_in_header:
return True # 如果不是登录页面,说明已经登录成功
print(f"{Fore.CYAN}检测到登录页面,开始登录...{Style.RESET_ALL}")
# 填写邮箱
email_input = browser_tab.ele('@name=email')
if email_input:
email_input.input(email)
time.sleep(1)
# 点击 Continue
continue_button = browser_tab.ele('xpath://button[contains(@class, "BrandedButton") and text()="Continue"]')
if continue_button:
continue_button.click()
time.sleep(2)
# 处理 Turnstile 验证
if handle_turnstile(browser_tab, translator):
# 填写密码
password_input = browser_tab.ele('@name=password')
if password_input:
password_input.input(password)
time.sleep(1)
# 点击 Sign in
sign_in_button = browser_tab.ele('xpath://button[@name="intent" and @value="password"]')
if sign_in_button:
sign_in_button.click()
time.sleep(2)
# 处理最后一次 Turnstile 验证
if handle_turnstile(browser_tab, translator):
print(f"{Fore.GREEN}登录成功!{Style.RESET_ALL}")
time.sleep(3)
return True
print(f"{Fore.RED}登录失败{Style.RESET_ALL}")
return False
except Exception as e:
print(f"{Fore.RED}登录过程出错: {str(e)}{Style.RESET_ALL}")
return False
def main(email=None, password=None, first_name=None, last_name=None, email_tab=None, controller=None, translator=None):
"""主函数,可以接收账号信息、邮箱标签页和翻译器"""
global _translator
@@ -374,21 +468,21 @@ def main(email=None, password=None, first_name=None, last_name=None, email_tab=N
try:
page = setup_driver(translator)
if translator:
print(f"{translator.get('register.browser_started')}")
print(f"{Fore.CYAN}🚀 {translator.get('register.browser_started')}{Style.RESET_ALL}")
else:
print("浏览器已启动")
# 访问注册页面
url = "https://authenticator.cursor.sh/sign-up"
if translator:
print(f"\n{translator.get('register.visiting_url')}: {url}")
print(f"\n{Fore.CYAN}{translator.get('register.visiting_url')}: {url}{Style.RESET_ALL}")
else:
print(f"\n正在访问: {url}")
# 访问页面
simulate_human_input(page, url, translator)
if translator:
print(f"{translator.get('register.waiting_for_page_load')}")
print(f"{Fore.CYAN}{translator.get('register.waiting_for_page_load')}{Style.RESET_ALL}")
else:
print("等待页面加载...")
time.sleep(5)
@@ -410,21 +504,21 @@ def main(email=None, password=None, first_name=None, last_name=None, email_tab=N
# 填写表单
if fill_signup_form(page, first_name, last_name, email, translator):
if translator:
print(f"\n{translator.get('register.form_submitted')}")
print(f"\n{Fore.GREEN}{translator.get('register.form_submitted')}{Style.RESET_ALL}")
else:
print("\n表单已提交,开始验证...")
# 处理第一次 Turnstile 验证
if handle_turnstile(page, translator):
if translator:
print(f"\n{translator.get('register.first_verification_passed')}")
print(f"\n{Fore.GREEN}{translator.get('register.first_verification_passed')}{Style.RESET_ALL}")
else:
print("\n第一阶段验证通过!")
# 填写密码
if fill_password(page, password, translator):
if translator:
print(f"\n{translator.get('register.waiting_for_second_verification')}")
print(f"\n{Fore.CYAN}{translator.get('register.waiting_for_second_verification')}{Style.RESET_ALL}")
else:
print("\n等待第二次验证...")
time.sleep(2)
@@ -432,12 +526,12 @@ def main(email=None, password=None, first_name=None, last_name=None, email_tab=N
# 处理第二次 Turnstile 验证
if handle_turnstile(page, translator):
if translator:
print(f"\n{translator.get('register.waiting_for_verification_code')}")
print(f"\n{Fore.CYAN}{translator.get('register.waiting_for_verification_code')}{Style.RESET_ALL}")
else:
print("\n开始处理验证码...")
if handle_verification_code(page, email_tab, controller, email, password, translator):
if translator:
print(f"\n{translator.get('register.verification_success')}")
print(f"\n{Fore.GREEN}{translator.get('register.verification_success')}{Style.RESET_ALL}")
else:
print("\n注册流程完成!")
success = True

226
new_tempemail.py Normal file
View File

@@ -0,0 +1,226 @@
from DrissionPage import ChromiumPage, ChromiumOptions
import time
import os
import sys
from colorama import Fore, Style, init
# 初始化 colorama
init()
class NewTempEmail:
def __init__(self, translator=None):
self.translator = translator
self.page = None
self.setup_browser()
def get_extension_block(self):
"""获取插件路径"""
root_dir = os.getcwd()
extension_path = os.path.join(root_dir, "uBlock0.chromium")
if hasattr(sys, "_MEIPASS"):
extension_path = os.path.join(sys._MEIPASS, "uBlock0.chromium")
if not os.path.exists(extension_path):
raise FileNotFoundError(f"插件不存在: {extension_path}")
return extension_path
def setup_browser(self):
"""设置浏览器"""
try:
if self.translator:
print(f"{Fore.CYAN} {self.translator.get('email.starting_browser')}{Style.RESET_ALL}")
else:
print(f"{Fore.CYAN} 正在启动浏览器...{Style.RESET_ALL}")
# 创建浏览器选项
co = ChromiumOptions()
co.set_argument("--headless=new")
co.auto_port() # 自动设置端口
# 加载 uBlock 插件
try:
extension_path = self.get_extension_block()
co.set_argument("--allow-extensions-in-incognito")
co.add_extension(extension_path)
except Exception as e:
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.extension_load_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 加载插件失败: {str(e)}{Style.RESET_ALL}")
self.page = ChromiumPage(co)
return True
except Exception as e:
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.browser_start_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 启动浏览器失败: {str(e)}{Style.RESET_ALL}")
return False
def create_email(self):
"""创建临时邮箱"""
try:
if self.translator:
print(f"{Fore.CYAN} {self.translator.get('email.visiting_site')}{Style.RESET_ALL}")
else:
print(f"{Fore.CYAN} 正在访问 smailpro.com...{Style.RESET_ALL}")
# 访问网站
self.page.get("https://smailpro.com/")
time.sleep(2)
# 点击创建邮箱按钮
create_button = self.page.ele('xpath://button[@title="Create temporary email"]')
if create_button:
create_button.click()
time.sleep(1)
# 点击弹窗中的 Create 按钮
modal_create_button = self.page.ele('xpath://button[contains(text(), "Create")]')
if modal_create_button:
modal_create_button.click()
time.sleep(2)
# 获取邮箱地址 - 修改选择器
email_div = self.page.ele('xpath://div[@class="text-base sm:text-lg md:text-xl text-gray-700"]')
if email_div:
email = email_div.text.strip()
if '@' in email: # 验证是否是有效的邮箱地址
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
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.create_failed')}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 创建邮箱失败{Style.RESET_ALL}")
return None
except Exception as e:
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.create_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 创建邮箱出错: {str(e)}{Style.RESET_ALL}")
return None
def close(self):
"""关闭浏览器"""
if self.page:
self.page.quit()
def refresh_inbox(self):
"""刷新邮箱"""
try:
if self.translator:
print(f"{Fore.CYAN}🔄 {self.translator.get('email.refreshing')}{Style.RESET_ALL}")
else:
print(f"{Fore.CYAN}🔄 正在刷新邮箱...{Style.RESET_ALL}")
# 点击刷新按钮
refresh_button = self.page.ele('xpath://button[@id="refresh"]')
if refresh_button:
refresh_button.click()
time.sleep(2) # 等待刷新完成
if self.translator:
print(f"{Fore.GREEN}{self.translator.get('email.refresh_success')}{Style.RESET_ALL}")
else:
print(f"{Fore.GREEN}✅ 邮箱刷新成功{Style.RESET_ALL}")
return True
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.refresh_button_not_found')}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 未找到刷新按钮{Style.RESET_ALL}")
return False
except Exception as e:
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.refresh_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 刷新邮箱出错: {str(e)}{Style.RESET_ALL}")
return False
def check_for_cursor_email(self):
"""检查是否有 Cursor 的验证邮件"""
try:
# 查找验证邮件 - 使用更精确的选择器
email_div = self.page.ele('xpath://div[contains(@class, "p-2") and contains(@class, "cursor-pointer") and contains(@class, "bg-white") and contains(@class, "shadow") and .//b[text()="no-reply@cursor.sh"] and .//span[text()="Verify your email address"]]')
if email_div:
if self.translator:
print(f"{Fore.GREEN}{self.translator.get('email.verification_found')}{Style.RESET_ALL}")
else:
print(f"{Fore.GREEN}✅ 找到验证邮件{Style.RESET_ALL}")
# 使用 JavaScript 点击元素
self.page.run_js('arguments[0].click()', email_div)
time.sleep(2) # 等待邮件内容加载
return True
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.verification_not_found')}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 未找到验证邮件{Style.RESET_ALL}")
return False
except Exception as e:
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.verification_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 检查验证邮件出错: {str(e)}{Style.RESET_ALL}")
return False
def get_verification_code(self):
"""获取验证码"""
try:
# 查找验证码元素
code_element = self.page.ele('xpath://td//div[contains(@style, "font-size:28px") and contains(@style, "letter-spacing:2px")]')
if code_element:
code = code_element.text.strip()
if code.isdigit() and len(code) == 6:
if self.translator:
print(f"{Fore.GREEN}{self.translator.get('email.verification_code_found')}: {code}{Style.RESET_ALL}")
else:
print(f"{Fore.GREEN}✅ 获取验证码成功: {code}{Style.RESET_ALL}")
return code
if self.translator:
print(f"{Fore.YELLOW}⚠️ {self.translator.get('email.verification_code_not_found')}{Style.RESET_ALL}")
else:
print(f"{Fore.YELLOW}⚠️ 未找到有效的验证码{Style.RESET_ALL}")
return None
except Exception as e:
if self.translator:
print(f"{Fore.RED}{self.translator.get('email.verification_code_error')}: {str(e)}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}❌ 获取验证码出错: {str(e)}{Style.RESET_ALL}")
return None
def main(translator=None):
temp_email = NewTempEmail(translator)
try:
email = temp_email.create_email()
if email:
if translator:
print(f"\n{Fore.CYAN}📧 {translator.get('email.address')}: {email}{Style.RESET_ALL}")
else:
print(f"\n{Fore.CYAN}📧 临时邮箱地址: {email}{Style.RESET_ALL}")
# 测试刷新功能
while True:
if translator:
choice = input(f"\n{translator.get('email.refresh_prompt')}: ").lower()
else:
choice = input("\n按 R 刷新邮箱,按 Q 退出: ").lower()
if choice == 'r':
temp_email.refresh_inbox()
elif choice == 'q':
break
finally:
temp_email.close()
if __name__ == "__main__":
main()

View File

@@ -1,22 +0,0 @@
{
"manifest_version": 3,
"name": "Recaptcha Blocker",
"version": "1.0",
"description": "Blocks reCAPTCHA from loading",
"content_scripts": [
{
"matches": ["*://yopmail.com/zh/wm*"],
"js": ["script.js"],
"run_at": "document_start",
"all_frames": true
}
],
"permissions": [
"webNavigation",
"activeTab"
],
"host_permissions": [
"*://yopmail.com/*",
"*://*.google.com/*"
]
}

View File

@@ -1,123 +0,0 @@
// Debug logging function
function log(message) {
console.log(`[reCAPTCHA Bypass] ${new Date().toISOString()}: ${message}`);
}
// Function to get element by selector
function qSelector(selector) {
return document.querySelector(selector);
}
// Constants
const MAX_ATTEMPTS = 1;
const SELECTORS = {
CHECK_BOX: ".recaptcha-checkbox-border",
AUDIO_BUTTON: "#recaptcha-audio-button",
PLAY_BUTTON: ".rc-audiochallenge-play-button .rc-button-default",
AUDIO_SOURCE: "#audio-source",
IMAGE_SELECT: "#rc-imageselect",
RESPONSE_FIELD: ".rc-audiochallenge-response-field",
AUDIO_ERROR_MESSAGE: ".rc-audiochallenge-error-message",
AUDIO_RESPONSE: "#audio-response",
RELOAD_BUTTON: "#recaptcha-reload-button",
RECAPTCHA_STATUS: "#recaptcha-accessible-status",
DOSCAPTCHA: ".rc-doscaptcha-body",
VERIFY_BUTTON: "#recaptcha-verify-button"
};
// Function to check if element is hidden
function isHidden(el) {
return (el.offsetParent === null);
}
// Function to handle the bypass process
async function bypassRecaptcha() {
try {
log('Starting bypass process...');
log('Waiting 3 seconds before starting...');
await new Promise(resolve => setTimeout(resolve, 3000));
let solved = false;
let checkBoxClicked = false;
let requestCount = 0;
const recaptchaInitialStatus = qSelector(SELECTORS.RECAPTCHA_STATUS) ?
qSelector(SELECTORS.RECAPTCHA_STATUS).innerText : "";
log('Initial reCAPTCHA status: ' + recaptchaInitialStatus);
// Main bypass logic
try {
if (!checkBoxClicked && qSelector(SELECTORS.CHECK_BOX) &&
!isHidden(qSelector(SELECTORS.CHECK_BOX))) {
log('Clicking checkbox...');
qSelector(SELECTORS.CHECK_BOX).click();
checkBoxClicked = true;
}
// Check if the captcha is solved
if (qSelector(SELECTORS.RECAPTCHA_STATUS) &&
(qSelector(SELECTORS.RECAPTCHA_STATUS).innerText != recaptchaInitialStatus)) {
solved = true;
log('SOLVED!');
}
if (requestCount > MAX_ATTEMPTS) {
log('Attempted Max Retries. Stopping the solver');
solved = true;
}
// Stop solving when Automated queries message is shown
if (qSelector(SELECTORS.DOSCAPTCHA) &&
qSelector(SELECTORS.DOSCAPTCHA).innerText.length > 0) {
log('Automated Queries Detected');
}
} catch (err) {
log(`Error in main bypass logic: ${err.message}`);
}
log('Bypass process completed');
// If not solved, retry after delay
if (!solved && requestCount < MAX_ATTEMPTS) {
requestCount++;
log(`Retrying... Attempt ${requestCount} of ${MAX_ATTEMPTS}`);
setTimeout(bypassRecaptcha, 2000);
}
} catch (e) {
log(`Bypass failed: ${e.message}`);
}
}
// Create a MutationObserver to watch for reCAPTCHA elements
log('Setting up MutationObserver...');
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.nodeType === 1 && // Element node
((node.tagName === 'SCRIPT' && node.src && node.src.includes('recaptcha')) ||
(node.tagName === 'IFRAME' && node.src && node.src.includes('recaptcha')))) {
log(`Detected new reCAPTCHA element: ${node.tagName} - ${node.src}`);
bypassRecaptcha();
}
});
});
});
// Start observing
observer.observe(document, {
childList: true,
subtree: true
});
log('MutationObserver started');
// Run on page load
if (document.readyState === 'loading') {
log('Document still loading, waiting for DOMContentLoaded');
document.addEventListener('DOMContentLoaded', bypassRecaptcha);
} else {
log('Document already loaded, starting bypass process');
bypassRecaptcha();
}