Skip to content
Stephanie Callahan edited this page Apr 25, 2019 · 2 revisions

Welcome to the appa wiki!

Before beginning here are some resources that helped me:

Awesome steganography explanation/guide

A Beginners Guide to Bitmaps

Pillow documentation


About

Appa is a steganography tool that encodes data into an image and decodes data that is inside of an image. Please note this only works with images that have a lossless compression type. This means JPEG's are currently not supported, but PNG's are. More about lossless and lossy compression types.

How it works

Understanding the output

Appa is supposed to give a live visual of what is happening to the image as it encodes or decodes. When encoding, the values that are changed are output in green during the mod_bitmap phase. It shows the pixels before encoding, what pixels are changed and why, then the pixels after modification.

For getting an idea of what is going before moving to more advanced/length strings I would recommend encoding a small message into an image and decoding a small message from an image. The output will be a lot more clear.

Encoding

Appa takes in an image and some text and injects the text into the image by modifying the individual pixels.

A pixel looks like this:

(r, g, b)

It's just a RGB array. The first 5 pixels in an image could look something like this:

[(86, 127, 179), (87, 128, 179), (90, 132, 182), (92, 135, 185), (96, 137, 188)]

To inject some text into the image, we want to get the 8-bit binary representation of each letter in the string we want to include. Say for example we want to put the letter "A" into an image. If it had the above pixel layout, this would be the process:

  1. First convert A to binary (01000001)
  2. For every bit, we want to modify a value in the RGB pixel array. If the bit is 0, we make the value that maps to it's location in the pixel array even, and if the bit is 1, we make it odd, both by adding or subtracting 1 from that specific value. By default it subtracts 1, but if the value is at 0 it will add 1.
  3. There are three values in a pixel array. We are changing 3 pixels at a time to cover all 8 bits from the letter we are injecting, but that means there is one value at the end of the pixel array unaccounted for (3 pixels * length of pixel array (3) = 9). This number will be made even if you are going to keep encoding the image, and odd if you are done. By default it subtracts 1, but if the value is at 0, it will add 1.

So if our image had the following arrangement for the first 3 pixels

[(86, 127, 179), (87, 128, 179), (90, 132, 182)]

we could inject "A" by changing the things in bold by subtracting 1 from it.

You can map the bits from A to the pixels as follows:

alt text

Now our pixels will look like this after a single "A" has been injected:

[(86, 127, 178), (86, 128, 178), (90, 131, 181)]

For more practical uses, we would have more than one letter we want to inject. If this were the case, we would make the last value (182) even, and then keep modifying the pixel's values.

Decoding

Decoding should now be pretty trivial. If we look at the steps above we can possibly extract some text by reversing the algorithm. Appa reads up to the first 9th value in a set of pixels that is odd and then begins to attempt decoding. It will figure out what binary data is represented by these pixels by knowing all even numbers represent a 0 and all odd numbers represent a 1, then translating that to it's correct ASCII value.

So if we had the following pixels:

[(90, 131, 182), (91, 134, 184), (95, 137, 188)]

What ASCII value would we get?

Well, 90 is even, so the first bit is 0. 131 is odd, so our next bit is 1. We have begun building our binary string, which is 01 right now. Next, 182 is even, so our binary string is 010...

You can do the rest from here. You should determine the binary value is 01010011.

Now, we just have to translate this to ASCII, which is S.

Clone this wiki locally