CTF.show-MISC-misc50

题目链接:ctf.show

下载附件得到了一张照片

使用kali中binwalk查看,发现有隐藏文件

使用foremost分离文件

发现压缩包嵌套

解压两次发现,有一串base字符

base64解码得到密码123456(用于解压下一个压缩包)得到

写个脚本解一解

import re
from tqdm import tqdm 

def read_file(filepath):
    with open(filepath) as fp:
        content=fp.read();
    return content

number = read_file('thienc.txt')
result = []
result.append(re.findall(r'.{2}', number))
result = result[0]

strings =''
for i in tqdm(result, total=len(result), desc="处理中"):
    y = bytearray.fromhex(i)
    z = str(y)
    z= re.findall("b'(.*?)'",z)[0]
    strings += z

b= strings.split('0x')

strings=''
for i in b:
    if len(i) ==1:
        i= '0' + i
    strings +=i

with open('te.txt', 'w') as f:
    f.write(strings)

把解出来的结果导入到编辑器中保存,发现是7Z头

但是解压需要密码,我们foremost分离出来的还有个图片,010查看末尾发现

base64+32解码得到KEY{Lazy_Man}

解压7z得到

发现base64 base32解码发现不行

后来发现是个base64+32循环解码。

使用脚本解码,也可以使用在线网站解码

import base64
import re
 
f = open('secenc.txt').read().encode('utf-8')
 
while True:
    if re.match('^[2-7A-Z=]+$', f.decode('utf-8')):
        f = base64.b32decode(f)
    elif re.match('^[0-9a-zA-Z+/=]+$', f.decode('utf-8')):
        f = base64.b64decode(f)
    else:
        print(f.decode('utf-8'))
        break
 
with open('result.txt', 'w', encoding='utf-8') as file:
    file.write(str(f,encoding='utf-8'))
print("Decryption complete!")

得到flag:flag{Welc0me_tO_cTf_3how!}

有点菜

制作不易

勿喷!!!!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值