Forum Thread: A script to hide things in pictures

Wassup byters, I have a new script I'd like to share called "". This script allows you to hide ANY file inside a .png or .jpg file and then extract it. Though there are two problems with this. Depending on what you hide the picture will get obviously big. Second it's real easy for people to see what you're hiding by just open the picture in any editor. But to people who ignore those things it's well hidden XD.

How it works:

step 1: Find ending magic number; At the end of PNG and JPG's(as well as every other file format) there are magic numbers, although you will never see them unless you open a given file in a hex-editor. These magic  numbers indicate what kind of file a file IS(that's right, just changing the ending extension on a file doesn't necesarrily mean you changed how the computer views the file). In addition to the one at the beginning there is also one at the end(I'm not sure if all files have ending magic numbers) to indicate where it stops(I'm guessing).

step 2: replace with custom magic number with custom extraction number; Here I put my own custom magic number as a reference to where the actual file I'm hiding begins. After, when I finally need to retrieve the file it will look for this number and get everything after it up until the picture itself's, ENDING magic number.

step 3: append new file; Now I just write the file I'm hiding after it.

step 4: re-add the picture's original ending magic number; Self explanatory.

So here's a link to the code


After you run the program it will place a file in the directory you ran it in, with the same name as the picture you were using as a host for your hidden file, that begins with "h_". This is the file that you will use later in the extraction part of the program.

Our Best Hacking & Security Guides

New Null Byte posts — delivered straight to your inbox.

11 Responses

Tight stuff dood +rep. I should do some posts on basic stegonography here, that's a fun subject ^_^.

Yea you should :P I would def. read that. Not that I don't read everything..

 Haha :p. What types of stego are you interested in learning?

Any and all my friend… Start with what it is (not too much of this, I think if we are reading an article we have some idea of WHAT it is :P), how it works, the very basic techniques, then how to hide, then how to analyse. I heard you could hide/embed code into images too, if you knew anything about that I would also love to hear(read?) it.

Will do bro ;D I'm quite knowledgable in the field of stego, so I'm going to love teaching all about it xD.

I think i am doing something wrong, cause the file gets created but with no picture or hidden file on it. The size of the file created is also so small. Tried it in windows 7 cmd with python 2.7.2 installed though (python 3 didnt work at all).

After running the program CORRECTLY there will be a file prefixed with a "h_". It's this file that you use to extract the program. Some suggestions: Make sure you're running it out of the right directory; use python 2.**.

So the solution to my problem was to use linux. The script doesn't work on Windows. Thank you Sol Gates for your guidence to solve the problem ;)

I think that gives Mr. Sol Gates the motivation to make one better xD.

I wrote a small article on hiding archives inside jpegs using built-in windows commands (this way there is nothing extra to install) you can use that and then store the resulting picture in an alternate file stream to hide its size on disk.

Share Your Thoughts

  • Hot
  • Active