There's a rather interesting discussion going on in the TECH echo right now
regarding placing of "secret data" in the slack space at the end of a file on
disk.
I'll give an example to make this clear.
If your disk has, say, 16K clusters, and you save a file that's 20K long, the
last cluster occupied by your file has 12K of slack space on it, unused space
that comes after the end of the file but before the beginning of the next
file, i.e. "waste space".
Now, the discussion referred to above was in regard to placing "secret data"
in that slack space, without anyone being the wiser, for the purpose of a
copy protection scheme. Specifically, marking the slack space at the end of
a common file such as COMMAND.COM or at the end of a common subdirectory
cluster such as C:\DOS such that a program could determine if it had ever
been installed on a particular computer before.
Now, I'm not much in favour of copy protection as such, but the concept of
putting data on a disk in this manner kind of intrigues me. Sort of one of
those things that's neat to know just in case there's a need for it later on.
For example, one could write a password routine that stores the actual
password required in slack space somewhere, thereby foiling anyone who goes
hunting for the password using a program like LIST to view your data files.
Password encryption optional, of course.
I would imagine that one would have to do some sort of direct disk
reads/writes to get the data onto the disk and read it back. I believe that
the steps required would be as follows:
1. Determine the cluster size on the target disk.
2. Determine the address of the last cluster occupied by the target file (or
subdirectory entry).
3. cluster size - ((target file size) mod (cluster size)) = available slack
space.
4(a). Insure that the data will fit into the available slack space, then
write the data into the space, or
4(b). Read the data from the slack space.
Now, determining the cluster size of the target disk is no big deal, but I'm
unsure of how to go about the remainder of the steps listed. Any brilliant
insights will be appreciated. You gotta admit that it's a pretty nifty way
to store "secret data" on a disk, much more secure than hidden file entries
which can be dug out with nothing more than a DIR /AH command.
Does anyone know how DOS reads a file? Would that type of "secret data"
follow along if one copied the affected file from one place to another, i.e.
does DOS read a file one cluster at a time until it runs out of file (and
thereby copying the slack space at the end of the last cluster), or does it
read it byte-by-byte until it hits the end-of-file. Would the "secret data"
follow along if one ran DEFRAG?
--- Msgedsq 2.2e
---------------
* Origin: THE BIG ELECTRIC CAT Melville Sask *SDS* *PDN* (1:140/53)
|