히공

hackingcamp22CTF - Do u know it? 본문

write up/hackingcamp22CTF

hackingcamp22CTF - Do u know it?

heegong 2021. 3. 20. 19:03
728x90

문제

 

 

 

 

메인함수다.

 

인자로 문자열 2개를 받는다.

 

 

 

 

2번째가 AA.....sks여야 한다.

 

 

 

 

 

v15, v14에 인자1, 인자2를 복사한다.

 

 

 

 

 

v15를 오픈하고 리턴 값을 v10에 저장한다.

 

 

 

 

두 번째 인자를 argv_s_2에 넣는다.

 

 

 

 

 

매우 중요한 핵심 루틴이다.

v10(첫 번째 파일) 을 4바이트씩 끊어서 read_value에 집어넣는다.

 

그 후 for을 총 6번을 돌려 0x10과 xor 해준다.

그 후 두 번째 파일에 write를 4바이트씩 한다.

 

 

간단하게 코드를 만들 수 있다

 

name = "Data.enc" with open(name,'rb') as f: read_file = f.read() read_file = bytearray(read_file) write_byte = bytearray() for i in range(0,len(read_file)-3,4): write_byte.append(read_file[i]^0x10) write_byte.append(read_file[i+1]^0x10) write_byte.append(read_file[i+2]^0x10) write_byte.append(read_file[i+3]^0x10) f = open("Data.sks",'wb') f.write(write_byte) f.close()

이러한 코드를 작성할 수 있다.

 

 

이러한 파일이 만들어진다.

 

 

 

 

 

hxd에서 문자열 찾기로 보니깐

 

HCAMP{This_Is_Is_GameScene}

이게 플래그였다.

 

 

플래그 : HCAMP{This_Is_Is_GameScene}

'write up > hackingcamp22CTF' 카테고리의 다른 글

hackingcamp22CTF - dvm-rev  (0) 2021.03.20
hackingcamp22CTF - Opps Enc!  (0) 2021.03.20
hackingcamp22CTF - revtine  (0) 2021.03.20
hackingcamp22CTF - Demon Notepad  (0) 2021.03.20
Comments