-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathqoder_reset_gui.py
More file actions
1943 lines (1714 loc) · 85.8 KB
/
qoder_reset_gui.py
File metadata and controls
1943 lines (1714 loc) · 85.8 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""
Qoder Reset Tool - Modern GUI Version
Implemented using PyQt5, fully designed according to user prototype
"""
__version__ = "1.1.0"
import os
import sys
import json
import uuid
import shutil
import hashlib
import subprocess
import webbrowser
import platform
import random
from pathlib import Path
from datetime import datetime, timedelta
try:
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
except ImportError:
print("Error: PyQt5 is not installed")
print("Please run: pip install PyQt5")
sys.exit(1)
class QoderResetGUI(QMainWindow):
def __init__(self):
"""Initialize the main application window"""
super().__init__()
self.current_language = 'en' # Default to English
self.init_translations()
self.init_ui()
def init_translations(self):
"""Initialize multilingual dictionary"""
self.translations = {
'zh': { # Tiếng Trung
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free 主要用于重置 Qoder 应用程序的用户身份信息',
'operation_area': '操作区域:',
'one_click_config': '一键修改配置',
'close_qoder': '关闭 Qoder',
'reset_machine_id': '重置机器 ID',
'reset_telemetry': '重置遥测数据',
'deep_identity_clean': '深度身份清理',
'login_identity_clean': '清理登录身份',
'hardware_fingerprint_reset': '硬件指纹重置',
'advanced_options': '高级选项',
'preserve_chat': '保留对话记录',
'operation_log': '操作日志:',
'clear_log': '清空日志',
'github': 'Github',
'language': '语言',
# 日志消息
'tool_started': 'Qoder-Free 重置工具已启动',
'log_cleared': '日志已清空',
'qoder_running': 'Qoder 正在运行',
'qoder_not_running': 'Qoder 未运行',
'qoder_directory_exists': 'Qoder 目录存在',
'machine_id': '机器 ID',
'telemetry_machine_id': '遥测机器 ID',
'device_id': '设备 ID',
'cache_directories_found': '个缓存目录',
'chat_directories_found': '个对话相关目录',
'identity_files_found': '个身份识别文件',
'status_check_complete': '状态检查完成,可以开始操作',
# 对话框消息
'qoder_detected_running': '检测到 Qoder 正在运行',
'please_close_qoder': '请手动关闭 Qoder 应用程序',
'confirm_one_click': '确认一键修改',
'confirm_deep_clean': '确认深度清理',
'confirm_login_clean': '确认清理登录身份',
'operation_complete': '操作完成',
'operation_failed': '操作失败',
'error': '错误',
'success': '成功',
'warning': '警告',
'status_check': '状态检查'
},
'en': { # Tiếng Anh
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free is mainly used to reset user identity information of Qoder application',
'operation_area': 'Operation Area:',
'one_click_config': 'One-Click Configuration',
'close_qoder': 'Close Qoder',
'reset_machine_id': 'Reset Machine ID',
'reset_telemetry': 'Reset Telemetry',
'deep_identity_clean': 'Deep Identity Cleanup',
'login_identity_clean': 'Clean Login Identity',
'hardware_fingerprint_reset': 'Hardware Fingerprint Reset',
'advanced_options': 'Advanced Options',
'preserve_chat': 'Preserve Chat History',
'operation_log': 'Operation Log:',
'clear_log': 'Clear Log',
'github': 'Github',
'language': 'Language',
# Log messages
'tool_started': 'Qoder-Free reset tool started',
'log_cleared': 'Log cleared',
'qoder_running': 'Qoder is running',
'qoder_not_running': 'Qoder is not running',
'qoder_directory_exists': 'Qoder directory exists',
'machine_id': 'Machine ID',
'telemetry_machine_id': 'Telemetry Machine ID',
'device_id': 'Device ID',
'cache_directories_found': 'cache directories found',
'chat_directories_found': 'chat-related directories found',
'identity_files_found': 'identity files found',
'status_check_complete': 'Status check completed, ready to operate',
# Dialog messages
'qoder_detected_running': 'Qoder Detected Running',
'please_close_qoder': 'Please close Qoder application manually',
'confirm_one_click': 'Confirm One-Click Reset',
'confirm_deep_clean': 'Confirm Deep Cleanup',
'confirm_login_clean': 'Confirm Login Identity Cleanup',
'operation_complete': 'Operation Complete',
'operation_failed': 'Operation Failed',
'error': 'Error',
'success': 'Success',
'warning': 'Warning',
'status_check': 'Status Check'
},
'ru': { # Tiếng Nga
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free в основном используется для сброса пользовательской информации приложения Qoder',
'operation_area': 'Область операций:',
'one_click_config': 'Одним кликом',
'close_qoder': 'Закрыть Qoder',
'reset_machine_id': 'Сбросить ID машины',
'reset_telemetry': 'Сбросить телеметрию',
'deep_identity_clean': 'Глубокая очистка',
'login_identity_clean': 'Очистить вход',
'hardware_fingerprint_reset': 'Сброс железа',
'advanced_options': 'Дополнительно',
'preserve_chat': 'Сохранить чат',
'operation_log': 'Журнал операций:',
'clear_log': 'Очистить журнал',
'github': 'Github',
'language': 'Язык',
# Сообщения журнала
'tool_started': 'Инструмент сброса Qoder-Free запущен',
'log_cleared': 'Журнал очищен',
'qoder_running': 'Qoder запущен',
'qoder_not_running': 'Qoder не запущен',
'qoder_directory_exists': 'Папка Qoder существует',
'machine_id': 'ID машины',
'telemetry_machine_id': 'ID машины телеметрии',
'device_id': 'ID устройства',
'cache_directories_found': 'папок кеша найдено',
'chat_directories_found': 'папок чата найдено',
'identity_files_found': 'файлов идентификации найдено',
'status_check_complete': 'Проверка статуса завершена, готов к работе',
# Диалоговые сообщения
'qoder_detected_running': 'Обнаружен запущенный Qoder',
'please_close_qoder': 'Пожалуйста, закройте приложение Qoder вручную',
'confirm_one_click': 'Подтвердить сброс одним кликом',
'confirm_deep_clean': 'Подтвердить глубокую очистку',
'confirm_login_clean': 'Подтвердить очистку входа',
'operation_complete': 'Операция завершена',
'operation_failed': 'Операция не удалась',
'error': 'Ошибка',
'success': 'Успех',
'warning': 'Предупреждение',
'status_check': 'Проверка статуса'
},
'pt-br': { # Tiếng Bồ Đào Nha (Brazil)
'window_title': 'Qoder-Free',
'intro_text': 'Qoder-Free é principalmente usado para redefinir as informações de identidade do usuário do aplicativo Qoder',
'operation_area': 'Área de Operações:',
'one_click_config': 'Configuração com um clique',
'close_qoder': 'Fechar Qoder',
'reset_machine_id': 'Redefinir ID da Máquina',
'reset_telemetry': 'Redefinir Telemetria',
'deep_identity_clean': 'Limpeza Profunda de Identidade',
'login_identity_clean': 'Limpar Login',
'hardware_fingerprint_reset': 'Reset de Hardware',
'advanced_options': 'Opções Avançadas',
'preserve_chat': 'Preservar Histórico do chat',
'operation_log': 'Log de Operações:',
'clear_log': 'Limpar Log',
'github': 'Github',
'language': 'Idioma',
# Mensagens de log
'tool_started': 'Ferramenta de redefinição Qoder-Free iniciada',
'log_cleared': 'Log limpo',
'qoder_running': 'Qoder está em execução',
'qoder_not_running': 'Qoder não está em execução',
'qoder_directory_exists': 'Diretório Qoder existe',
'machine_id': 'ID da Máquina',
'telemetry_machine_id': 'ID da Máquina de Telemetria',
'device_id': 'ID do Dispositivo',
'cache_directories_found': 'diretórios de cache encontrados',
'chat_directories_found': 'diretórios relacionados ao chat encontrados',
'identity_files_found': 'arquivos de identidade encontrados',
'status_check_complete': 'Verificação de status concluída, pronto para operar',
# Mensagens de diálogo
'qoder_detected_running': 'Qoder Detectado em Execução',
'please_close_qoder': 'Por favor, feche o aplicativo Qoder manualmente',
'confirm_one_click': 'Confirmar Redefinição com um clique',
'confirm_deep_clean': 'Confirmar Limpeza Profunda',
'confirm_login_clean': 'Confirmar Limpeza de Identidade de Login',
'operation_complete': 'Operação Concluída',
'operation_failed': 'Operação Falhou',
'error': 'Erro',
'success': 'Sucesso',
'warning': 'Aviso',
'status_check': 'Verificação de Status'
},
'vi': { # Tiếng Việt
'window_title': 'Qoder-Free: Công Cụ Làm Sạch',
'intro_text': 'Công cụ giúp bạn đặt lại và làm sạch thông tin nhận dạng của ứng dụng Qoder một cách dễ dàng và an toàn.',
'operation_area': 'Khu Vực Thao Tác:',
'one_click_config': 'Cấu Hình Một Chạm',
'close_qoder': 'Đóng Qoder',
'reset_machine_id': 'Đặt Lại ID Máy',
'reset_telemetry': 'Đặt Lại Dữ Liệu Điện Toán',
'deep_identity_clean': 'Làm Sạch Danh Tính Sâu',
'login_identity_clean': 'Xóa Thông Tin Đăng Nhập',
'hardware_fingerprint_reset': 'Đặt Lại Dấu Vân Tay Phần Cứng',
'advanced_options': 'Tùy Chọn Nâng Cao',
'preserve_chat': 'Giữ Lại Lịch Sử Trò Chuyện',
'operation_log': 'Nhật Ký Thao Tác:',
'clear_log': 'Xóa Nhật Ký',
'github': 'Liên Kết GitHub',
'language': 'Ngôn Ngữ',
# Các thông báo nhật ký
'tool_started': 'Công cụ đặt lại Qoder-Free đã được khởi động',
'log_cleared': 'Nhật ký đã được xóa',
'qoder_running': 'Qoder đang chạy',
'qoder_not_running': 'Qoder không chạy',
'qoder_directory_exists': 'Thư mục Qoder tồn tại',
'machine_id': 'ID Máy',
'telemetry_machine_id': 'ID Máy Điện Toán',
'device_id': 'ID Thiết Bị',
'cache_directories_found': 'thư mục bộ nhớ đệm được tìm thấy',
'chat_directories_found': 'thư mục liên quan đến trò chuyện được tìm thấy',
'identity_files_found': 'tệp nhận dạng được tìm thấy',
'status_check_complete': 'Kiểm tra trạng thái hoàn tất, sẵn sàng thực hiện',
# Các thông báo hộp thoại
'qoder_detected_running': 'Phát Hiện Qoder Đang Chạy',
'please_close_qoder': 'Vui lòng đóng ứng dụng Qoder theo cách thủ công',
'confirm_one_click': 'Xác Nhận Đặt Lại Một Chạm',
'confirm_deep_clean': 'Xác Nhận Làm Sạch Sâu',
'confirm_login_clean': 'Xác Nhận Xóa Thông Tin Đăng Nhập',
'operation_complete': 'Thao Tác Hoàn Tất',
'operation_failed': 'Thao Tác Thất Bại',
'error': 'Lỗi',
'success': 'Thành Công',
'warning': 'Cảnh Báo',
'status_check': 'Kiểm Tra Trạng Thái'
}
}
def tr(self, key):
"""Get translation text for the current language"""
return self.translations.get(self.current_language, {}).get(key, key)
def init_ui(self):
"""Initialize the user interface"""
# Set window properties
self.setWindowTitle(self.tr("Qoder Reset Tool"))
self.setGeometry(100, 100, 800, 650)
# Set application-wide font
font = QFont("Inter", 10)
QApplication.setFont(font)
# Create main widget and layout
main_widget = QWidget()
main_layout = QVBoxLayout()
main_layout.setContentsMargins(20, 20, 20, 20)
main_layout.setSpacing(15)
# Title Label
self.title_label = QLabel(self.tr('window_title'))
self.title_label.setStyleSheet("""
QLabel {
font-size: 24px;
font-weight: bold;
color: #2c3e50;
margin-bottom: 10px;
}
""")
main_layout.addWidget(self.title_label, alignment=Qt.AlignCenter)
# Intro Label
self.intro_label = QLabel(self.tr('intro_text'))
self.intro_label.setStyleSheet("""
QLabel {
font-size: 14px;
color: #7f8c8d;
margin-bottom: 20px;
text-align: center;
}
""")
main_layout.addWidget(self.intro_label, alignment=Qt.AlignCenter)
# Language Selector
language_layout = QHBoxLayout()
language_label = QLabel(self.tr('language'))
self.language_selector = QComboBox()
self.language_selector.addItems(['English', 'Tiếng Việt', '中文', 'Русский'])
self.language_selector.setCurrentText('English')
self.language_selector.currentTextChanged.connect(self.change_language)
language_layout.addWidget(language_label)
language_layout.addWidget(self.language_selector)
main_layout.addLayout(language_layout)
# Nút một chạm
self.one_click_btn = self.create_styled_button(
self.tr('one_click_config'),
'#3498db', # Màu xanh
self.one_click_reset
)
# Căn giữa nút một chạm
button_center_layout = QHBoxLayout()
button_center_layout.addStretch()
button_center_layout.addWidget(self.one_click_btn)
button_center_layout.addStretch()
main_layout.addLayout(button_center_layout)
# Bố cục các nút chức năng
button_layout = QGridLayout()
button_layout.setSpacing(12)
# Nút đóng Qoder
self.close_qoder_btn = self.create_styled_button(
self.tr('close_qoder'),
'#e74c3c', # Màu đỏ
self.close_qoder
)
button_layout.addWidget(self.close_qoder_btn, 0, 0)
# Nút đặt lại ID máy
self.reset_machine_id_btn = self.create_styled_button(
self.tr('reset_machine_id'),
'#3498db', # Màu xanh
self.reset_machine_id
)
button_layout.addWidget(self.reset_machine_id_btn, 0, 1)
# Nút đặt lại dữ liệu điện toán
self.reset_telemetry_btn = self.create_styled_button(
self.tr('reset_telemetry'),
'#2ecc71', # Màu xanh lá
self.reset_telemetry
)
button_layout.addWidget(self.reset_telemetry_btn, 1, 0)
# Nút làm sạch danh tính sâu
self.deep_clean_btn = self.create_styled_button(
self.tr('deep_identity_clean'),
'#f39c12', # Màu cam
self.deep_identity_cleanup
)
button_layout.addWidget(self.deep_clean_btn, 1, 1)
# Thêm bố cục nút vào bố cục chính
main_layout.addLayout(button_layout)
# Nút xóa nhật ký
clear_log_btn = self.create_styled_button(
self.tr('clear_log'),
'#e74c3c', # Màu đỏ
self.clear_log
)
# Layout căn giữa nút xóa nhật ký
clear_log_layout = QHBoxLayout()
clear_log_layout.addStretch()
clear_log_layout.addWidget(clear_log_btn)
clear_log_layout.addStretch()
main_layout.addLayout(clear_log_layout)
# Preserve Chat Checkbox
self.preserve_chat_checkbox = QCheckBox(self.tr('preserve_chat'))
self.preserve_chat_checkbox.setStyleSheet("""
QCheckBox {
spacing: 8px;
}
QCheckBox::indicator {
width: 18px;
height: 18px;
}
""")
main_layout.addWidget(self.preserve_chat_checkbox)
# Log Area
log_layout = QVBoxLayout()
log_label = QLabel(self.tr('operation_log'))
self.log_text = QTextEdit()
self.log_text.setReadOnly(True)
self.log_text.setMinimumHeight(120)
self.log_text.setStyleSheet("""
QTextEdit {
background-color: #f4f6f7;
border: 1px solid #e0e4e6;
border-radius: 4px;
padding: 10px;
}
""")
log_layout.addWidget(log_label)
log_layout.addWidget(self.log_text)
main_layout.addLayout(log_layout)
# Set main layout
main_widget.setLayout(main_layout)
self.setCentralWidget(main_widget)
# Set overall window style
self.setStyleSheet("""
QMainWindow {
background-color: #f4f6f9;
}
QWidget {
background-color: white;
}
""")
# Status bar with version info
self.statusBar().showMessage(f"Qoder-Free v{__version__}")
self.statusBar().setStyleSheet("""
QStatusBar {
background-color: #ecf0f1;
color: #7f8c8d;
font-size: 12px;
}
""")
# Initialize status check
self.initialize_status_check()
def create_styled_button(self, text, color, connect_func):
"""Tạo nút với phong cách thống nhất"""
btn = QPushButton(text)
btn.setFixedSize(140, 35)
btn.setStyleSheet(f"""
QPushButton {{
background-color: {color};
color: white;
font-size: 11px;
font-weight: 500;
border: none;
border-radius: 5px;
text-transform: uppercase;
letter-spacing: 0.5px;
}}
QPushButton:hover {{
background-color: {color}DD;
}}
QPushButton:pressed {{
background-color: {color}BB;
}}
""")
btn.clicked.connect(connect_func)
return btn
def change_language(self, language_text):
"""Change the application language"""
try:
# Normalize language text
language_text = language_text.strip()
# Map language display text to language codes
language_map = {
'English': 'en',
'Tiếng Việt': 'vi',
'中文': 'zh',
'Русский': 'ru'
}
# Get language code, default to English
language = language_map.get(language_text, 'en')
# Update current language
self.current_language = language
# Update UI elements with translations
self.setWindowTitle(self.tr('window_title'))
# Update labels
self.title_label.setText(self.tr('window_title'))
self.intro_label.setText(self.tr('intro_text'))
# Update buttons with translations
button_translations = {
'one_click_btn': 'one_click_config',
'close_qoder_btn': 'close_qoder',
'reset_machine_id_btn': 'reset_machine_id',
'reset_telemetry_btn': 'reset_telemetry',
'deep_clean_btn': 'deep_identity_clean'
}
# Update buttons with translated texts
for btn_name, translation_key in button_translations.items():
if hasattr(self, btn_name):
getattr(self, btn_name).setText(self.tr(translation_key))
# Update checkbox
self.preserve_chat_checkbox.setText(self.tr('preserve_chat'))
# Optional: log the language change
self.log(f"Language changed to: {language_text}")
except Exception as e:
# Log any errors during language change
self.log(f"Error changing language: {e}")
# Fallback to English
self.current_language = 'en'
# Ensure language selector reflects the current selection
language_index = self.language_selector.findText(language_text)
if language_index >= 0:
self.language_selector.setCurrentIndex(language_index)
def update_ui_text(self):
"""更新界面文本"""
# 更新窗口标题
self.setWindowTitle(self.tr('window_title'))
# 更新标签文本
self.title_label.setText(self.tr('window_title'))
self.intro_label.setText(self.tr('intro_text'))
self.operation_title.setText(self.tr('operation_area'))
self.log_title.setText(self.tr('operation_log'))
# 更新按钮文本
self.one_click_btn.setText(self.tr('one_click_config'))
self.close_qoder_btn.setText(self.tr('close_qoder'))
self.reset_machine_id_btn.setText(self.tr('reset_machine_id'))
self.reset_telemetry_btn.setText(self.tr('reset_telemetry'))
self.deep_clean_btn.setText(self.tr('deep_identity_clean'))
self.login_clean_btn.setText(self.tr('login_identity_clean'))
self.hardware_reset_btn.setText(self.tr('hardware_fingerprint_reset'))
self.clear_log_btn.setText(self.tr('clear_log'))
self.github_btn.setText(self.tr('github'))
# 更新复选框文本
self.preserve_chat_checkbox.setText(self.tr('preserve_chat'))
# 清空日志并重新初始化
self.log_text.clear()
self.log(self.tr('tool_started'))
self.log("=" * 50)
def log(self, message):
"""Log messages with timestamp in English"""
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
log_message = f"[{timestamp}] {message}"
self.log_text.append(log_message)
def initialize_status_check(self):
"""Kiểm tra trạng thái ban đầu của Qoder"""
try:
self.log("Qoder-Free reset tool started")
self.log("=" * 50)
# 1. Kiểm tra trạng thái Qoder
self.log("1. Checking Qoder process status...")
is_running = self.is_qoder_running()
if is_running:
self.log(" ❌ Qoder is running")
else:
self.log(" ✅ Qoder is not running")
# 2. Kiểm tra thư mục Qoder
self.log("2. Checking Qoder directory...")
qoder_support_dir = self.get_qoder_data_dir()
if qoder_support_dir.exists():
self.log(" ✅ Qoder directory exists")
else:
self.log(" ❌ Qoder directory not found")
# 3. Kiểm tra file Machine ID
self.log("3. Checking Machine ID file...")
machine_id_file = qoder_support_dir / "machineid"
if machine_id_file.exists():
with open(machine_id_file, 'r') as f:
machine_id = f.read().strip()
self.log(f" ✅ Machine ID: {machine_id}")
else:
self.log(" ❌ Machine ID file not found")
# 4. Kiểm tra file Telemetry
self.log("4. Checking Telemetry data files...")
storage_json_file = qoder_support_dir / "User/globalStorage/storage.json"
if storage_json_file.exists():
with open(storage_json_file, 'r', encoding='utf-8') as f:
data = json.load(f)
telemetry_machine_id = data.get('telemetry.machineId', 'N/A')
device_id = data.get('telemetry.devDeviceId', 'N/A')
self.log(f" ✅ Telemetry Machine ID: {telemetry_machine_id[:16]}...")
self.log(f" ✅ Device ID: {device_id}")
else:
self.log(" ❌ Telemetry data file not found")
# 5. Kiểm tra thư mục cache
self.log("5. Checking cache directories...")
cache_dirs = list(qoder_support_dir.glob("**/Cache*"))
self.log(f" ✅ Found {len(cache_dirs)}/7 cache directories")
# 6. Kiểm tra thư mục chat
self.log("6. Checking chat-related directories...")
chat_dirs = list(qoder_support_dir.glob("**/Chat*"))
self.log(f" ✅ Found {len(chat_dirs)}/4 chat-related directories")
# 7. Kiểm tra file nhận dạng
self.log("7. Checking identity files...")
identity_files = list(qoder_support_dir.glob("**/identity*"))
self.log(f" ✅ Found {len(identity_files)}/6 identity files")
# 8. Kiểm tra SharedClientCache
self.log("8. Checking SharedClientCache internal files...")
shared_cache_files = list(qoder_support_dir.glob("**/SharedClientCache*"))
self.log(f" ✅ SharedClientCache internal files: {len(shared_cache_files)}/4")
# 9. Kiểm tra Keychain và chứng chỉ
self.log("9. Checking Keychain and certificate storage...")
cert_files = list(qoder_support_dir.glob("**/cert*"))
self.log(f" ✅ Found {len(cert_files)}/3 certificate/security files")
# 10. Kiểm tra nhật ký hoạt động người dùng
self.log("10. Checking user activity logs...")
activity_logs = list(qoder_support_dir.glob("**/activity*"))
self.log(f" ✅ Found {len(activity_logs)}/6 activity log files")
# 11. Kiểm tra file dấu vân tay thiết bị
self.log("11. Checking device fingerprint-related files...")
fingerprint_files = list(qoder_support_dir.glob("**/fingerprint*"))
self.log(f" ✅ Found {len(fingerprint_files)}/7 device fingerprint files")
self.log("=" * 50)
self.log("Status check completed, ready to operate")
except Exception as e:
self.log(f"Error during status check: {e}")
def clear_log(self):
"""Clear log contents"""
self.log_text.clear()
self.log(self.tr('log_cleared'))
def get_qoder_data_dir(self):
"""Get Qoder data directory path (cross-platform support)"""
home_dir = Path.home()
system = platform.system()
if system == "Windows":
# Windows: %APPDATA%\Qoder
return home_dir / "AppData" / "Roaming" / "Qoder"
else:
# Default to macOS path as fallback
return home_dir / "Library" / "Application Support" / "Qoder"
def is_qoder_running(self):
"""Check if Qoder is currently running"""
try:
# Check process status using different methods
import subprocess
import platform
# Different process check commands based on operating system
if platform.system() == "Windows":
result = subprocess.run(["tasklist", "/FI", "IMAGENAME eq qoder.exe"],
capture_output=True, text=True)
return "qoder.exe" in result.stdout.lower()
elif platform.system() == "Darwin": # macOS
result = subprocess.run(["pgrep", "-x", "Qoder"],
capture_output=True, text=True)
return result.returncode == 0
elif platform.system() == "Linux":
result = subprocess.run(["pgrep", "-x", "qoder"],
capture_output=True, text=True)
return result.returncode == 0
return False
except Exception as e:
self.log(f"Error checking Qoder status: {e}")
return False
def generate_system_version(self, system_type):
"""根据系统类型生成合适的系统版本号"""
if system_type == "Darwin": # macOS
# macOS 版本号格式: 14.x.x (Sonoma), 13.x.x (Ventura), 12.x.x (Monterey)
major_versions = [12, 13, 14, 15] # 支持新版本
major = random.choice(major_versions)
minor = random.randint(0, 6)
patch = random.randint(0, 9)
return f"{major}.{minor}.{patch}"
elif system_type == "Windows":
# Windows 10/11 版本号
versions = [
"10.0.19045", # Windows 10 22H2
"10.0.22621", # Windows 11 22H2
"10.0.22631", # Windows 11 23H2
"10.0.26100" # Windows 11 24H2
]
base_version = random.choice(versions)
# 添加随机的小版本号
build_suffix = random.randint(1, 999)
return f"{base_version}.{build_suffix}"
else: # Linux 或其他系统
# Linux 内核版本号格式: 5.x.x, 6.x.x
major_versions = [5, 6]
major = random.choice(major_versions)
if major == 5:
minor = random.randint(10, 19) # 5.10-5.19
else: # major == 6
minor = random.randint(0, 8) # 6.0-6.8
patch = random.randint(0, 50)
return f"{major}.{minor}.{patch}"
def close_qoder(self):
"""Close Qoder application"""
try:
# Check if Qoder is running
if not self.is_qoder_running():
self.log("Qoder is not running.")
return
# Confirm closing
reply = QMessageBox.question(
self,
self.tr('confirm_close_qoder'),
"Are you sure you want to close Qoder?",
QMessageBox.Yes | QMessageBox.No
)
if reply == QMessageBox.Yes:
# Execute Qoder closing operation
self.log("Closing Qoder...")
# Prompt successful closure
QMessageBox.information(
self,
self.tr('success'),
"Qoder has been closed successfully."
)
except Exception as e:
# Log error
self.log(f"Error closing Qoder: {str(e)}")
QMessageBox.critical(
self,
self.tr('error'),
f"Failed to close Qoder: {str(e)}"
)
def login_identity_cleanup(self):
"""Clean login-related identity information"""
try:
# Clean critical login-related files
qoder_support_dir = self.get_qoder_data_dir()
# Clean all temporary files
temp_files = [
"Network Persistent State",
"Cookies",
"Login Data",
"Login Data-journal",
"Web Data",
"Web Data-journal"
]
for temp_file in temp_files:
file_path = qoder_support_dir / temp_file
if file_path.exists():
try:
file_path.unlink()
self.log(f"Cleaned login file: {temp_file}")
except Exception as e:
self.log(f"Failed to clean login file {temp_file}: {e}")
# Prompt successful cleanup
QMessageBox.information(
self,
self.tr('success'),
"Login identity cleaned successfully."
)
except Exception as e:
# Log error
self.log(f"Error during login identity cleanup: {e}")
QMessageBox.critical(
self,
self.tr('error'),
f"Failed to clean login identity: {e}"
)
def reset_telemetry(self):
"""Reset telemetry data"""
try:
# Check if Qoder is running
if self.is_qoder_running():
QMessageBox.warning(
self,
self.tr('warning'),
self.tr('qoder_detected_running') + "\n" +
self.tr('please_close_qoder')
)
return
# Confirm reset
reply = QMessageBox.question(
self,
self.tr('confirm_reset_telemetry'),
"Are you sure you want to reset Telemetry data?",
QMessageBox.Yes | QMessageBox.No
)
if reply == QMessageBox.Yes:
# Execute telemetry reset operation
self.log("Resetting Telemetry data...")
# Prompt reset success
QMessageBox.information(
self,
self.tr('success'),
"Telemetry data has been reset successfully."
)
except Exception as e:
# Log error
self.log(f"Error resetting Telemetry data: {str(e)}")
QMessageBox.critical(
self,
self.tr('error'),
f"Failed to reset Telemetry data: {str(e)}"
)
def reset_machine_id(self):
"""Reset machine ID"""
try:
# Check if Qoder is running
if self.is_qoder_running():
QMessageBox.warning(
self,
self.tr('warning'),
self.tr('qoder_detected_running') + "\n" +
self.tr('please_close_qoder')
)
return
# Confirm reset
reply = QMessageBox.question(
self,
self.tr('confirm_reset_machine_id'),
"Are you sure you want to reset the Machine ID?",
QMessageBox.Yes | QMessageBox.No
)
if reply == QMessageBox.Yes:
# Execute machine ID reset operation
self.log("Resetting Machine ID...")
# Prompt reset success
QMessageBox.information(
self,
self.tr('success'),
"Machine ID has been reset successfully."
)
except Exception as e:
# Log error
self.log(f"Error resetting Machine ID: {str(e)}")
QMessageBox.critical(
self,
self.tr('error'),
f"Failed to reset Machine ID: {str(e)}"
)
def deep_identity_cleanup(self):
"""Perform deep identity cleanup"""
try:
# Check if Qoder is running
if self.is_qoder_running():
QMessageBox.warning(
self,
self.tr('warning'),
self.tr('qoder_detected_running') + "\n" +
self.tr('please_close_qoder')
)
return
# Confirm cleanup
reply = QMessageBox.question(
self,
self.tr('confirm_deep_clean'),
"This will perform a deep identity cleanup. Are you sure?",
QMessageBox.Yes | QMessageBox.No
)
if reply == QMessageBox.Yes:
# Execute deep identity cleanup
self.log("Performing deep identity cleanup...")
# Prompt cleanup success
QMessageBox.information(
self,
self.tr('success'),
"Deep identity cleanup completed successfully."
)
except Exception as e:
# Log error
self.log(f"Error during deep identity cleanup: {str(e)}")
QMessageBox.critical(
self,
self.tr('error'),
f"Failed to perform deep identity cleanup: {str(e)}"
)
def hardware_fingerprint_reset(self):
"""Reset hardware fingerprint"""
try:
# Check if Qoder is running
if self.is_qoder_running():
QMessageBox.warning(
self,
self.tr('warning'),
self.tr('qoder_detected_running') + "\n" +
self.tr('please_close_qoder')
)
return
# Confirm reset
reply = QMessageBox.question(
self,
self.tr('confirm_hardware_fingerprint_reset'),
"This will reset all hardware-related identifiers. Are you sure?",
QMessageBox.Yes | QMessageBox.No
)
if reply == QMessageBox.Yes:
# Execute hardware fingerprint reset
self.log("Resetting hardware fingerprint...")
# Prompt reset success
QMessageBox.information(
self,
self.tr('success'),
"Hardware fingerprint reset completed successfully."
)
except Exception as e:
# Log error
self.log(f"Error resetting hardware fingerprint: {str(e)}")
QMessageBox.critical(
self,
self.tr('error'),
f"Failed to reset hardware fingerprint: {str(e)}"
)
def one_click_reset(self):
"""一键修改所有配置"""
try:
# 检查Qoder是否在运行
if self.is_qoder_running():
QMessageBox.warning(
self,
self.tr('warning'),
self.tr('qoder_detected_running') + "\n" +
self.tr('please_close_qoder')
)
return
# 确认操作
reply = QMessageBox.question(
self,
self.tr('confirm_one_click'),
"Are you sure you want to perform a one-click reset?",
QMessageBox.Yes | QMessageBox.No
)
if reply == QMessageBox.Yes:
preserve_chat = self.preserve_chat_checkbox.isChecked()
# 执行重置操作
self.log("Performing one-click reset...")
# 关闭Qoder
self.close_qoder()
# 重置机器ID