文章目錄
一、red_green
文件:攻防世界下載對應文件
二、答題步驟
1.zsteg
下載得到一張圖片
解法一:pytho腳本
#生成腳本
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
[i
%1024,i
/1024] = (0,255,0)im
.save(os
.path
.join(current_path
,'red_green
.png'
))#還原腳本
from PIL import Image
import os
import
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 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
zsteg
-E b1
,r
,lsb
,xy 2ec5da20345342909d2336aa7418afed
.png
> new.jpg
總結
總結
以上是生活随笔為你收集整理的【愚公系列】2021年11月 攻防世界-进阶题-MISC-030(red_green)的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。