评论

收藏

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

网络安全 网络安全 发布于:2021-12-15 22:48 | 阅读数:343 | 评论:0

文章目录





  • ​​一、red_green​​
  • ​​二、答题步骤​​

  • ​​1.zsteg​​

  • ​​总结​​




一、red_green
文件:攻防世界下载对应文件

二、答题步骤

1.zsteg
下载得到一张图片
解法一:pytho脚本
#生成脚本from PIL import Imageimport osimport 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[i%1024,i/1024] = (0,255,0)  im.save(os.path.join(current_path,'red_green.png'))#还原脚本from PIL import Imageimport osimport bitstringimage_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 pixelpim = 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隐写保存二进制
DSC0000.png

DSC0001.png

解法三:zsteg
zsteg -E b1,r,lsb,xy 2ec5da20345342909d2336aa7418afed.png > new.jpg

总结

  • zsteg




关注下面的标签,发现更多相似文章