CTF | wargame

3DS CTF - Santa Walks into a bar (qr코드 파싱)

nopdata 2017. 3. 7. 21:55
keyword : qr코드 파싱


qr코드 이미지들이 가득한 파일이 제공되며, 하나의 산타 이미지도 주어진다.


여기서 주어지는 산타의 ID.png파일이 있는데 그 파일을 읽으면 Now I have Xavier in 1b3ff9ed24dfa790c7a3d68902cbdaee라는 메시지가 온다.
in 뒤에오는 숫자값은 다음 파일의 이름이다. 이제 쭉 읽으면 된다... 라고 생각하였으나 이상하게 중간에 핸드폰 qr코드로는 인식이 되지만, 파이썬 qrtools로는 제대로 파싱이 되지 않는 경우가 있어다.
해서 모든 qr코드에 대하여 조사를 하는 방법을 사용하였다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import qrtools
 
import os
 
santa_message = ['Santa Claus']
file_names = os.listdir('./')
 
qr = qrtools.QR()
 
for file_name in file_names:
    try:
        f=open(file_name,'rb')
        if qr.decode(f):
            message= qr.data
            santa_message.append(message)
            if "Now" not in message and "child" not in message and "almost" not in message and "Next" not in message and "kid" not in message :
                print message
    except Exception, e:
        pass
cs


그러면 ㅕ기 goo.gl/wFGwqO를 얻을 수 있지만, 서버가 닫혀 있기 때문에 지금 flag값을 얻을 수는 없다.