Skip to content Skip to navigation

Cat's eyes (stego 100)

Category: 

This task is the most simple stego task in this ctf. We have the GIF with 8 frames, all of them have little color difference in the first 3 lines. All we need just to build differences image. After some analysis we decided that it is binary encoded ASCII text. And we decoded it.

from PIL import Image
from PIL.ImageChops import difference
from numpy import asarray


images = []
for i in range(1, 9):
    images.append(Image.open("%s.png" % i))

dif = asarray(difference(images[0], images[0])).tolist()
for i in images[1:]:
    curImage = difference(images[0], i)
    for i, raw in enumerate(asarray(curImage)):
        for j, color in enumerate(raw):
            if color != 0:
                dif[i][j] = 1

binString = ""
for i in range(0, 3):
    for pixel in dif[i]:
        if pixel == 0:
            binString += "0"
        else:
            binString += "1"
answer = ""
for i in range(0, 1000, 8):
    el = int(binString[i:i+8], 2)
    if el == 0:
        break
    answer += chr(el)
print answer

The answer is RUCTF_e4dd9f5cee307b322c3a27abe66e3df9.