Wednesday, January 30, 2008

Using the cat Command To Hide Files Inside Other Files

cat is a standard command from Unix operating systems, such as BSD and Mac OS X, and Unix-like operating systems, such as Linux, that can be used to concatenate and display files. In this tutorial, I'm going to teach you how to hide any file inside any other file using cat, such that no one will every know the hidden file is there. This obviously has a number of uses, including providing another layer of protection for sensitive information such as bank numbers, personal information, etc.

WARNING: this is an advanced trick that requires the use of the command line. If you are scared of using the command line, don't bother continuing.


Ok, now that that's out of the way, pick a file you want to hide and another file you want to hide it in and place both files on your desktop. In my case, I'm going to hide an archive
inside a picture

Next, open a terminal. For Mac users, go to Applications => Utilities => Terminal.app; for Linux users, you'll have to find out where your particular distro puts it. Switch to your desktop:
cd Desktop

Now, we're going to perform the cat command:
cat archive.rar >> 1.jpg

Now my archive file is concatenated to the end of the picture file. If I double-click on the picture file, it will open in my picture-viewing program without any indication that it is abnormal in any way. However, as you can see from these before/after pics:

the picture's file size is now much larger, thanks to it having the archive attached. Anytime you want to access your hidden file, just rename your file to the hidden file's extension and open as normal:



Note: If you plan on hiding anything really important in a file using this method, I also suggest using some sort of encryption, in case someone actually finds it. This obfuscation just adds another layer of protection for your information.

5 comments:

  1. How 2 retrieve it back?

    ReplyDelete
  2. To get it back, just change the file extension back to that of your archive format and open it like you would any other archive.

    For example, if you hid a zip file inside of a jpeg, highlight the filename and delete ".jpg" and instead write ".zip".

    On a Mac, it will then ask if you really want to use .zip instead of .jpg. Say yes and the file's icon will change back to the zip file icon and you can double-click on it to unzip it.

    ReplyDelete
  3. not sure if this makes a difference or not but I am running osX86.

    from my exp...

    cat file.rar >> image.jpg
       does not give an error but dose
       not copy the rar into the jpg

    cat file.rar image.jpg > newname.jpg
       works fine in that you can
       extract the archive but the
       image is corrupt

    cat image.jpg file.rar > newname.jpg
       this works in reverse. the image
       is now intact, the archive
       is now corrupt.

    cp image.jpg file.rar
       then change file.rar to file.jpg
       has the same efect as last cat
       command.

    any help/clarification would be grate.

                               -exitus acta probat
    -dxs

    ReplyDelete
  4. i also have problems to reverse the process.

    cd desktop
    cat test.zip >> test.rtf

    works. when i rename the test.rtf into test.zip iam getting an error while trying to open the archive.

    ReplyDelete
  5. you might have to use another decompression program, such as UnRarX. I'm not sure how well the OS' built-in unzip utility handles these kinds of archives.

    ReplyDelete