Lolik

not404

nothing
x
bilibili
github
telegram

ISCC2023 雜項報告

提示:消息传递

下載解壓後,一個流量包和一個 dictionary.txt

流量中是 126 郵箱發的郵件

image-20230601192534563

image-20230601192649294

一個壓縮包和一個 p.png 圖片

import base64
with open('1.txt','r') as f:
	d=f.read()

a=base64.b64decode(d)
# print(a.decode('gb2312'))
with open('p.png','wb') as f:
 	f.write(a)

base64 轉 2 進制保存

image-20230601192952425

另一個 rar 有密碼加密

import struct, os

png_header = b'\x89PNG\r\n\x1a\n' # 89504e470d0a1a0a
png_ending = b'IEND\xaeB`\x82' # 49454e44ae426082
with open("p.png", 'rb') as f:
	data = f.read()

if data[:8] == png_header:
	width, height = struct.unpack('>LL', data[16:24])
	print('width', width, 'height', height)

for i in range(0,len(data),4):
	if data[i:i+8] == png_header:
		print('header ',data[i:i+8],i)

	if data[i:i+8] == png_ending:
		print('ending ',data[i:i+8],i)

def save(a,b):
	with open(f'{a}_{b}.png', 'wb') as inp:
		inp.write(data[a:b+8])
	os.system(f'start {a}_{b}.png')


# save(264,3252)

分析 png 文件頭和文件尾

結果

width 100 height 100
header  b'\x89PNG\r\n\x1a\n' 0
header  b'\x89PNG\r\n\x1a\n' 264
ending  b'IEND\xaeB`\x82' 3252
ending  b'IEND\xaeB`\x82' 3308
[Finished in 292ms]

有兩個文件頭尾,其他中間的 264~3252 保存為 png ,save(264,3252)

Untitled1

提示壓縮包密碼是兩個密碼加起來

image-20230601193642820

image-20230601193659311

拼接後就是解壓密碼

壓縮包中:

image-20230601193802241

112 個 100x100 的黑白圖片,把其中 110 - 副本.png , 改成 110.png(可能是失誤?)

轉 2 進制,再轉 ASCII , 然後根據字典替換

import os
from pprint import pprint
from PIL import Image

strr=''
for i in range(1,113):
	im=Image.open('./picture/'+str(i)+'.png')
	a=im.getpixel((10,10))
	if a==(255, 255, 255):
		strr+='0'
	elif a==(0, 0, 0):
		strr+='1'
	else:
		raise Exception(f'unknown color{a} in {i}.png')
print(strr)
s8=''.join(chr(int(strr[i:i+8],2)) for i in range(0, len(strr), 8))
print(s8)

prex = s8.split('{')[0]
content = s8.split('{')[1].split('}')[0]
print(f'prex-> {prex}')
print(f'content-> {content}')


dic={}
with open('dictionary.txt','r') as f:
	aa=[x.replace('\n','') for x in f.readlines()]

for i in aa:
	dic.update({i.split(':')[0]:i.split(':')[1]})
pprint(dic)
r=''
for c in content:
	r+=dic[c.lower()]
print(f'替換-> {r}')
print('flag-> {}{}'.format(prex,'{'+r+'}'))

結果

0100100101010011010000110100001101111011011010010011001001110011001100000110001100110010011000110011001101111101
ISCC{i2s0c2c3}
prex-> ISCC
content-> i2s0c2c3
{'0': 's',
 '1': 'y',
 '2': 'b',
 '3': 'h',
 '4': '7',
 '5': 'z',
 '6': 'e',
 '7': 'p',
 '8': 'g',
 '9': '9',
 'a': 'w',
 'b': 'c',
 'c': 'l',
 'd': 'd',
 'e': 'q',
 'f': 'm',
 'g': 'x',
 'h': 'a',
 'i': '6',
 'j': '2',
 'k': 'o',
 'l': '5',
 'm': 'i',
 'n': 'v',
 'o': '0',
 'p': '3',
 'q': 'u',
 'r': 'k',
 's': 't',
 't': 'f',
 'u': 'n',
 'v': '1',
 'w': 'j',
 'x': 'r',
 'y': '8',
 'z': '4'}
替換-> 6btslblh
flag-> ISCC{6btslblh}
[Finished in 869ms]

雖然每個人的 flag 不一樣,但是似乎只是最後字典不一樣,最後都是ISCC{i2s0c2c3}根據每個人的字典替換

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。