【青少年CTF】WP-Misc-你会运算吗
2023-1-9 10:17:33 Author: www.secpulse.com(查看原文) 阅读量:24 收藏

你会运算吗

考点:16进制位移,0宽隐写,steghide密码爆破

下载附件得到一张图片和一个需要密码的压缩包。

hexo-img%2F202212061939331.png

尝试打开图片,未果,使用010editor查看。

hexo-img%2F202212061854009.png

取反:

f=open("1.jpg",'rb')
f1=f.read()#二进制形式
with open('flag.jpg','wb') as f2:
   for i in f1:
       if i==0:
           f2.write(bytes([0x0]))
       #这里的b是int形式,要转换成bytes时,使用bytes(),且里面的内容需要加[]
       else:
           f2.write(bytes([0x100-i]))
f.close()
f2.close()

打开生成的图片,获得压缩包密码。

hexo-img%2F202212061936699.png

解压后获得两张图和一个txt文本。

hexo-img%2F202212061938368.png

3.jpg还是运用刚才的16进制取反脚本即可获得后半段flag。

hexo-img%2F202212061941840.png

查看txt文本,提示给出密码,但是需要爆破,猜测为大小写组合爆破。

hexo-img%2F202212061941840.png

推测图片2使用steghide隐写。

编写爆破脚本:

import os

def all_casings(input_string):
   if not input_string:
       yield""
   else:
       first = input_string[:1]
       if first.lower() == first.upper():
           for sub_casing in all_casings(input_string[1:]):
               yield first + sub_casing
       else:
           for sub_casing in all_casings(input_string[1:]):
               yield first.lower() + sub_casing
               yield first.upper() + sub_casing

if __name__ =='__main__':
   for x in all_casings("qsnctf"):
       os.system("steghide extract -sf 2.jpg -p "+x)
       print(x)

hexo-img%2F202212061944827.png

查看flag1.txt。

hexo-img%2F202212061944827.png

发现0宽隐写。

hexo-img%2F202212061946397.png

使用在线网站提取,获得前半部分flag。:http://330k.github.io/misc_tools/unicode_steganography.html

hexo-img%2F202212061947133.png  

本文作者:青少年CTF

本文为安全脉搏专栏作者发布,转载请注明:https://www.secpulse.com/archives/194742.html


文章来源: https://www.secpulse.com/archives/194742.html
如有侵权请联系:admin#unsafe.sh