본문 바로가기
CTF

[shell ctf 2022] OX9OR2

by skyepodium 2022. 8. 15.

1. 개요

XOR 유추 문제

 

유추한다는 점이 개인적으로 그닥인듯

 

2. 분석

XOR 문제인데, 힌트로 SHELL 이라는 5글자가 key에 포함됨을 알려줍니다.

8~p*m~`>
def xor(msg, key):
    o = ''
    for i in range(len(msg)):
        o += chr(ord(msg[i]) ^ ord(key[i % len(key)]))
    return o
 
with open('message', 'r') as f:
    msg = ''.join(f.readlines()).rstrip('\n')
 
with open('key', 'r') as k:
    key = ''.join(k.readlines()).rstrip('\n')
    
assert key.isalnum() and (len(key) == 9)
assert 'SHELL' in msg
 
with open('encrypted', 'w') as fo:
    fo.write(xor(msg, key))

 

cyberchef에서 해보면, XORIS 가됩니다. 

 

모두 그런건 아니지만, flag 만들때 .. is awesome, ..is cool 같은 표현을 많이 사용하는데 나머지도 유추해보면

 

XORISCOOL 입니다.

'CTF' 카테고리의 다른 글

[shell ctf 2022] Secret Document  (0) 2022.08.15
[shell ctf 2022] Feel me  (0) 2022.08.15
[shell ctf 2022] Alien Communication  (0) 2022.08.15
[shell ctf 2022] World's Greatest Detective  (0) 2022.08.15
[shell ctf 2022] Extractor  (0) 2022.08.15