Chybeta

HackCon2017-Steg-writeup

HackCon2017-Steg-writeup

Standard Steg

1
2
I hacked my friend's facebook, by seeing his chrome password. I am smart, right?
Anyways, he sent this image to one of his friends, idk what it is, looks like a useless logo, can you check?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
def asciiToBin(ascii):
return ''.join(str(bin(ord(byte)))[2:].zfill(8) for byte in ascii)
def hide(img, data, outName):
header, trailer = 2*"11001100",2*"0101010100000000"
dataBin = header+asciiToBin(data)+trailer
pixels, mode = list(img.getdata()), img.mode
newPixels = []
for i in range(len(dataBin)):
newPixel = list(pixels[i])
newPixel[i%len(mode)] = setLSB(newPixel[i%len(mode)], dataBin[i])
newPixels.append(tuple(newPixel))
newData = newPixels + pixels[len(newPixels):]
img.putdata(newData)
img.save(outName, "PNG")
def setLSB(target, value):
binary = str(bin(target))[2:]
if binary[-1] != value:
binary = binary[:-1] + value
return int(binary, 2)
微信扫码加入知识星球【漏洞百出】
chybeta WeChat Pay

点击图片放大,扫码知识星球【漏洞百出】

本文标题:HackCon2017-Steg-writeup

文章作者:chybeta

发布时间:2017年08月27日 - 10:08

最后更新:2017年08月29日 - 16:08

原始链接:http://chybeta.github.io/2017/08/27/HackCon2017-Steg-writeup/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。