Forum: Geek Forum
Topic: killer app programming
started by: damien_s_lucifer

Posted by damien_s_lucifer on May 25 2001,02:25
I was very bored today, and thought up this little Perl script :

code:

while (1) { fork(); }

That is the shortest and fastest way I can think of to bring a Unix box0r to its knees. As soon as I started the program the hard drive light turned red, and it has been on ever since... about 10 minutes since I closed the telnet session, and it STILL hasn't shut down.

So, my challenge to you... write something even shorter.


Posted by Sithiee on May 25 2001,04:00
AAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHH!!!!! i just typed up this huge thing about this program i wrote in comp sci that would take 12 years to finish, and the browser just lost it. oh well.

anyway, i think that somethign like this might work in the same fashion, but more wastefully....oh, and its been a long time since ive coded, so this is my own version of pure/c++ that i hope you understand.

code:

function breakthecomputer(vector<long> takeupspace)
{
takeupspace.resize(takeupspace.length() + 1);
takeupspace[takeupspace.length] = random(long);
breakthecomputer(takeupspace);
}


note the using a vector, known for bad implementations, as well as the adding of longs, and making a completely new copy of the vector in each instance. this should (i think) take up memory faster than just having lots of instances of a function. but i could, and amd probably wrong. but thats prolly how id do it.
Posted by damien_s_lucifer on May 25 2001,18:35
Sithee, I tried out this version of what you're doing :

code:

void breakme()
{
void* foo;
foo=malloc(10000000);
breakme();
}

main()
{
breakme();
}


And here's the result of the run :

code:

jon@hadron:~> a.out
Killed
jon@hadron:~>

It took about 2 minutes before it exhausted the memory. During that time I could still log in and execute commands. I have no idea what would happen in Windows, since I don't have a C compiler

Does someone want to try it and post what happens? I'm guessing that the same thing will happen - the prog will run for a while, and then die when it exhausts the memory.

I suppose an explanation of how my proggie works is in order. fork() is a system call that creates a new process that is an exact duplicate of the one that called fork() - all global and local vars, filehandles, sockets, etc. are duplicated. Both the old and new process continue execution at the statement immediately following the fork; the function returns 0 to the child process and the kid's PID to the parent process.

If you use Java, it's a bit like creating a new thread, except that the new process gets it's own memory space. Usually you use it like this :

code:

if (pid = fork())
{
// we're the parent process, do something
// while we wait for the child to exit.
}
else
{
// we're the child process, do something
// and exit.
}

in my case, though, the program just repeatedly calls fork() - and each of its children does the same thing. So each iteration of the loop spawns 2^(n+1) new processes, which means that by the 15th iteration you've completely filled up the Unix process table & no new processes can be started - at which point the kernel flips out completely

If you haven't used fork() in a proggie yet, I *highly* recommend you try it. It makes writing certain programs, like servers, *VERY* easy. Just beware of looping yourself into process hell.


Posted by Sithiee on May 26 2001,01:32
so wait, if after 10 minutes, yours was still running, but mine crashed it in 2, does that mean i win your challenge?
Posted by ASCIIMan on May 26 2001,04:13
I wrote a program about two years ago in C++ using malloc that would crash Win9x in ~15 seconds. Does that count?
Posted by Spydir on May 26 2001,16:20
me and my friend used to have this x86 asm program for windows that would litterally fry a CPU (we tested it on a 486 and a pentium). It would pipe so much random data to the proc the transistors just shorted out.

I have no idea how we did it, cuz we got rid of all the code. We were all "this would be evil if it got in the wrong hands!" and shit... then a few months after deleting it I realized it would also be damned cool at parties...

------------------
Net Syndrome - < http://www.netsyndrome.net/ >
Spydir Web - < http://www.netsyndrome.net/spydirweb/ >


Posted by damien_s_lucifer on May 26 2001,17:52
quote:
Originally posted by ASCIIMan:
I wrote a program about two years ago in C++ using malloc that would crash Win9x in ~15 seconds. Does that count?

Post it here, man!! Let's see it!

Sithee : mine caused the machine to freeze instantly; I just waited for about 1/2 hour after I killed the telnet session to see if it would recover. It didn't hehehehe... the other one I posted was killed by the OS after 2 minutes; the machine is still up & running perfectly.

Many years ago I heard you could fry a CPU with something like this :

<6502 assembly>
LDA #2
LOOP:
SBC #2
BNE LOOP
</6502 assembly>

The hypothesis was that a tight infinate loop would overheat the CPU and it would break. I tried it on an Atari 400... it ran for 2 days straight. When I rebooted the Atari still ran just fine.

So does anyone have something to make the computer do weird things? Shit like that is fun.

Here's another one for ya :

<perl>
# open FILE for writing
open (FILE,">fuckyou") or die "Couldn't open file : $! ";

