图片末尾iend后有数据fb3efce4ceac2f5445c7ae17e3e969ab
somd5
alpha2通道的的右下角找到
得到f78dcd383f1b574b lsb密码
python lsb.py extract everlasting_night. f78dcd383f1b574b
lsb.py
“””
import sys
import struct
import numpy
import matplotlib.pyplot as plt
from PIL import Image
from crypt import AESCipher
#Decompose a binary file into an array of bits
def decompose(data):
v = []
# Pack file len in 4 bytes
fSize = len(data)
bytes = [ord(b) for b in struct.pack("i", fSize)]bytes += [ord(b) for b in data]for b in bytes:for i in range(7, -1, -1):v.append((b >> i) & 0x1)return v
#Assemble an array of bits into a binary file
def assemble(v):
bytes = “”
length = len(v)
for idx in range(0, len(v)/8):byte = 0for i in range(0, 8):if (idx*8+i < length):byte = (byte<<1) + v[idx*8+i] bytes = bytes + chr(byte)payload_size = struct.unpack("i", bytes[:4])[0]return bytes[4: payload_size + 4]
#Set the i-th bit of v to x
def set_bit(n, i, x):
mask = 1 << i
n &= ~mask
if x:
n |= mask
return n
#Embed payload file into LSB bits of an image
def embed(imgFile, payload, password):
# Process source image
img = Image.open(imgFile)
(width, height) = img.size
conv = vert(“RGBA”).getdata()
print “[] Input image size: %dx%d pixels." % (width, height)
max_size = widthheight3.0/8/1024 # max payload size
print "[] Usable payload size: %.2f KB.” % (max_size)
f = open(payload, "rb")
data = f.read()
f.close()
print "[+] Payload size: %.3f KB " % (len(data)/1024.0)# Encypt
cipher = AESCipher(password)
data_enc = pt(data)# Process data from payload file
v = decompose(data_enc)# Add until multiple of 3
while(len(v)%3):v.append(0)payload_size = len(v)/
本文发布于:2024-01-30 20:42:13,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170661853722699.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |