mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-03 04:57:36 +08:00
Merge pull request #348 from BasaiCorp/main
Comprehensive Enhancements to Cursor AI Reset and Registration Automation Scripts
This commit is contained in:
commit
225a24aad5
@ -8,29 +8,44 @@ import requests
|
|||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.chrome.service import Service
|
from selenium.webdriver.chrome.service import Service
|
||||||
from webdriver_manager.chrome import ChromeDriverManager
|
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
|
from selenium.webdriver.support.ui import WebDriverWait
|
||||||
|
from selenium.webdriver.support import expected_conditions as EC
|
||||||
|
from webdriver_manager.chrome import ChromeDriverManager
|
||||||
|
import logging
|
||||||
|
|
||||||
|
# Set up logging
|
||||||
|
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
|
||||||
|
|
||||||
def generate_temp_email():
|
def generate_temp_email():
|
||||||
"""Generates a temporary email and returns the email and inbox ID."""
|
"""Generates a temporary email using 1secmail API."""
|
||||||
response = requests.get("https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1")
|
try:
|
||||||
email = response.json()[0]
|
response = requests.get("https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1")
|
||||||
print(f"✅ Generated temp email: {email}")
|
response.raise_for_status()
|
||||||
return email
|
email = response.json()[0]
|
||||||
|
logging.info(f"Generated temp email: {email}")
|
||||||
|
return email
|
||||||
|
except requests.RequestException as e:
|
||||||
|
logging.error(f"Failed to generate temp email: {e}")
|
||||||
|
raise
|
||||||
|
|
||||||
def extract_inbox(email, retries=5):
|
def extract_inbox(email, retries=5, wait_time=10):
|
||||||
"""Extracts the inbox for the temp email with retries."""
|
"""Extracts the inbox for the temp email with retries."""
|
||||||
domain = email.split('@')[1]
|
domain = email.split('@')[1]
|
||||||
login = email.split('@')[0]
|
login = email.split('@')[0]
|
||||||
inbox_url = f"https://www.1secmail.com/api/v1/?action=getMessages&login={login}&domain={domain}"
|
inbox_url = f"https://www.1secmail.com/api/v1/?action=getMessages&login={login}&domain={domain}"
|
||||||
|
|
||||||
for attempt in range(retries):
|
for attempt in range(retries):
|
||||||
time.sleep(10) # Allow email to arrive
|
time.sleep(wait_time)
|
||||||
messages = requests.get(inbox_url).json()
|
try:
|
||||||
if messages:
|
messages = requests.get(inbox_url).json()
|
||||||
print(f"✅ Inbox found on attempt {attempt + 1}")
|
if messages:
|
||||||
return messages[0]['id']
|
logging.info(f"Inbox found on attempt {attempt + 1}: {messages[0]['id']}")
|
||||||
print(f"🔄 Retry {attempt + 1}/{retries}: No email yet...")
|
return messages[0]['id']
|
||||||
|
logging.info(f"Retry {attempt + 1}/{retries}: No email yet...")
|
||||||
|
except requests.RequestException as e:
|
||||||
|
logging.error(f"Error fetching inbox: {e}")
|
||||||
|
logging.warning("No messages found after retries.")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_verification_link(email, message_id):
|
def get_verification_link(email, message_id):
|
||||||
@ -38,21 +53,35 @@ def get_verification_link(email, message_id):
|
|||||||
domain = email.split('@')[1]
|
domain = email.split('@')[1]
|
||||||
login = email.split('@')[0]
|
login = email.split('@')[0]
|
||||||
msg_url = f"https://www.1secmail.com/api/v1/?action=readMessage&login={login}&domain={domain}&id={message_id}"
|
msg_url = f"https://www.1secmail.com/api/v1/?action=readMessage&login={login}&domain={domain}&id={message_id}"
|
||||||
message = requests.get(msg_url).json()
|
try:
|
||||||
for line in message['body'].splitlines():
|
message = requests.get(msg_url).json()
|
||||||
if "https://github.com/" in line:
|
for line in message['body'].splitlines():
|
||||||
print(f"✅ Verification link found: {line}")
|
if "https://github.com/" in line:
|
||||||
return line.strip()
|
logging.info(f"Verification link found: {line}")
|
||||||
return None
|
return line.strip()
|
||||||
|
logging.warning("Verification link not found in email.")
|
||||||
|
return None
|
||||||
|
except requests.RequestException as e:
|
||||||
|
logging.error(f"Failed to fetch email message: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
def reset_machine_id():
|
def reset_machine_id():
|
||||||
"""Resets the machine ID to bypass Cursor AI's free trial detection."""
|
"""Resets the machine ID to bypass trial detection."""
|
||||||
new_id = str(uuid.uuid4())
|
new_id = str(uuid.uuid4())
|
||||||
if os.name == 'nt': # Windows
|
try:
|
||||||
os.system(f'reg add "HKLM\SOFTWARE\Microsoft\Cryptography" /v MachineGuid /d {new_id} /f')
|
if os.name == 'nt': # Windows
|
||||||
else: # Linux/macOS
|
os.system(f'reg add "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid /d {new_id} /f')
|
||||||
os.system(f'echo {new_id} | sudo tee /etc/machine-id')
|
logging.info(f"Machine ID reset on Windows: {new_id}")
|
||||||
print(f"✅ Machine ID reset: {new_id}")
|
elif os.name == 'posix': # Linux/macOS
|
||||||
|
if os.path.exists("/etc/machine-id"):
|
||||||
|
os.system(f'echo {new_id} | sudo tee /etc/machine-id')
|
||||||
|
logging.info(f"Machine ID reset on Linux: {new_id}")
|
||||||
|
else:
|
||||||
|
logging.info("Machine ID reset skipped (macOS or no /etc/machine-id)")
|
||||||
|
else:
|
||||||
|
logging.warning("Unsupported OS for machine ID reset.")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Failed to reset machine ID: {e}")
|
||||||
|
|
||||||
def register_github(email):
|
def register_github(email):
|
||||||
"""Automates GitHub registration with temp email."""
|
"""Automates GitHub registration with temp email."""
|
||||||
@ -60,76 +89,157 @@ def register_github(email):
|
|||||||
options.add_argument('--headless')
|
options.add_argument('--headless')
|
||||||
options.add_argument('--no-sandbox')
|
options.add_argument('--no-sandbox')
|
||||||
options.add_argument('--disable-dev-shm-usage')
|
options.add_argument('--disable-dev-shm-usage')
|
||||||
|
|
||||||
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
|
|
||||||
driver.get("https://github.com/join")
|
|
||||||
|
|
||||||
# Fill in the registration form
|
|
||||||
username = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
|
|
||||||
password = ''.join(random.choices(string.ascii_letters + string.digits, k=15))
|
|
||||||
|
|
||||||
driver.find_element(By.ID, "user_login").send_keys(username)
|
|
||||||
driver.find_element(By.ID, "user_email").send_keys(email)
|
|
||||||
driver.find_element(By.ID, "user_password").send_keys(password)
|
|
||||||
driver.find_element(By.ID, "signup_button").click()
|
|
||||||
|
|
||||||
time.sleep(5)
|
driver = None
|
||||||
driver.quit()
|
try:
|
||||||
|
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
|
||||||
|
driver.get("https://github.com/join")
|
||||||
|
|
||||||
print(f"✅ GitHub account created: {username} | {email}")
|
# Generate random credentials
|
||||||
return username, password
|
username = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
|
||||||
|
password = ''.join(random.choices(string.ascii_letters + string.digits, k=15))
|
||||||
|
|
||||||
def register_cursor_with_github(driver):
|
# Fill in the registration form
|
||||||
|
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "user_login")))
|
||||||
|
driver.find_element(By.ID, "user_login").send_keys(username)
|
||||||
|
driver.find_element(By.ID, "user_email").send_keys(email)
|
||||||
|
driver.find_element(By.ID, "user_password").send_keys(password)
|
||||||
|
driver.find_element(By.ID, "signup_button").click()
|
||||||
|
|
||||||
|
# Wait for page transition (GitHub might redirect or show CAPTCHA)
|
||||||
|
time.sleep(5)
|
||||||
|
logging.info(f"GitHub account created: {username} | {email}")
|
||||||
|
return username, password
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"GitHub registration failed: {e}")
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
if driver:
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
|
def register_cursor_with_github(github_username, github_password):
|
||||||
"""Logs into Cursor AI using GitHub authentication."""
|
"""Logs into Cursor AI using GitHub authentication."""
|
||||||
driver.get("https://cursor.sh")
|
options = Options()
|
||||||
time.sleep(5)
|
options.add_argument('--headless')
|
||||||
driver.find_element(By.LINK_TEXT, "Sign in with GitHub").click()
|
driver = None
|
||||||
time.sleep(5)
|
try:
|
||||||
print("✅ Registered Cursor with GitHub")
|
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
|
||||||
|
driver.get("https://cursor.sh")
|
||||||
|
|
||||||
|
# Sign in with GitHub
|
||||||
|
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(text(), 'Sign in with GitHub')]")))
|
||||||
|
driver.find_element(By.XPATH, "//a[contains(text(), 'Sign in with GitHub')]").click()
|
||||||
|
|
||||||
|
# GitHub login page
|
||||||
|
WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "login_field")))
|
||||||
|
driver.find_element(By.ID, "login_field").send_keys(github_username)
|
||||||
|
driver.find_element(By.ID, "password").send_keys(github_password)
|
||||||
|
driver.find_element(By.NAME, "commit").click()
|
||||||
|
|
||||||
|
time.sleep(5) # Wait for login to complete
|
||||||
|
logging.info("Registered Cursor with GitHub")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Cursor registration failed: {e}")
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
if driver:
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
def save_credentials(email, github_username, github_password):
|
def save_credentials(email, github_username, github_password):
|
||||||
"""Saves the credentials in a log file."""
|
"""Saves the credentials in a log file."""
|
||||||
with open("github_cursor_accounts.txt", "a") as f:
|
try:
|
||||||
f.write(json.dumps({
|
with open("github_cursor_accounts.txt", "a") as f:
|
||||||
"email": email,
|
f.write(json.dumps({
|
||||||
"github_username": github_username,
|
"email": email,
|
||||||
"github_password": github_password,
|
"github_username": github_username,
|
||||||
"timestamp": time.strftime('%Y-%m-%d %H:%M:%S')
|
"github_password": github_password,
|
||||||
}) + "\n")
|
"timestamp": time.strftime('%Y-%m-%d %H:%M:%S')
|
||||||
print("✅ Credentials saved")
|
}) + "\n")
|
||||||
|
logging.info("Credentials saved to github_cursor_accounts.txt")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Failed to save credentials: {e}")
|
||||||
|
|
||||||
|
def display_features_and_warnings():
|
||||||
|
"""Displays features and warnings before proceeding."""
|
||||||
|
print("\n🚀 GitHub + Cursor AI Registration Automation")
|
||||||
|
print("=====================================")
|
||||||
|
print("Features:")
|
||||||
|
print(" - Generates a temporary email using 1secmail.")
|
||||||
|
print(" - Registers a new GitHub account with random credentials.")
|
||||||
|
print(" - Verifies the GitHub email automatically.")
|
||||||
|
print(" - Logs into Cursor AI using GitHub authentication.")
|
||||||
|
print(" - Resets the machine ID to bypass trial detection.")
|
||||||
|
print(" - Saves all credentials to a file.")
|
||||||
|
print("\n⚠️ Warnings:")
|
||||||
|
print(" - This script automates account creation, which may violate GitHub/Cursor terms of service.")
|
||||||
|
print(" - Requires internet access and administrative privileges.")
|
||||||
|
print(" - CAPTCHA or additional verification may interrupt automation.")
|
||||||
|
print(" - Use responsibly and at your own risk.")
|
||||||
|
print("=====================================\n")
|
||||||
|
|
||||||
|
def get_user_confirmation():
|
||||||
|
"""Prompts the user for confirmation to proceed."""
|
||||||
|
while True:
|
||||||
|
response = input("Do you want to proceed with GitHub + Cursor AI registration? (yes/no): ").lower().strip()
|
||||||
|
if response in ['yes', 'y']:
|
||||||
|
return True
|
||||||
|
elif response in ['no', 'n']:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
print("Please enter 'yes' or 'no'.")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print("\n🚀 Automating GitHub + Cursor AI Registration...\n")
|
logging.info("Starting GitHub + Cursor AI Registration Automation")
|
||||||
|
|
||||||
email = generate_temp_email()
|
# Display features and warnings
|
||||||
github_username, github_password = register_github(email)
|
display_features_and_warnings()
|
||||||
|
|
||||||
|
if not get_user_confirmation():
|
||||||
|
logging.info("Operation cancelled by user.")
|
||||||
|
print("❌ Operation cancelled.")
|
||||||
|
return
|
||||||
|
|
||||||
inbox_id = extract_inbox(email)
|
try:
|
||||||
if inbox_id:
|
# Step 1: Generate temp email
|
||||||
verify_link = get_verification_link(email, inbox_id)
|
email = generate_temp_email()
|
||||||
if verify_link:
|
|
||||||
options = Options()
|
# Step 2: Register GitHub account
|
||||||
options.add_argument('--headless')
|
github_username, github_password = register_github(email)
|
||||||
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
|
|
||||||
driver.get(verify_link)
|
# Step 3: Extract and verify email
|
||||||
print("✅ Verified GitHub Email")
|
inbox_id = extract_inbox(email)
|
||||||
driver.quit()
|
if inbox_id:
|
||||||
|
verify_link = get_verification_link(email, inbox_id)
|
||||||
|
if verify_link:
|
||||||
|
options = Options()
|
||||||
|
options.add_argument('--headless')
|
||||||
|
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
|
||||||
|
try:
|
||||||
|
driver.get(verify_link)
|
||||||
|
logging.info("GitHub email verified")
|
||||||
|
finally:
|
||||||
|
driver.quit()
|
||||||
|
else:
|
||||||
|
logging.error("Verification link not found")
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
print("❌ Verification link not found")
|
logging.error("Email verification failed")
|
||||||
else:
|
return
|
||||||
print("❌ Email verification failed")
|
|
||||||
|
|
||||||
# Automate Cursor AI registration with GitHub
|
|
||||||
options = Options()
|
|
||||||
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
|
|
||||||
register_cursor_with_github(driver)
|
|
||||||
|
|
||||||
# Reset Machine ID
|
# Step 4: Register Cursor with GitHub
|
||||||
reset_machine_id()
|
register_cursor_with_github(github_username, github_password)
|
||||||
|
|
||||||
# Save credentials
|
# Step 5: Reset Machine ID
|
||||||
save_credentials(email, github_username, github_password)
|
reset_machine_id()
|
||||||
print("✅ All steps completed!")
|
|
||||||
|
# Step 6: Save credentials
|
||||||
|
save_credentials(email, github_username, github_password)
|
||||||
|
|
||||||
|
logging.info("All steps completed successfully!")
|
||||||
|
print("✅ All steps completed!")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Script failed: {e}")
|
||||||
|
print(f"❌ An error occurred: {e}")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -52,11 +52,38 @@ def reset_machine_id():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"❌ Failed to reset machine ID at {path}: {e}")
|
print(f"❌ Failed to reset machine ID at {path}: {e}")
|
||||||
elif platform.system() == "Darwin": # macOS
|
elif platform.system() == "Darwin": # macOS
|
||||||
# macOS typically doesn't use a machine-id file like Linux
|
|
||||||
print("ℹ️ macOS does not use a machine-id file. Skipping machine ID reset.")
|
print("ℹ️ macOS does not use a machine-id file. Skipping machine ID reset.")
|
||||||
else:
|
else:
|
||||||
print("❌ Unsupported operating system for machine ID reset.")
|
print("❌ Unsupported operating system for machine ID reset.")
|
||||||
|
|
||||||
|
def display_features_and_warnings():
|
||||||
|
"""Displays features and warnings before proceeding."""
|
||||||
|
print("\n🚀 Cursor AI Reset Script")
|
||||||
|
print("=====================================")
|
||||||
|
print("Features:")
|
||||||
|
print(" - Removes Cursor AI configuration directories and files.")
|
||||||
|
print(" - Cleans up cache, preferences, and application data.")
|
||||||
|
print(" - Performs a deep scan for hidden Cursor-related files.")
|
||||||
|
print(" - Resets the machine ID to a new UUID (where applicable).")
|
||||||
|
print(" - Supports Windows, Linux, and macOS.")
|
||||||
|
print("\n⚠️ Warnings:")
|
||||||
|
print(" - This action is IRREVERSIBLE. All Cursor AI data will be deleted.")
|
||||||
|
print(" - Requires administrative privileges for some operations (e.g., machine ID reset on Windows/Linux).")
|
||||||
|
print(" - May disrupt Cursor AI functionality until reinstalled or reconfigured.")
|
||||||
|
print(" - Backup any important Cursor data before proceeding.")
|
||||||
|
print("=====================================\n")
|
||||||
|
|
||||||
|
def get_user_confirmation():
|
||||||
|
"""Prompts the user for confirmation to proceed."""
|
||||||
|
while True:
|
||||||
|
response = input("Do you want to proceed with resetting Cursor AI? (yes/no): ").lower().strip()
|
||||||
|
if response in ['yes', 'y']:
|
||||||
|
return True
|
||||||
|
elif response in ['no', 'n']:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
print("Please enter 'yes' or 'no'.")
|
||||||
|
|
||||||
def reset_cursor():
|
def reset_cursor():
|
||||||
print("\n🚀 Resetting Cursor AI...\n")
|
print("\n🚀 Resetting Cursor AI...\n")
|
||||||
|
|
||||||
@ -133,9 +160,17 @@ def reset_cursor():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
reset_cursor()
|
|
||||||
end_time = time.time()
|
# Display features and warnings
|
||||||
print(f"\n⏱️ Completed in {end_time - start_time:.2f} seconds.")
|
display_features_and_warnings()
|
||||||
|
|
||||||
|
# Get user confirmation
|
||||||
|
if get_user_confirmation():
|
||||||
|
reset_cursor()
|
||||||
|
end_time = time.time()
|
||||||
|
print(f"\n⏱️ Completed in {end_time - start_time:.2f} seconds.")
|
||||||
|
else:
|
||||||
|
print("\n❌ Operation cancelled by user.")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user