From 3f1611dde160b61699a1a2dc411e28c5304667e8 Mon Sep 17 00:00:00 2001 From: suti7yk5032 Date: Fri, 7 Jun 2024 22:28:51 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=B9=E3=82=AF=E3=83=9E=E3=83=8D?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A3=E3=83=BC=E5=AF=BE=E7=AD=96=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E7=AC=AC=E4=B8=80=E6=AD=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dislocker_client.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dislocker_client.py b/dislocker_client.py index 0189fc0..1e6d213 100644 --- a/dislocker_client.py +++ b/dislocker_client.py @@ -4,6 +4,9 @@ import json import customtkinter from winotify import Notification, audio import keyboard +import wmi +import subprocess +import asyncio class App(customtkinter.CTk): def __init__(self): @@ -17,6 +20,7 @@ class App(customtkinter.CTk): self.restore_button = customtkinter.CTkButton(self.frame, text='認証ウィンドウを再表示', command=self.handler_close, width=240) self.restore_button.grid(row=0, column=0) + asyncio.run(self.task_watcher_run()) self.block_key() lock = Lock() @@ -40,6 +44,24 @@ class App(customtkinter.CTk): success.set_audio(audio.Default, loop=False) success.show() + async def task_watcher_run(self): + taskmgr_killer = asyncio.create_task(self.task_watcher()) + + async def task_watcher(self): + c=wmi.WMI() + cre_process_watcher=c.Win32_Process.watch_for("creation") + del_process_watcher=c.Win32_Process.watch_for("deletion") + + self.i = 1 + + while self.i == 1: + new_cre_process=cre_process_watcher() + new_del_process=del_process_watcher() + print(new_cre_process.Caption+" has been created") + if new_cre_process.Caption == "Taskmgr.exe": + taskmgr_kill = subprocess.run(['taskkill', '/im', 'Taskmgr.exe']) + print(new_del_process.Caption+" has been deleted ") + def handler_close(self): pass