본문 바로가기
Wargame Write-Up/HackCTF

[HackCTF] (Forensic) 잔상 풀이

by snwo 2020. 4. 29.

압축파일을 풀면 유명하신 한석원선생님사진 두장이 나온다.

 

사진 두 장의 크기를 비교했을때

1바이트오차없이 일치했다.

 

과연 바이트끼리도 일치할지

내용을 비교하는 코드를 짜봤다.


f1=open('1.jpeg','rb')
f2=open('2.jpeg','rb')

one=list(f1.read())
two=list(f2.read())

print(len(one))
for i in range(len(one)):
    if one[i]!=two[i]:
        print('%x and %x : %d'%(one[i],two[i],i))

 다른 문자와 offset 을 출력하게했다.

더보기

4e and 48 : 31957
71 and 61 : 32486
cc and 63 : 32833
d9 and 6b : 33020
c9 and 43 : 33587
37 and 54 : 33691
f7 and 46 : 33731
a7 and 7b : 34698
16 and 77 : 34756
d9 and 68 : 34872
65 and 33 : 34929
fc and 72 : 35341
d9 and 33 : 36084
c1 and 5f : 36475
ed and 40 : 36582
77 and 72 : 36756
92 and 65 : 37055
c2 and 5f : 37091
c7 and 79 : 37210
df and 6f : 37570
ee and 75 : 37818
f1 and 5f : 38024
fe and 6c : 38914
7f and 30 : 39653
0 and 30 : 41145
f7 and 6b : 41721
35 and 69 : 42224
75 and 6e : 42619
5c and 67 : 42917
cc and 3f : 43560
db and 7d : 44230

같은 offset 에 있지만, 서로다른값을 가지고있는 offset 들이다.

 

두번째파일의 데이터는 알파벳범위에있는것같아서

값이다른 offset 에서 두번째파일에 데이터만 출력해보니

flag 가 나왔다.


1
2
3
4
5
6
7
8
9
10
f1=open('1.jpeg','rb')
f2=open('2.jpeg','rb')
 
one=list(f1.read())
two=list(f2.read())
 
for i in range(len(one)):
    if one[i]!=two[i]:
        print("%c"%two[i],end='')
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter

 

편의상 파일이름을 첫번째파일은 1.jpeg, 두번째파일은 2.jpeg 로 이름을 변경해 진행하였다.