# !/usr/bin/python
# -*- coding: utf-8 -*-
import tkinter as tk
from tkinter import filedialog
import sys
sys.path.append('../')
from CodeLogic.check_senstive_word import saomiao
path_list = []
def visualization():
window=tk.Tk()
window.title('敏感词检测工具')
window.geometry('600x380')
tk.Label(window,text="文件路径夹:").place(x=10,y=10)
var_name2=tk.StringVar() #文件夹输入路径变量
entry_name=tk.Entry(window,textvariable=var_name2,width=55)
entry_name.place(x=100,y=10)
#输入文件夹路径
def selectPath_dir():
path_ = filedialog.askdirectory()
var_name2.set(path_)
path_list.append(path_)
return path_
tk.Button(window, text = "路径选择", bg='yellow',height=1,width=9, bd=2, command = selectPath_dir).place(x=520,y=8)
tk.Label(window,text="敏感词:").place(x=10,y=40)
label2 = tk.Entry(window,font=("宋体",12),fg="red",width=48)
label2.place(x=99,y=40)
def func():
path_ = path_list[-1]
senstive_word = label2.get()
res = saomiao(path_, senstive_word)
text.insert('insert',"==================================================\n")
text.insert('insert',"\n".join(res) + "\n")
#删除函数,text是文本框的名字
def clearBox():
text.delete("1.0", "end")
b1 = tk.Button(window,text="确定", bg='green', disabledforeground='red',command=func).place(x=20,y=72)
b2 = tk.Button(window,text="清空",bg='red',command=clearBox).place(x=80,y=72)
# 新建文本框
text = tk.Text(window, width=82, height=60)
# 布局
text.grid(padx=10, pady=110)
window.mainloop()
if __name__ == '__main__':
visualization()
import tkinter as tk
from tkinter import filedialog
import sys
sys.path.append('../')
from CodeLogic.check_digital_signature import check_signers
window=tk.Tk()
window.title('数字签名及文件检测工具')
window.geometry('600x380')
tk.Label(window,text="检查签名文件:").place(x=10,y=10)
var_name=tk.StringVar() #文件输入路径变量
entry_name=tk.Entry(window,textvariable=var_name,width=55)
entry_name.place(x=100,y=10)
path_list = []
#输入文件路径
def selectPath_file():
path_ = filedialog.askopenfilename(filetypes=[("exe,dll",[".exe", ".dll"])])
var_name.set(path_)
path_list.append(path_)
return path_
#输入文件夹路径
def selectPath_dir():
path_ = filedialog.askdirectory()
var_name2.set(path_)
return path_
def func():
path_ = path_list[-1]
res = check_signers(path_)
text.insert('insert',"==================================================\n")
text.insert('insert',"\n".join(res) + "\n")
tk.Button(window, text = "选择文件", bg='yellow',height=1,width=9, bd=2, command = selectPath_file).place(x=520,y=8)
# tk.Button(window, text = "路径选择", command = selectPath_dir).place(x=520,y=42)
#删除函数,text是文本框的名字
def clearBox():
text.delete("1.0", "end")
b1 = tk.Button(window,text="确定", bg='green', disabledforeground='red',command=func).place(x=20,y=42)
b2 = tk.Button(window,text="清空",bg='red', command=clearBox).place(x=80,y=42)
# 新建文本框
text = tk.Text(window, width=82, height=60)
# 布局
text.grid(padx=10, pady=80)
window.mainloop()