-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfreecursor.py
59 lines (51 loc) · 1.75 KB
/
freecursor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
import shutil
import ctypes
def secure_delete(file_path, passes=3):
try:
long_path = f"\\\\?\\{file_path}"
if os.path.isfile(long_path):
with open(long_path, 'ba+', buffering=0) as f:
length = f.tell()
for _ in range(passes):
f.seek(0)
f.write(os.urandom(length))
os.remove(long_path)
print(f"Securely deleted: {file_path}")
except Exception as e:
print(f"Error deleting {file_path}: {e}")
def delete_directory(directory_path):
try:
long_path = f"\\\\?\\{directory_path}"
if os.path.exists(long_path):
shutil.rmtree(long_path)
print(f"Deleted directory: {directory_path}")
except Exception as e:
print(f"Error deleting {directory_path}: {e}")
def is_admin():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
def wipe_cursor_traces():
cursor_paths = [
os.path.expandvars(r"%APPDATA%\\Cursor"),
os.path.expandvars(r"%LOCALAPPDATA%\\Programs\\Cursor"),
os.path.expandvars(r"%LOCALAPPDATA%\\Cursor"),
os.path.expandvars(r"%TEMP%\\Cursor"),
os.path.expandvars(r"%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Cursor")
]
for path in cursor_paths:
if os.path.isdir(path):
delete_directory(path)
elif os.path.isfile(path):
secure_delete(path)
def main():
if not is_admin():
print("This script requires administrative privileges to run.")
return
print("Wiping Cursor app traces...")
wipe_cursor_traces()
print("Done.")
if __name__ == "__main__":
main()