Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to hide a file in an image in Linux

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to hide the file in the image in Linux, many people may not know much about it. In order to make you understand better, the editor summarized the following content for you. I hope you can get something according to this article.

Method one

This method does not require any additional software. You only need to have a basic command line knowledge of Linux.

I have an image file image.jpg and a directory sk. In the directory, there is a file called secret.txt, which contains encrypted information, which is also the file we are going to embed in image.jpg. You can put any number of files in the sk directory. Then I will compress the sk directory into a secret.zip file to make it a file. Finally, I will use the cat command to composite the secret.zip file with the image file (image.jpg) and save it as an ostechnix.jpg file.

A clearer description is:

Image.jpg- any image file

Sk- contains all the secret files in the folder

A zip file in the secret.zip-sk directory

Ostechnix.jpg- output file containing secret.zip and image.jpg files

Step 1: put the image and folder in the same directory. I put them all in the Documents directory.

Step 2: put all the files you want to hide in the "sk" folder. Then compress the file to get the "secret.zip" file.

Step 3: open the terminal below. Go to the directory where you saved the compressed and image files (here is Documents). Finally, use the cat command to save the secret.zip and test.jpg files as a file ostechnix.jpg

$cd Documents$ cat image.jpg secret.zip > ostechnix.jpg

Yeah, that's it. Now we have hidden the secret files in ostechnix.jpg. It is the only important file, and all other files can be deleted.

The ostechnix.jpg file will look like a normal file, and anyone can view it privately with a photo viewer. However, they are unlikely to know that this document contains something important.

To see the hidden files hidden in the ostechnix.jpg file, simply extract them using the following command:

$unzip ostechnix.jpg

Or

$unzip-t ostechnix.jpg

Sample output:

Archive: ostechnix.jpgwarning [ostechnix.jpg]: 712139 extra bytes at beginning or within zipfile (attempting to process anyway) creating: sk/inflating: sk/secret.txt

Extract the image file

As you can see in the output above, the sk directory has now reappeared and contains the hidden files that were previously placed. Now, go back to the folder to see if the content has changed. You will find that the files are still there and are not lost.

One of the disadvantages of this method is that we want to pass the password to the image file. Never mind! In the following method, we can add a password to the output file.

Method 2: use Steghide

Stephide is a command-line tool that helps us hide data in an image or audio file. It supports JPEG,BMP,WAV and AU files.

Stephide is available in the default repository of many Linux distributions.

On Arch Linux and its derivative systems, you can install it using the following command:

$sudo pacman-S steghide

On Debian and Ubuntu:

$sudo apt install steghide

Now, you can hide important files in an image or audio file as follows. I assume that you put all the files that need to be hidden in the same directory. If you put them in different folders, you need to give the full path in the following command.

$steghide embed-ef secret.txt-cf ostechnix.jpg

You will be prompted for a password:

Enter passphrase:Re-Enter passphrase:embedding "secret.txt" in "ostechnix.jpg"... Done

Use stephide to hide files in an image

In the above example, I embedded a file called secret.txt into a file called ostechnix.jpg. You can now delete the original secert.txt file. Because we have embedded it in the image file. If you want to embed multiple files, put them all in one folder and compress them, and then repeat the hiding operation described above.

To extract a hidden file from an image, simply run:

$steghide extract-sf ostechnix.jpg

Enter the password to extract the file:

Enter passphrase:wrote extracted data to "secret.txt".

Use stephide to extract hidden files from an image

For more information, see manpage

Man steghide after reading the above, do you have any further understanding of how to hide the file in the image in Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report