In today's post I'm going to show how to embed a text message into an image file. This type of messaging is known as steganography. Steganography is the practice of hiding secrets in such a way that only the intended message recipient would know to look for your hidden message.
In this basic form of secret messaging we'll be adding text onto the end of a file. I'm going to use the following image of Tux for my example.
You can save the above image to give it a try, or you can just use an image that you already have. I'm going to show two ways to do this. In the first example I'll show how to enter your message interactively. In the second example I'll show how to take a message saved in a text file and append it to the end of the image file.
Enter your message interactively
Open a terminal window and navigate to the directory where your image is stored. Now we'll use the cat command to append text to the end of the image file.
The cursor should now be blinking, waiting for you to enter your message from standard input. Start off by hitting [Enter] to create a blank line. This will make it so your message starts on a new line at the end of the file. Now just type in the rest of your secret message. Hit [Enter] one more time when you're done, then hit [Ctrl]+[D] to exit.
Now, if you want to read your secret message from the file, just use
Embed a message using a text file
In the second example we're going to save the secret message in a text file first, then append it to the end of an image.
Open your favorite text editor and create your secret message. Make sure to leave an empty line at the beginning of the text file to make it easier to distinguish your message later. Now save the file as message.txt.
Now there's a couple of ways to approach adding the message to your image. You can take your message and image and merge them into a new file like this.
Or you can append your message to the end of the original image like this.
Do you know some other ways to hide messages within a file? Leave a comment.
#
Exelent post! Thanks you sir.
I have try another way to hide secret message within our images. Im use steghide to do that.
http://www.linuxslaves.com/2015/05/steganography-tutorials-hide-secret.html
#
thx but abit was trouble to decrypt cause U didn't show how to view the file from the pic but tried
"cat secret.png > message.txt " then viewed the file ,hope it helps
#
thanks for this useful tips
#
Steghide is also quite good fun! http://www.ubuntucymraeg.org/?p=758
steghide embed -cf ffotograff.jpg -ef neges.txt
where ffotograff.jpg is the image and neges.txt is the message you want to hide.
Thanks for the geat tips on the blog.
#
Cool ! I found a similarly interesting article on installing wallpaper clocks at http://ubuntumanual.org/posts/246/installing-wallpaper-clock-in-ubuntu-in-3-simple-steps .Check it out !