with open('flag.zip','rb') as fr: origin_data = fr.read() i = 1 with open('out.zip','wb') as fw: for v in origin_data: fw.write((v^i).to_bytes(1,byteorder='big')) i+=1 i %= 256
得到压缩包内容
两张图片宽高都一样,像素异或
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
from PIL import Image
img1 = Image.open('rox.png') img2 = Image.open('xor.png') x = 3000 y = 1875
img = Image.new(img1.mode,(x,y)) for i in range(x): for j in range(y): p1 = img1.getpixel((i,j)) p2 = img2.getpixel((i,j)) tmp = [] for _ in range(3): tmp.append(p1[_]^p2[_]) p = tuple(tmp) img.putpixel((i,j),p) img.save(f"out.png")