Pages

15 March 2011

zombiebomb.c

#include 
#include 
/*
* 23:30:37 @d4wfl1n> /bin/sh -c 'echo -n kill -STOP $$ \; ; echo -n sleep 1\; ; sleep 1000 &  echo kill -KILL $! ; echo ; echo ; sleep 1000'  | sh -x
*/

int main(int argc, char *argv[]) {
 int i, c = (argc > 1 ? atoi(argv[1]) : 1024);

 printf("will create %d zombies. press  or \n", c);
 getchar();

 printf("creating %d zombies\n");
 for (i = 0; i < c; i++) {
  if (fork() == 0) {
   exit(0);
  }
 }

 printf("Press  to exit and let shell reap them\n", c);
 getchar();
 printf("exiting...\n");
}

0 comments: