ISCC2023 misc WriteUp

提示:消息传递

下载解压后,一个流量包和一个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}根据每个人的字典替换

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值