From 854e9879275671822bfa7a17f033354e3987259b Mon Sep 17 00:00:00 2001 From: BasaiCorp Date: Fri, 21 Mar 2025 22:06:01 +0530 Subject: [PATCH 1/2] Update totally_reset_cursor.py Stable Working and Stable --- totally_reset_cursor.py | 43 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/totally_reset_cursor.py b/totally_reset_cursor.py index c6391b7..ebe2859 100644 --- a/totally_reset_cursor.py +++ b/totally_reset_cursor.py @@ -52,11 +52,38 @@ def reset_machine_id(): except Exception as e: print(f"āŒ Failed to reset machine ID at {path}: {e}") 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.") else: 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(): print("\nšŸš€ Resetting Cursor AI...\n") @@ -133,9 +160,17 @@ def reset_cursor(): def main(): start_time = time.time() - reset_cursor() - end_time = time.time() - print(f"\nā±ļø Completed in {end_time - start_time:.2f} seconds.") + + # Display features and warnings + 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__': main() From 5d70214a2f9692bebac37abe6e2ff09a476a3380 Mon Sep 17 00:00:00 2001 From: BasaiCorp Date: Fri, 21 Mar 2025 22:07:40 +0530 Subject: [PATCH 2/2] Update github_cursor_register.py Stable Working and usable final --- github_cursor_register.py | 274 ++++++++++++++++++++++++++------------ 1 file changed, 192 insertions(+), 82 deletions(-) diff --git a/github_cursor_register.py b/github_cursor_register.py index c3e19b6..3491798 100644 --- a/github_cursor_register.py +++ b/github_cursor_register.py @@ -8,29 +8,44 @@ import requests from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service -from webdriver_manager.chrome import ChromeDriverManager 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(): - """Generates a temporary email and returns the email and inbox ID.""" - response = requests.get("https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1") - email = response.json()[0] - print(f"āœ… Generated temp email: {email}") - return email + """Generates a temporary email using 1secmail API.""" + try: + response = requests.get("https://www.1secmail.com/api/v1/?action=genRandomMailbox&count=1") + response.raise_for_status() + 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.""" domain = email.split('@')[1] login = email.split('@')[0] inbox_url = f"https://www.1secmail.com/api/v1/?action=getMessages&login={login}&domain={domain}" for attempt in range(retries): - time.sleep(10) # Allow email to arrive - messages = requests.get(inbox_url).json() - if messages: - print(f"āœ… Inbox found on attempt {attempt + 1}") - return messages[0]['id'] - print(f"šŸ”„ Retry {attempt + 1}/{retries}: No email yet...") + time.sleep(wait_time) + try: + messages = requests.get(inbox_url).json() + if messages: + logging.info(f"Inbox found on attempt {attempt + 1}: {messages[0]['id']}") + 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 def get_verification_link(email, message_id): @@ -38,21 +53,35 @@ def get_verification_link(email, message_id): domain = email.split('@')[1] login = email.split('@')[0] msg_url = f"https://www.1secmail.com/api/v1/?action=readMessage&login={login}&domain={domain}&id={message_id}" - message = requests.get(msg_url).json() - for line in message['body'].splitlines(): - if "https://github.com/" in line: - print(f"āœ… Verification link found: {line}") - return line.strip() - return None + try: + message = requests.get(msg_url).json() + for line in message['body'].splitlines(): + if "https://github.com/" in line: + logging.info(f"Verification link found: {line}") + 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(): - """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()) - if os.name == 'nt': # Windows - os.system(f'reg add "HKLM\SOFTWARE\Microsoft\Cryptography" /v MachineGuid /d {new_id} /f') - else: # Linux/macOS - os.system(f'echo {new_id} | sudo tee /etc/machine-id') - print(f"āœ… Machine ID reset: {new_id}") + try: + if os.name == 'nt': # Windows + os.system(f'reg add "HKLM\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid /d {new_id} /f') + logging.info(f"Machine ID reset on Windows: {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): """Automates GitHub registration with temp email.""" @@ -60,76 +89,157 @@ def register_github(email): options.add_argument('--headless') options.add_argument('--no-sandbox') 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.quit() + driver = None + try: + driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options) + driver.get("https://github.com/join") - print(f"āœ… GitHub account created: {username} | {email}") - return username, password + # Generate random credentials + 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.""" - driver.get("https://cursor.sh") - time.sleep(5) - driver.find_element(By.LINK_TEXT, "Sign in with GitHub").click() - time.sleep(5) - print("āœ… Registered Cursor with GitHub") + options = Options() + options.add_argument('--headless') + driver = None + try: + 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): """Saves the credentials in a log file.""" - with open("github_cursor_accounts.txt", "a") as f: - f.write(json.dumps({ - "email": email, - "github_username": github_username, - "github_password": github_password, - "timestamp": time.strftime('%Y-%m-%d %H:%M:%S') - }) + "\n") - print("āœ… Credentials saved") + try: + with open("github_cursor_accounts.txt", "a") as f: + f.write(json.dumps({ + "email": email, + "github_username": github_username, + "github_password": github_password, + "timestamp": time.strftime('%Y-%m-%d %H:%M:%S') + }) + "\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(): - print("\nšŸš€ Automating GitHub + Cursor AI Registration...\n") + logging.info("Starting GitHub + Cursor AI Registration Automation") - email = generate_temp_email() - github_username, github_password = register_github(email) + # Display features and warnings + display_features_and_warnings() + + if not get_user_confirmation(): + logging.info("Operation cancelled by user.") + print("āŒ Operation cancelled.") + return - inbox_id = extract_inbox(email) - 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) - driver.get(verify_link) - print("āœ… Verified GitHub Email") - driver.quit() + try: + # Step 1: Generate temp email + email = generate_temp_email() + + # Step 2: Register GitHub account + github_username, github_password = register_github(email) + + # Step 3: Extract and verify email + inbox_id = extract_inbox(email) + 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: - print("āŒ Verification link not found") - else: - 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) + logging.error("Email verification failed") + return - # Reset Machine ID - reset_machine_id() - - # Save credentials - save_credentials(email, github_username, github_password) - print("āœ… All steps completed!") + # Step 4: Register Cursor with GitHub + register_cursor_with_github(github_username, github_password) + + # Step 5: Reset Machine ID + reset_machine_id() + + # 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__': main()