Skip to content

Commit 6426c6c

Browse files
Add files via upload
1 parent b1332b1 commit 6426c6c

File tree

1 file changed

+399
-0
lines changed

1 file changed

+399
-0
lines changed

Old_GlitchMaker/glitch.py

Lines changed: 399 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,399 @@
1+
import ctypes
2+
import threading
3+
import time
4+
import random
5+
import os
6+
import string
7+
from pathlib import Path
8+
import pyautogui
9+
10+
# Optional: install these dependencies via pip install pygetwindow
11+
try:
12+
import pygetwindow as gw
13+
except ImportError:
14+
gw = None
15+
16+
active_threads = {}
17+
created_files = []
18+
19+
20+
def main_glitch(effect_name):
21+
effects.get(effect_name, lambda: None)()[0]()
22+
23+
24+
def main_cure(effect_name):
25+
effects.get(effect_name, lambda: None)()[1]()
26+
27+
28+
# -------- GLITCH DEFINITIONS --------
29+
30+
def screen_flicker():
31+
stop_flag = {'stop': False}
32+
33+
def flick():
34+
while not stop_flag['stop']:
35+
pyautogui.hotkey('win', 'd')
36+
time.sleep(0.2)
37+
pyautogui.hotkey('win', 'd')
38+
time.sleep(0.3)
39+
40+
thread = threading.Thread(target=flick)
41+
thread.start()
42+
active_threads['screen_flicker'] = (thread, stop_flag)
43+
44+
def cure():
45+
stop_flag['stop'] = True
46+
47+
return lambda: None, cure
48+
49+
50+
def phantom_typing():
51+
stop_flag = {'stop': False}
52+
53+
def phantom():
54+
while not stop_flag['stop']:
55+
time.sleep(random.uniform(0.3, 1.2))
56+
pyautogui.typewrite(random.choice(list("THE SYSTEM IS BROKEN...")))
57+
58+
thread = threading.Thread(target=phantom)
59+
thread.start()
60+
active_threads['phantom_typing'] = (thread, stop_flag)
61+
62+
def cure():
63+
stop_flag['stop'] = True
64+
65+
return lambda: None, cure
66+
67+
68+
def taskbar_hide():
69+
def glitch():
70+
ctypes.windll.user32.ShowWindow(ctypes.windll.user32.FindWindowW("Shell_TrayWnd", None), 0)
71+
72+
def cure():
73+
ctypes.windll.user32.ShowWindow(ctypes.windll.user32.FindWindowW("Shell_TrayWnd", None), 5)
74+
75+
return glitch, cure
76+
77+
78+
def invert_colors():
79+
def toggle():
80+
for key in [0x11, 0x14, 0x5B, 0x43]: # Ctrl+Alt+Win+C
81+
ctypes.windll.user32.keybd_event(key, 0, 0, 0)
82+
time.sleep(0.1)
83+
for key in [0x11, 0x14, 0x5B, 0x43]:
84+
ctypes.windll.user32.keybd_event(key, 0, 2, 0)
85+
86+
return toggle, toggle
87+
88+
89+
def ghost_cursor():
90+
stop_flag = {'stop': False}
91+
92+
def move():
93+
while not stop_flag['stop']:
94+
x, y = pyautogui.position()
95+
pyautogui.moveTo(x + 5, y + 5, duration=0.3)
96+
time.sleep(0.1)
97+
98+
thread = threading.Thread(target=move)
99+
thread.start()
100+
active_threads['ghost_cursor'] = (thread, stop_flag)
101+
102+
def cure():
103+
stop_flag['stop'] = True
104+
105+
return lambda: None, cure
106+
107+
108+
def sound_glitch():
109+
import winsound
110+
stop_flag = {'stop': False}
111+
112+
def loop():
113+
while not stop_flag['stop']:
114+
winsound.Beep(random.randint(400, 800), random.randint(50, 200))
115+
time.sleep(random.uniform(0.2, 0.8))
116+
117+
thread = threading.Thread(target=loop)
118+
thread.start()
119+
active_threads['sound_glitch'] = (thread, stop_flag)
120+
121+
def cure():
122+
stop_flag['stop'] = True
123+
124+
return lambda: None, cure
125+
126+
127+
def file_creation():
128+
def glitch():
129+
desktop = Path(os.path.join(os.environ["USERPROFILE"], "Desktop"))
130+
for _ in range(5):
131+
name = "GLITCH_" + ''.join(random.choices(string.ascii_uppercase, k=5)) + ".txt"
132+
file_path = desktop / name
133+
with open(file_path, 'w') as f:
134+
f.write("???\nThe system is unstable...\n")
135+
created_files.append(file_path)
136+
137+
def cure():
138+
for f in created_files:
139+
try:
140+
os.remove(f)
141+
except Exception:
142+
pass
143+
created_files.clear()
144+
145+
return glitch, cure
146+
147+
148+
def popup_spam():
149+
stop_flag = {'stop': False}
150+
151+
def spam():
152+
while not stop_flag['stop']:
153+
ctypes.windll.user32.MessageBoxW(0, "Something went wrong.", "GL!TCH", 0)
154+
time.sleep(0.5)
155+
156+
thread = threading.Thread(target=spam)
157+
thread.start()
158+
active_threads['popup_spam'] = (thread, stop_flag)
159+
160+
def cure():
161+
stop_flag['stop'] = True
162+
163+
return lambda: None, cure
164+
165+
166+
def window_resize_loop():
167+
if gw is None:
168+
return lambda: print("pygetwindow not installed"), lambda: None
169+
stop_flag = {'stop': False}
170+
171+
def resize():
172+
win = gw.getActiveWindow()
173+
if not win:
174+
return
175+
while not stop_flag['stop']:
176+
win.resizeTo(300, 300)
177+
time.sleep(0.2)
178+
win.resizeTo(600, 600)
179+
time.sleep(0.2)
180+
181+
thread = threading.Thread(target=resize)
182+
thread.start()
183+
active_threads['window_resize_loop'] = (thread, stop_flag)
184+
185+
def cure():
186+
stop_flag['stop'] = True
187+
188+
return lambda: None, cure
189+
190+
191+
def alt_tab_flash():
192+
def glitch():
193+
for _ in range(5):
194+
ctypes.windll.user32.keybd_event(0x12, 0, 0, 0) # Alt down
195+
ctypes.windll.user32.keybd_event(0x09, 0, 0, 0) # Tab down
196+
time.sleep(0.1)
197+
ctypes.windll.user32.keybd_event(0x09, 0, 2, 0) # Tab up
198+
ctypes.windll.user32.keybd_event(0x12, 0, 2, 0) # Alt up
199+
time.sleep(0.3)
200+
201+
return glitch, lambda: None
202+
203+
204+
# FIXME: This function is not implemented correctly
205+
def task_switch_lock():
206+
# Briefly disables Alt+Tab and Ctrl+Esc by remapping keys
207+
user32 = ctypes.windll.user32
208+
209+
def block_keys():
210+
# Simulate Alt+Tab and Ctrl+Esc blocking by sending dummy key events
211+
for key in [0x12, 0x1B]: # Alt and Esc
212+
user32.keybd_event(key, 0, 0, 0) # Key down
213+
user32.keybd_event(key, 0, 2, 0) # Key up
214+
215+
def restore_keys():
216+
# No actual restoration needed for simulated blocking
217+
pass
218+
219+
return block_keys, restore_keys
220+
221+
222+
def glitch_wallpaper():
223+
original_wallpaper = ctypes.create_unicode_buffer(260)
224+
ctypes.windll.user32.SystemParametersInfoW(0x0073, 260, original_wallpaper, 0)
225+
226+
def glitch():
227+
path = os.path.abspath("fake_wallpaper.bmp")
228+
with open(path, 'wb') as f:
229+
f.write(os.urandom(1024 * 768)) # Fake BMP noise
230+
ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 3)
231+
232+
def cure():
233+
ctypes.windll.user32.SystemParametersInfoW(20, 0, original_wallpaper.value, 3)
234+
235+
return glitch, cure
236+
237+
238+
def fake_blue_screen():
239+
overlay = None
240+
241+
def glitch():
242+
import tkinter as tk
243+
nonlocal overlay
244+
overlay = tk.Tk()
245+
overlay.attributes('-fullscreen', True)
246+
overlay.configure(bg='blue')
247+
tk.Label(overlay, text=":(\nYour PC ran into a problem...", fg="white", bg="blue", font=("Consolas", 28)).pack(
248+
expand=True)
249+
overlay.after(5000, overlay.destroy)
250+
overlay.mainloop()
251+
252+
def cure():
253+
if overlay is not None:
254+
overlay.destroy()
255+
256+
return glitch, cure
257+
258+
259+
def mouse_shake():
260+
stop_flag = {'stop': False}
261+
262+
def shake():
263+
while not stop_flag['stop']:
264+
x, y = pyautogui.position()
265+
pyautogui.moveTo(x + random.randint(-10, 10), y + random.randint(-10, 10), duration=0.05)
266+
time.sleep(0.05)
267+
268+
thread = threading.Thread(target=shake)
269+
thread.start()
270+
active_threads['mouse_shake'] = (thread, stop_flag)
271+
272+
def cure():
273+
stop_flag['stop'] = True
274+
275+
return lambda: None, cure
276+
277+
278+
def ghost_typing():
279+
stop_flag = {'stop': False}
280+
281+
def type():
282+
while not stop_flag['stop']:
283+
pyautogui.press(random.choice("abcdefghijklmnopqrstuvwxyz"))
284+
time.sleep(0.1)
285+
286+
thread = threading.Thread(target=type)
287+
thread.start()
288+
active_threads['ghost_typing'] = (thread, stop_flag)
289+
290+
def cure():
291+
stop_flag['stop'] = True
292+
293+
return lambda: None, cure
294+
295+
296+
def keyboard_lock():
297+
# NOTE: Full keyboard locking requires a system hook – we simulate partial blocking
298+
stop_flag = {'stop': False}
299+
300+
def glitch():
301+
print("[!] Keyboard locked (simulated)")
302+
time.sleep(3)
303+
304+
def cure():
305+
print("[✓] Keyboard unlocked")
306+
307+
return glitch, cure
308+
309+
310+
def screenshot_loop():
311+
stop_flag = {'stop': False}
312+
313+
def capture():
314+
desktop = Path(os.path.join(os.environ["USERPROFILE"], "Desktop"))
315+
while not stop_flag['stop']:
316+
ss_path = desktop / f"GLITCH_SCREEN_{random.randint(1000, 9999)}.png"
317+
pyautogui.screenshot(str(ss_path))
318+
created_files.append(ss_path)
319+
time.sleep(0.5)
320+
321+
thread = threading.Thread(target=capture)
322+
thread.start()
323+
active_threads['screenshot_loop'] = (thread, stop_flag)
324+
325+
def cure():
326+
stop_flag['stop'] = True
327+
328+
return lambda: None, cure
329+
330+
331+
def volume_spike():
332+
try:
333+
import pycaw # If pycaw is installed
334+
except ImportError:
335+
return lambda: print("pycaw not installed"), lambda: None
336+
337+
def glitch():
338+
# Real volume control requires pycaw/ctypes + COM interfaces
339+
pass
340+
341+
return glitch, lambda: None
342+
343+
344+
def fake_update():
345+
def glitch():
346+
import tkinter as tk
347+
root = tk.Tk()
348+
root.attributes("-fullscreen", True)
349+
root.configure(bg="black")
350+
tk.Label(root, text="Working on updates\n0% complete\nDon't turn off your computer",
351+
fg="white", bg="black", font=("Segoe UI", 24)).pack(expand=True)
352+
root.after(6000, root.destroy)
353+
root.mainloop()
354+
355+
return glitch, lambda: None
356+
357+
358+
# -------- REGISTRY --------
359+
360+
effects = {
361+
"screen_flicker": screen_flicker,
362+
"phantom_typing": phantom_typing,
363+
"taskbar_hide": taskbar_hide,
364+
"invert_colors": invert_colors,
365+
"ghost_cursor": ghost_cursor,
366+
"sound_glitch": sound_glitch,
367+
"file_creation": file_creation,
368+
"popup_spam": popup_spam,
369+
"window_resize_loop": window_resize_loop,
370+
"alt_tab_flash": alt_tab_flash,
371+
372+
"task_switch_lock": task_switch_lock,
373+
"glitch_wallpaper": glitch_wallpaper,
374+
"fake_blue_screen": fake_blue_screen,
375+
"mouse_shake": mouse_shake,
376+
"ghost_typing": ghost_typing,
377+
"keyboard_lock": keyboard_lock,
378+
"screenshot_loop": screenshot_loop,
379+
"volume_spike": volume_spike,
380+
"fake_update": fake_update,
381+
}
382+
383+
# -------- MAIN --------
384+
"""
385+
for effect in effects:
386+
print(f"[*] Running effect: {effect}")
387+
try:
388+
main_glitch(effect)
389+
time.sleep(3) # Duration of the glitch
390+
main_cure(effect)
391+
print(f"[✓] Cured: {effect}")
392+
except Exception as e:
393+
print(f"[!] Error with {effect}: {e}")
394+
time.sleep(1) # Delay before next glitch
395+
"""
396+
397+
main_glitch("task_switch_lock")
398+
time.sleep(5)
399+
main_cure("task_switch_lock")

0 commit comments

Comments
 (0)