Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Is it possible to make a file not closable (?) on Task Manager with Python?

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?
(Sep 23, 2017 07:42 AM)delta248 Wrote:  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?

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
Knowledge is Power - Be Powerful!!!!!


LIFE IS A CHALLENGE SO ACCEPT IT!
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
(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 from
nah most of my friends already know the .bat stuff, i'm just making something to waste their time
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.
[Image: 5BgQiIm.gif]

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.
[Image: TEGE4Zx.png]

Puzzle level: 2/5
Quote:from win32com.client import GetObject
WMI = GetObject('winmgmts:')
processes = WMI.InstancesOf('Win32_Process')

if "python.exe" in [process.Properties_('Name').Value for process in processes]:
#do the thing

https://stackoverflow.com/questions/2235...-in-python


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by Too FarJul 14, 2022 09:00 AM 2 159 Jul 14, 2022 09:00 AM
Last Post: Too Far
[Python] by SIM-4791248Aug 17, 2021 08:06 AM 2 110 Aug 17, 2021 08:06 AM
Last Post: SIM-4791248