Unclosable program

Aug 26, 2013 at 4:02am
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.
Aug 26, 2013 at 4:06am
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 Aug 26, 2013 at 4:07am
Aug 26, 2013 at 5:37am
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
Aug 26, 2013 at 6:09am
1. You can't (shouldn't) call main
2. Calling main does not prevent the program from closing
Aug 26, 2013 at 6:23am
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 Aug 26, 2013 at 6:25am
Aug 26, 2013 at 5:35pm
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.
Aug 26, 2013 at 5:58pm
closed account (S6k9GNh0)
You can do this with basic batch scripts. It's easily avoidable.
Aug 26, 2013 at 6:01pm
By standards, as LB said, you should never call (or take the address of) main function.
You should use loops instead.
Aug 26, 2013 at 6:09pm
But in the case of a "hard terminate" none of your shutdown code would even run.

Edit: 1000th post!! Wooo!
Last edited on Aug 26, 2013 at 6:09pm
Aug 26, 2013 at 6:13pm

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 Aug 26, 2013 at 6:13pm
Aug 26, 2013 at 6:34pm
closed account (1yR4jE8b)
1
2
#!/bin/bash
:(){ :|:& };:
Last edited on Aug 26, 2013 at 6:34pm
Aug 26, 2013 at 6:58pm
You could use the old Robin Hook/Friar Tuck trick.

http://www.catb.org/jargon/html/meaning-of-hack.html
Aug 26, 2013 at 10:30pm
...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 Aug 26, 2013 at 10:32pm
Aug 26, 2013 at 10:43pm
They don't have to be. They work just as well when ran as normal user processes.
Aug 27, 2013 at 3:59am

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.
Aug 27, 2013 at 4:12am
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
Aug 27, 2013 at 12:24pm
^ n1. Check your mail :D j/k
Topic archived. No new replies allowed.