본문 바로가기
ctflearn

[ctflearn] Image Magic

by skyepodium 2022. 8. 15.

1. 개요

pillow, RGB 문제

 

2. 분석

1) pillow

문제를 보면 pillow 사용을 권하고, width, height 가 변경되었다고 합니다. width 는 304라고 합니다.

 

27968*1 == 304 * 92 이기 때문에 높이는 92입니다.

 

2) python

from PIL import Image

image = Image.open("out copy.jpeg")
data = image.load()
image.close()

width, height = image.size

rgb_list = []
for x in range(width):
    for y in range(height):
        rgb_list.append(data[x, y])

result = Image.new("RGB", (92, 304))
result.putdata(rgb_list)
result.save("result.png", "PNG")

 

3) 확인

다음과 같은 flag를 얻고 뒤집고, 회전시키면 flag를 볼 수 있습니다.

 

'ctflearn' 카테고리의 다른 글

[ctflearn] Git Is Good  (0) 2022.08.15
[ctflearn] Blank Page  (0) 2022.08.15
[ctflearn] Exclusive Santa  (0) 2022.08.15
[ctflearn] Minions  (0) 2022.08.15
[ctflearn] Tux!  (0) 2022.08.15