본문 바로가기
Security/[게임] CTF 풀이

[MISC] DEFKTHON 2014 MISC200

by blackcon 2014. 3. 4.
728x90

<문제파일>

200.txt
다운로드

문제 파일을 보면 0~255범위의 숫자 3개가 나열되어있어서 RGB라는 것을 느끼고 바로 코딩!

#!/usr/bin/env python
import Image, ImageDraw


colors = []
W, H = 300, 204 
i = 0

f = open("./flag.txt", "rb")
img = Image.new("RGB", (W, H), "black")
draw = ImageDraw.Draw(img)

#문제.txt.값들을 공정하는 과정
for j in f.readlines():
    r, g, b = j.split(',')
    b = b.split('\n')[0]
    colors.append((int(r), int(g), int(b)))

#가로, 세로로 색을 1픽셀씩 찍는 과정
for x in range(W):
    for y in range(H):
        draw.point((x, y), fill=colors[i])
        i += 1

img.save("flag.png", "PNG")
f.close()

flag{ youc@n'tseeme }

728x90