# keep writing 'tll the drive is full
while (1) { print FILE "fuck you! "; }
</perl>

I've found that Linux does weird things when a drive is full...


Posted by ASCIIMan on May 27 2001,03:43
quote:
Originally posted by damien_s_lucifer:
Post it here, man!! Let's see it!

The source went missing shortly after I used it on my old hs's lab computers (in other words, I deleted it, because I was supposed to be monitoring the lab / messing with the network administration and wasn't supposed to be setting a bad example for all the little 5cr1p+ |<1dd13s in non-ap CS...).

Basically what it did was allocate a meg or so of ram, then fork. Windows doesn't like it when it runs out of memory. IIRC, NT wasn't affected when I ran it on one of the servers (that wasn't doing anything productive at the moment).


Posted by beuges on May 27 2001,08:38
last night i was bored, so i typed this up in c++ builder 4:

void kill_me() {
long double *d = new long double[10000];
kill_me();
}

int main() {
kill_me();
return 0;
}

As soon as i clicked run, my memory graph shot through the roof. although i have 384mb ram, task manager reported my memory usage as being 790mb. as soon as it started running, win2k told me i was out of virtual memory. about the same time, builder told me i was out of stack space. i would have taken a screen shot, but every time i pressed printscreen, windows said i didn't have enough memory to store the bitmap


Posted by damien_s_lucifer on May 27 2001,08:41
quote:
Originally posted by ASCIIMan:
Basically what it did was allocate a meg or so of ram, then fork.

How did you fork in Windows? It was my understanding that windows can't really fork, you can just start new threads or exec a new process. If there is a true fork, I wanna know about it...


Posted by PersonGuy on May 28 2001,14:23
Here's a fun little progi that IIIII invented for TI Calculators:
note: "->" = store-to

code:

:Lbl X
:Input "",A
:A->B
:While B=A
:A+((int(A/10*rand+1))-(int(A/10*rand)))->B
:End
:Disp B
:Goto X

Secretly put this on the calculator of your victim an run it and clear the screen. It will look and work like the calculator is working perfectly normally except that EVERY answer it gives will be wrong by a small fraction (so it's hard for them to notice if they don't pay attention). Best of all when they DO notice (if they are lam0rs) think it's just broken and freak out! :D

Output:

code:

8+3
12
735+698
1479
563/2
270.5
777-456
326
777-456
308

Also great for ones on display at Office Depot...
HEHEHEHEHEHEHEHE >:-]

------------------
"OH GGOD!!! NOT THE HYLIGHTER AGAIN!!! GO AWAY YOU LITTLE PEANUT HEDGEHOG!!!"
"The only thread about ME likened me to poo shaped mummy."
"Have a nice day, because monkeys don't."
-< PersonGuy >

This message has been edited by PersonGuy on May 29, 2001 at 09:25 AM


Posted by ASCIIMan on May 28 2001,17:19
Sorry, I meant to say it started a new thread.
Posted by damien_s_lucifer on May 29 2001,03:36
that's pretty evil, PG. I like it

Let's not forget this old trick :

1. Find unattended Winbox on display.
2. Get a command prompt
3. Type this :
copy con win.com [enter]
4. Press F6, Enter.
4. Exit the command prompt, smile confidently, and walk away. Nothing will happen until the next reboot, when the dummies will be greeted with a command prompt.


Posted by PersonGuy on May 29 2001,14:12
I don't remember EXACTLY how this one works but on Win95 click on the start button so the menu pops up. Then click the button again so the menu goes down but "START" is selected. Then press "ALT" and "-" and it could bring up a menu. Select "close" and the start button will dissapear! Perfect for libraries that use old Win95 computers.

------------------
"OH GGOD!!! NOT THE HYLIGHTER AGAIN!!! GO AWAY YOU LITTLE PEANUT HEDGEHOG!!!"
"The only thread about ME likened me to poo shaped mummy."
"Have a nice day, because monkeys don't."
-< PersonGuy >


Posted by Unexplained on May 30 2001,05:08
quote:
Originally posted by damien_s_lucifer:
I was very bored today, and thought up this little Perl script :

code:

while (1) { fork(); }

That is the shortest and fastest way I can think of to bring a Unix box0r to its knees. As soon as I started the program the hard drive light turned red, and it has been on ever since... about 10 minutes since I closed the telnet session, and it STILL hasn't shut down.



Some sysadmin did some bad configuring...
Any good admin limits forks/processes. (normally max 64/user)
Posted by damien_s_lucifer on May 30 2001,05:33
quote:
Originally posted by Unexplained:
Some sysadmin did some bad configuring...
Any good admin limits forks/processes. (normally max 64/user)

Since I'm the sysadmin of that system, myu question is "How?"


Powered by Ikonboard 3.1.4 © 2006 Ikonboard