mirror of
https://github.com/yeongpin/cursor-free-vip.git
synced 2025-08-02 20:47:35 +08:00
Update totally_reset_cursor.py test v0.2
This commit is contained in:
parent
209c58e3f8
commit
7b757c2d57
@ -2,6 +2,8 @@ import os
|
||||
import shutil
|
||||
import platform
|
||||
import time
|
||||
import uuid
|
||||
import subprocess
|
||||
|
||||
def delete_directory(path):
|
||||
"""Deletes a directory and all its contents."""
|
||||
@ -25,6 +27,36 @@ def delete_file(path):
|
||||
else:
|
||||
print(f"🔍 Not found: {path}")
|
||||
|
||||
def reset_machine_id():
|
||||
"""Resets the machine ID to a new UUID."""
|
||||
new_id = str(uuid.uuid4())
|
||||
if platform.system() == "Windows":
|
||||
try:
|
||||
subprocess.run(
|
||||
["reg", "add", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography", "/v", "MachineGuid", "/d", new_id, "/f"],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE
|
||||
)
|
||||
print(f"✅ MachineGuid reset to: {new_id}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"❌ Failed to reset MachineGuid: {e}")
|
||||
elif platform.system() == "Linux":
|
||||
machine_id_paths = ["/etc/machine-id", "/var/lib/dbus/machine-id"]
|
||||
for path in machine_id_paths:
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
with open(path, 'w') as f:
|
||||
f.write(new_id)
|
||||
print(f"✅ Reset machine ID at: {path}")
|
||||
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 reset_cursor():
|
||||
print("\n🚀 Resetting Cursor AI...\n")
|
||||
|
||||
@ -40,12 +72,10 @@ def reset_cursor():
|
||||
"/opt/cursor",
|
||||
"/usr/bin/cursor",
|
||||
os.path.expanduser("~/.cursor/machine-id.db"),
|
||||
os.path.expanduser("~/.local/share/cursor"),
|
||||
os.path.expanduser("~/.config/Cursor"),
|
||||
os.path.expanduser("~/.local/share/Cursor"),
|
||||
os.path.expanduser("~/.config/Cursor"),
|
||||
os.path.expanduser("~/.cache/Cursor")
|
||||
]
|
||||
|
||||
elif platform.system() == "Darwin": # macOS
|
||||
paths = [
|
||||
os.path.expanduser("~/Library/Application Support/Cursor"),
|
||||
@ -53,7 +83,6 @@ def reset_cursor():
|
||||
"/Applications/Cursor.app",
|
||||
os.path.expanduser("~/Library/Preferences/com.cursor.app.plist"),
|
||||
]
|
||||
|
||||
elif platform.system() == "Windows":
|
||||
paths = [
|
||||
os.path.expanduser("~\\AppData\\Local\\Cursor"),
|
||||
@ -97,6 +126,9 @@ def reset_cursor():
|
||||
if "cursor" in file.lower():
|
||||
delete_file(os.path.join(root, file))
|
||||
|
||||
# Reset machine ID
|
||||
reset_machine_id()
|
||||
|
||||
print("\n✅ Cursor AI has been completely reset!")
|
||||
|
||||
def main():
|
||||
|
Loading…
x
Reference in New Issue
Block a user