网安第一课
改zip解压找到key1
key2
6iMmn76ucYG9PDtsvu
解压之后
上脚本
from PIL import Image
images = [Image.open(f"{i}.png") for i in range(1, 38)]
qr_code = Image.new("RGB", (128, 128), (255, 255, 255))
for i in range(37):
img1 = images[i]
for j in range(128):
print(i, j, img1.getpixel((j, 0))[1])
pixel_value = img1.getpixel((j, 0))[1]
if pixel_value & 1:
qr_code.putpixel((i, j), (0, 0, 0))
else:
qr_code.putpixel((i, j), (255, 255, 255))
qr_code.save("qr_code.png")
需要改一下脚本
**Simple_steganography-pcb2024**
解压的rar文件用ntfsstreamseditor查看,发现有NTFS流提取出来
之后得到一个二维码
假的
发现有隐藏图片,提取出来
这张图片
hint.txt,里面是a=7,b=35
用脚本
from PIL import Image
def arnold(infile: str, outfile: str = None, a: int = 1, b: int = 1, shuffle_times: int = 1, reverse: bool = False) -> None:
"""
Arnold猫脸变换函数
Parameters:
infile - 输入图像路径
outfile - 输出图像路径
a - Anrold 变换参数
b - Anrold 变换参数
shuffle_times - 置乱次数
reverse - 逆变换
"""
inimg = Image.open(infile)
width, height = inimg.size
indata = inimg.load()
outimg = Image.new(inimg.mode, inimg.size)
outdata = outimg.load()
for _ in range(shuffle_times):
for x in range(width):
for y in range(height):
if reverse:
nx = ((a * b + 1) * x - a * y) % width
ny = (y - b * x) % height
else:
nx = (x + a * y) % width
ny = (b * x + (a * b + 1) * y) % height
outdata[ny, nx] = indata[y, x]
outimg.save(outfile if outfile else "arnold_"+infile, inimg.format)
arnold("flag.jpg", "decode.jpg", 7, 35, 1, True)
解出来得到第二部分flag
再用bkcrack进行明文攻击
time ./bkcrack -C secret.zip -c flag.png -p png_header -o 0 > 1.log
跑出来了,解压得到第一部分的flag
We_l1k3_h4ck1ng
标签:鹏城,code,Image,misc,inimg,2024,range,qr,255 From: https://www.cnblogs.com/WTT001/p/18546078