CTF-隐写术-Chromatophoria

it2022-05-05  175

http://ctf5.shiyanbar.com/stega/chromatophoria/steg.png 

使用stegsolve查看图片发现图片最上一行有白点,如图下:

 

可以猜测采用了LSB最低有效位隐写 使用python 直接将隐藏信息解出

代码:     from PIL import Image

    def mod(x,y) :         return x%y;  #取余

    def toasc(strr) :         return int(strr,2); #二进制转化为十进制

    im=Image.open("steg.png")

    lenth = 960   #规定读取的长度     width = im.size[0]  #获得图片的宽     height = im.size[1]  #获得图片的长

    b=""     count=0     for h in range(0,1) :         for w in range(0,360) :   #因为信息隐藏在开头,所以只需要一定长度就够了             piexl = im.getpixel((w,h))  #获得图片的每个像素点                          for i in range(0,3):                 if count%3==i :                     count+=1                     b=b+str((mod(int(piexl[i]),2)))                     if count == lenth :                         break

    with open("flag.txt","wb") as f :         for i in range(0,len(b),8):                 stra = toasc(b[i:i+8])             res = chr(stra).encode()             f.write(res)             stra=""

    f.close()


最新回复(0)