![]() |
|
[Python] Is it possible to make a file not closable (?) on Task Manager with Python? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Python] Is it possible to make a file not closable (?) on Task Manager with Python? (/showthread.php?tid=5723305) |
Is it possible to make a file not closable (?) on Task Manager with Python? - delta248 - Sep 23, 2017 So I was just making a quick joke program to annoy some friends... And tought, is it possible to do what is mentioned in the title? I've seen some do it with visualbasic, but is it possible with Python? * - koolkid - Sep 23, 2017 (Sep 23, 2017 07:42 AM)delta248 Wrote: So I was just making a quick joke program to annoy some friends... im not sure about it in python but I know about it in VB6 but you could write a sub app which check to see if the file is still open if not it reopens it. most importantly it is Python anything is possible * - BrBi - Sep 23, 2017 just do it as a .bat file... search google for bat prank viruses , it will show up a lot of results you can choose from * - delta248 - Sep 23, 2017 (Sep 23, 2017 08:22 AM)BrBi Wrote: just do it as a .bat file... search google for bat prank viruses , it will show up a lot of results you can choose fromnah most of my friends already know the .bat stuff, i'm just making something to waste their time * - TheWarOwl - Sep 23, 2017 You could in terms of task manager. Just have a process watcher (2 processes that reopen the other if the other closes) Some people scan through everything running, but you could have both open a file and have the other try to access it (only one program can access it at a time) if it doesn't throw an error we know one of the Processes are closed... Orr even something like check if the other's mutex is available for being registered, if so it's closed. You can get really creative with it lol. If you want it to only to be unkillable by task manager you're going to need to elevate your privileges above what taskmanager is running. That or set the process to "critical" so the computer bluescreens if it's killed. I don't know the specifications of doing that though. * - nOrr - Sep 23, 2017 What happens when you kill a process through the task manager is that a kill flag is set in the process. The process is then free to decide what to do about it. Because you're running python through python.exe (or similar executable) you're not able to control what happens. The only ways that I know of to prevent an actual termination is to either use a low-level language and take over any possible default behaviour, or to make the process hang in a low-level wait state, e.g. waiting on I/O which never happens (and has no timeout) on kernel-level - which is "below" the "level" on which a process is able to react to kill flags being set. * - Wiked™ - Sep 23, 2017 Quote:from win32com.client import GetObject https://stackoverflow.com/questions/22351952/how-to-know-whether-a-process-in-windows-is-running-or-not-in-python |