RE: More info on dd?

From: Ed Carp (ercat_private)
Date: Tue Oct 15 2002 - 18:05:23 PDT

  • Next message: Morris, Rod: "Future trends in computer forensics"

    > "Deleting data does not get rid of it unless you wipe the file."
    > 
    > "Most wiping products do NOT work as advertised, and none of them really
    > verify that the data was wiped."
    
    Hmmm, don't know why - it's not that tough to do:
    
    #include <stdio.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <unistd.h>
    #undef NULL
    #define NULL (0)
    char a[4];
    
    main ()
    {
      char fn[255];
      char lbuf[65535];
      char lbuf2[65535];
      int p, i, j, n, r;
      char c;
    
      a[0] = '\0';
      a[1] = 0x0f;
      a[2] = 0xf0;
      a[3] = 0xff;
      while (fgets (fn, 253, stdin) != (char *) NULL)
      {
        fn[strlen (fn) - 1] = NULL;
        chmod (fn, 0622);
        n = open (fn, O_RDWR);
        if (n < 1)
        {
          perror (fn);
          continue;
        }
        for (i = 0; i < 4; i++)
        {
          printf ("\rSecure wipe '%s', pass %d", fn, i + 1);
          fflush (stdout);
          for (j = 0; j < 65535; j++)
            lbuf2[j] = a[i];
          while (1)
          {
            if ((p = read (n, lbuf, 65530)) < 1)
              break;
            lseek (n, -1 * p, SEEK_CUR);
            if (EOF == write (n, lbuf2, p))
            {
              perror ("write");
              continue;
            }
          }
          lseek (n, 0, SEEK_SET);
        }
        close (n);
        unlink (fn);
        puts ("");
      }
    }
    
    -----------------------------------------------------------------
    This list is provided by the SecurityFocus ARIS analyzer service.
    For more information on this free incident handling, management 
    and tracking system please see: http://aris.securityfocus.com
    



    This archive was generated by hypermail 2b30 : Fri Oct 18 2002 - 04:28:29 PDT