我初中时用Python编的再见极域,很多功能没有实现,但基本的杀、冻结还是很好用的。
也不懂太多什么版不版权的,反正都是我自己写的
(现在两年后回过来看,当年写得好丑。。。)
尊重极域,仅作学习用,禁止用来做些有害的事情。还是建议好好上你的信息课
import os
from tkinter import *
from tkinter.messagebox import *
import psutil
root = Tk()
root.geometry('280x320')
root.title('再见极域')
root.wm_attributes('-topmost', 1)
root.resizable(False, False)
root.configure(bg = '#1E1E1E')
font1 = ('微软雅黑', 9)
font2 = ('Courier New', 16, 'bold')
font3 = ('微软雅黑', 10)
ICED = False
TOP = True
CON = True
Label(root, text = '极域状态', bg = '#1E1E1E', fg = '#A0A0A0', font = font1).place(x = 0, y = 10, width = 140, height = 20)
Label(root, text = '广播状态', bg = '#1E1E1E', fg = '#A0A0A0', font = font1).place(x = 140, y = 10, width = 140, height = 20)
Label(root, text = '键盘状态', bg = '#1E1E1E', fg = '#A0A0A0', font = font1).place(x = 0, y = 70, width = 140, height = 20)
Label(root, text = '置顶状态', bg = '#1E1E1E', fg = '#A0A0A0', font = font1).place(x = 140, y = 70, width = 140, height = 20)
la = Label(root, bg = '#1E1E1E', font = ('Courier New', 13, 'bold'))
lb = Label(root, bg = '#1E1E1E', font = font2)
lc = Label(root, text = 'OPENED', fg = 'lime', bg = '#1E1E1E', font = font2)
ld = Label(root, text = 'ON', fg = 'lime', bg = '#1E1E1E', font = font2)
la.place(x = 0, y = 30, width = 140, height = 45)
lb.place(x = 140, y = 30, width = 140, height = 45)
lc.place(x = 0, y = 90, width = 140, height = 45)
ld.place(x = 140, y = 90, width = 140, height = 45)
def cba1():
ba.config(fg = '#660000', bg = 'red', activeforeground = 'red', activebackground = '#660000', text = '上键盘锁', command = cba2)
lc.config(text = 'OPENED', fg = 'lime')
#---------------------------
#----------开键盘锁----------
#---------------------------
def cba2():
ba.config(fg = '#006600', bg = 'lime', activeforeground = 'lime', activebackground = '#006600', text = '开键盘锁', command = cba1)
lc.config(text = 'LOCKED', fg = 'red')
#---------------------------
#----------上键盘锁----------
#---------------------------
ba = Button(root, text = '上键盘锁', borderwidth = 0, bg = 'red', font = font3, activeforeground = 'red', activebackground = '#660000', relief = GROOVE, fg = '#660000', command = cba2)
ba.place(x = 10, y = 140, width = 125, height = 45)
def cbb1():
bb.config(fg = '#660000', bg = 'red', activeforeground = 'red', activebackground = '#660000', text = '取消置顶', command = cbb2)
ld.config(text = 'ON', fg = 'lime')
TOP = 1
root.wm_attributes('-topmost', 1)
def cbb2():
bb.config(fg = '#006600', bg = 'lime', activeforeground = 'lime', activebackground = '#006600', text = '置顶窗口', command = cbb1)
ld.config(text = 'ON', fg = 'red')
TOP = 0
root.wm_attributes('-topmost', 0)
bb = Button(root, text = '取消置顶', borderwidth = 0, bg = 'red', font = font3, activeforeground = 'red', activebackground = '#660000', relief = GROOVE, fg = '#660000', command = cbb2)
bb.place(x = 145, y = 140, width = 125, height = 45)
# 这三个功能暂时没弄
def cbc():
bc['state'] = 'disabled'
bd['state'] = 'normal'
be['state'] = 'normal'
#---------------------------
#-----------窗口化----------
#---------------------------
def cbd():
bc['state'] = 'normal'
bd['state'] = 'disabled'
be['state'] = 'normal'
#---------------------------
#-----------最小化----------
#---------------------------
def cbe():
bc['state'] = 'normal'
bd['state'] = 'normal'
be['state'] = 'disabled'
#---------------------------
#----------复原窗口----------
#---------------------------
bc = Button(root, text = '窗口化', borderwidth = 0, font = font3, bg = '#00A7FF', activeforeground = '#00A7FF', activebackground = '#0000BF', relief = GROOVE, fg = '#0000BF', command = cbc)
bc.place(x = 10, y = 195, width = 76, height = 45)
bd = Button(root, text = '最小化', borderwidth = 0, font = font3, bg = '#00A7FF', activeforeground = '#00A7FF', activebackground = '#0000BF', relief = GROOVE, fg = '#0000BF', command = cbd)
bd.place(x = 96, y = 195, width = 76, height = 45)
be = Button(root, text = '复原窗口', borderwidth = 0, font = font3, bg = '#00A7FF', activeforeground = '#00A7FF', activebackground = '#0000BF', relief = GROOVE, fg = '#0000BF', command = cbe)
be['state'] = 'disabled'
be.place(x = 182, y = 195, width = 88, height = 45)
def cbf():
os.system('taskkill /im StudentMain.exe /f')
showinfo('成功', '操作成功执行!')
# ntsd 需要事先放到下面这个路径
def cbg():
os.system('C:\\Windows\\Temp\\ntsd.exe -c q -pn StudentMain.exe')
showinfo('成功', '操作成功执行!')
def cbh1():
global ICED
s = []
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs = ['pid', 'name'])
except psutil.NoSuchProcess:
pass
else:
s.append(pinfo)
for i in s:
if i['name'] == 'StudentMain.exe':
p = i['pid']
break
pro = psutil.Process(p)
pro.suspend()
ICED = True
bh.config(fg = '#660000', bg = 'red', text = '解冻极域', activeforeground = 'red', activebackground = '#660000', command = cbh2)
def cbh2():
global ICED
s = []
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs = ['pid', 'name'])
except psutil.NoSuchProcess:
pass
else:
s.append(pinfo)
for i in s:
if i['name'] == 'StudentMain.exe':
p = i['pid']
break
pro = psutil.Process(p)
pro.resume()
ICED = False
bh.config(fg = '#006600', bg = 'lime', text = '冻结极域', activeforeground = 'lime', activebackground = '#006600', command = cbh1)
bf = Button(root, text = 'TASKKILL', borderwidth = 0, fg = '#006600', bg = 'lime', activeforeground = 'lime', activebackground = '#006600', relief = GROOVE, command = cbf)
bf.place(x = 10, y = 255, width = 80, height = 45)
bg = Button(root, text = 'NTSD', borderwidth = 0, fg = '#006600', bg = 'lime', activeforeground = 'lime', activebackground = '#006600', relief = GROOVE, command = cbg)
bg.place(x = 100, y = 255, width = 80, height = 45)
bh = Button(root, text = '冻结极域', borderwidth = 0, fg = '#006600', bg = 'lime', activeforeground = 'lime', activebackground = '#006600', relief = GROOVE, command = cbh1)
bh.place(x = 190, y = 255, width = 80, height = 45)
FUCKED = False
def fla():
global ICED, FUCKED, CON
s = []
k = []
for proc in psutil.process_iter():
try:
pinfo = proc.as_dict(attrs = ['pid', 'name'])
except psutil.NoSuchProcess:
pass
else:
s.append(pinfo['name'])
k.append(pinfo)
if 'StudentMain.exe' in s:
if CON:
la.config(font = ('Courier New', 13, 'bold'))
CON = False
for i in k:
if i['name'] == 'StudentMain.exe':
we = i['pid']
break
if ICED:
la.config(text = 'ICED', fg = 'yellow')
lb.config(text = 'ICED', fg = 'yellow')
else:
la.config(text = f'ON\npid={we}', fg = 'red')
lb.config(text = 'UNKNOWN', fg = 'yellow')
if FUCKED:
bc['state'] = 'normal'
bd['state'] = 'normal'
be['state'] = 'disabled'
bf['state'] = 'normal'
bg['state'] = 'normal'
bh['state'] = 'normal'
FUCKED = False
else:
CON = True
la.config(text = 'OFF', fg = 'lime')
lb.config(text = 'OFF', fg = 'lime')
bc['state'] = 'disabled'
bd['state'] = 'disabled'
be['state'] = 'disabled'
bf['state'] = 'disabled'
bg['state'] = 'disabled'
bh['state'] = 'disabled'
la.config(font = font2)
FUCKED = True
if TOP:
root.attributes('-topmost', 1)
root.after(700, fla)
root.after(500, fla)
root.mainloop()