Ideas for rewriting files with random stuff?

Giaguara

Chmod 760
Staff member
Mod
Help :)

Someone has put a lot of music to a shared folder on a Mac that is for productive work, and of course on corporate use sharing files like music, movies and non-work software is a big no-no.

So help me get some ideas what to do.

Of course, informing the lab manager person would make most sense (especially since I know who put the music there).

But I want something more educating. Like replacing the contents of all files with random junk, so that all files appear to be the same size etc. Appending random bits to the end of the files didn't do it.

Chmodding with no read or chowning to an odd user could probably work too.
But I somehow want something like shred - keeping all existing files, after replacing hte contents. fwipe seems to do this but I can't get it to work with Fink.

Or I could replace all passwords on the system after playing with chown and chmod... what else would be nice?
 
Right click on the folder and see who made those files. Then see if that person is using a peer-to-peer program or Trojan. They might have not done that on purpose.
 
I know the person whose music it is. It's on purpose there.
And p2p programs etc would not be a valid reason.
 
You could write a very simple shell script that would capture the exact size of the file in bytes, then simply overwrite the file with 0s of the exact, same length in bytes.

Voila -- file appears to be the same size it was originally, only now it contains garbage data.

Pseudo-code may look something like this:
Code:
For each file_name in dir do
  file_size gets size of file in bytes
  erase all data in file_name (making length 0)
  for 1 to file_size do
    write 0 >> file_name
  end for
  next file_name
end for
The program could be easily modified to write random data (instead of 0s), making the file appear more "legit" if someone were to peek at the underlying binary data.
 
How about this (use Terminal.app)

Use "say" command to create an audio file, like

Code:
$ say -o audio.aiff "I do not use shared folders to my own music"

You did not say the format of the files, but if they are mp3, you need to convert the .aiff files. Download LAME from Versiontracker and convert the file

Code:
$ lame audio.aiff audio.mp3

Check the size of the file you like to replace with "ls -ls". For example, if the size is 102324 bytes, you have to make the audio.mp3 big enough. If it is, make a copy of right size:

Code:
$ dd if=audio.mp3 of=a_fine_piano_music.mp3 bs=1 count=102324

Put the new file over the music file.

A hint to make big enough audio file:

Code:
$ echo "I will not do this again, ever" > 1
$ cat 1 1 1 1 1 1 1 1 1 1 1 1 > 10
$ cat 10 10 10 10 10 10 10 10 10 10 > 100
$ cat 100 100 100 100 100 100 100 100 100 100 > 1000
$ say -f 1000 -o 1000.aiff

Well, you get the idea
 
That would do it too :)
(but a bit too late to try for the case above, as I'm a few thousand miles away from the computer I needed it with... oh well, sooner or later some other user will try that around me)
 
Back
Top