【愚公系列】2021年11月 攻防世界-进阶题-MISC-030(red_green)

2021-12-03 14:40:38 浏览数 (1)

文章目录

  • 一、red_green
  • 二、答题步骤
    • 1.zsteg
  • 总结

一、red_green

文件:攻防世界下载对应文件

二、答题步骤

1.zsteg

下载得到一张图片 解法一:pytho脚本

代码语言:javascript复制
#生成脚本
from PIL import Image
import os
import bitstring

#image_name = 'flag.jpg'
image_name = input("请输入当前文件夹下图片的名称>>>n")
current_path = os.path.dirname(__file__)
with open(os.path.join(current_path,image_name),'rb') as f:
    bin_content = bitstring.Bits(f)
    im = Image.new("RGB",(1024,780),(255,0,0))
    pim = im.load()
    for i,val in enumerate(bin_content.bin):
        if val == '0':
            pim[i24,i/1024] = (0,255,0)
    im.save(os.path.join(current_path,'red_green.png'))

#还原脚本
from PIL import Image
import os
import bitstring

image_name = 'red_green.png'
current_path = os.path.dirname(__file__)
im = Image.open(os.path.join(current_path,image_name))
image_width = im.size[0]
image_height = im.size[1]
# load pixel
pim = im.load()
bin_result = ''
for row in range(image_height):
    for col in range(image_width):
        if pim[col,row][0] == 255:
            bin_result  = '1'
        else:
            bin_result  = '0'
with open(os.path.join(current_path,'result.jpg'),'wb') as f:
    f.write(bitstring.BitArray(bin=bin_result).bytes)

解法二:stegsolve,lsb隐写保存二进制

解法三:zsteg

代码语言:javascript复制
zsteg -E b1,r,lsb,xy 2ec5da20345342909d2336aa7418afed.png > new.jpg

总结

  • zsteg

0 人点赞