Thursday, August 10, 2006
Clearing Unallocated Space on Windows
The other day I came across a very interesting tool while researching ways to clear unallocated space on a Windows machine. This process is very well documented for *nix machines using "dd" and "/dev/zero", however I was unaware of a similar process for Windows based OS's. The tool in question is included in Windows XP and is called "cipher.exe". This tool has many uses as the following output shows:
C:\Documents and Settings\Administrator>cipher /?
Displays or alters the encryption of directories [files] on NTFS partitions.
CIPHER [/E | /D] [/S:dir] [/A] [/I] [/F] [/Q] [/H] [/K] [pathname [...]]
CIPHER /W:directory
CIPHER /X[:efsfile] [filename]
/E Encrypts the specified directories. Directories will be marked
so that files added afterward will be encrypted.
/D Decrypts the specified directories. Directories will be marked
so that files added afterward will not be encrypted.
/S Performs the specified operation on directories in the given
directory and all subdirectories.
/A Operation for files as well as directories. The encrypted file
could become decrypted when it is modified if the parent directory
is not encrypted. It is recommended that you encrypt the file and
the parent directory.
/I Continues performing the specified operation even after errors
have occurred. By default, CIPHER stops when an error is
encountered.
/F Forces the encryption operation on all specified objects, even
those which are already encrypted. Already-encrypted objects
are skipped by default.
/Q Reports only the most essential information.
/H Displays files with the hidden or system attributes. These
files are omitted by default.
/K Create new file encryption key for the user running CIPHER. If this
option is chosen, all the other options will be ignored.
/W Removes data from available unused disk space on the entire
volume. If this option is chosen, all other options are ignored.
The directory specified can be anywhere in a local volume. If it
is a mount point or points to a directory in another volume, the
data on that volume will be removed.
/X Backup EFS certificate and keys into file filename. If efsfile is
provided, the current user's certificate(s) used to encrypt the
file will be backed up. Otherwise, the user's current EFS
certificate and keys will be backed up.
dir A directory path.
pathname Specifies a pattern, file or directory.
efsfile An encrypted file path.
Used without parameters, CIPHER displays the encryption state of
the current directory and any files it contains. You may use multiple
directory names and wildcards. You must put spaces between multiple
parameters.
Now the point of interest to me lies in the "/W" option. This if specified, will clear data on any unused portions of the disk specified. I figured I would give this a try on a Windows 2000 Pro laptop.
C:\Documents and Settings\Administrator>cipher /W:c:To remove as much data as possible, please close all other applications while
running CIPHER /W.
Writing 0x00
................................................................................
....................
Writing 0xFF
................................................................................
....................
Writing Random Numbers
................................................................................
....................
C:\Documents and Settings\Administrator>
It's done, and it was painless. All unallocated space on the hard drive was overwritten by zeros, then ones and then random numbers. On a drive that had 4 gigs of free space, it took less than 20 minutes. Now if anyone gets a hold of this hard drive, it would not be possible to recover deleted files. This type of action can be scheduled on windows boxes to be run periodically. In an age of mobile computing, this type of extra security measure can be invaluable.
Friday, June 30, 2006
FreeBSD Customized Shell Prompt
This posting is to track my progress with customizing my shell prompt. From time to time I like to delve into some aspect of my computer and do as much with it as I can. My favorite OS is FreeBSD, and as such I find myself using the C Shell quite often. I also spend a lot of time in the command line. This being said, I have had the need to know a little about my environment while I work. Prompted by a very lavish and colorful BASH prompt from a friend of mine, I set out to customize my C Shell to fit my personal needs.
I started by figuring out what information I wanted in my prompt. The list looked something like this:
1-current user and host
2-date
3-time
4-current directory
On top of this, based on my friends prompt, I wanted this information above my cursor so as not to waste space for long directories. I have seen prompts like this on many flavors of Linux, however FreeBSD does not come like this by default.
My first attempt looked something like this:
%vi .cshrc
....
set prompt = '%n@%m:%/%# '
....
which looked something like this: eon@ZETA:/home/eon>
Next I added a Grey color to my prompt:
eon@Zeta:/home/eon>vi .cshrc
....
set prompt = '%{\033[37m%}%n@%m:%/%# '
....
Next I applied these changes to my root account, making the prompt red. Note: This line must be added to the end of the .cshrc script.
set prompt = '%{\033[31m%}%n@%m:%/%# '
Making my regular user Grey and my root account red is an easy way to determine what user I am. On many occasions I have been on my BSD laptop and sshed into my home box and issued a "init 0" command to shut my Laptop down inadvertently bringing down my server at home. Smart ay! This way I make my root user on my home box red so I know when I am sshed in as opposed to local. :)
Next I set out to complete my prompt. To make a log posting short, this is what I ended up with in my ".cshrc" script:
set prompt = '\n%{\033[37m%}%n@%m:%/\t[%D-%w-%y %t]\n%# '
This adds a new line to separate the previous output, color, user@host, current directory, and tabs to a Day-Month-Year Time output, and newlines to the prompt. It looks something like this:
eon@ZETA:/home/eon [30-Jun-06 10:42pm]
>
or as root:
root@ZETA:/root [30-Jun-06 10:43pm]
#
This currently fulfills my needs. Any new additions/updates will be posted here.
Monday, June 26, 2006
Up and running!
Subscribe to:
Posts (Atom)