Tags: stego 

Rating:

This was a steganography challenge where data was encoded into pixels as a Red value at randomly selected coordinates, with the Green and Blue values as the coordinate for the next pixel. The first pixel written is at 0,0 and contains the length of the data in bytes.

The following script extracts data written into images in this way, using the Pillow python module:

~~~
from PIL import Image

img = Image.open('encoded.png')
(length, x, y) = img.getpixel((0,0))
flag = ''

for i in range(length):
   color_data = img.getpixel((x,y))
   flag += chr(color_data[0])
   (x, y) = color_data[1:2]

print flag
~~~