下载回来一个out.png,binwalk跑一下,可以提取出来一个python脚本:

    1. import random
    2. from Crypto.Util import number
    3. a = open('flag.png','rb').read()
    4. p = [a.find(b'IDAT')]
    5. while 1:
    6. if a.find(b'IDAT',p[len(p)-1]+1) != -1:
    7. p.append(a.find(b'IDAT',p[len(p)-1]+1))
    8. else:
    9. break
    10. b = open('out.png','ab')
    11. b.write(a[:p[0]-4])
    12. for i in p:
    13. l = number.bytes_to_long(a[i-4:i])
    14. b.write(a[i-4:i])
    15. C = a[i:i+4]
    16. b.write(C)
    17. d = a[i+4:i+4+l]
    18. f_d = b''
    19. s = random.randint(0,0x40)
    20. for j in d:
    21. f_d += number.long_to_bytes(j^s)
    22. if i == p[0]:
    23. b.write(d)
    24. else:
    25. b.write(f_d)
    26. c = a[i+4+l:i+4+l+4]
    27. b.write(c)
    28. if i == p[-1]:
    29. b.write(a[i+4+l+4:])
    30. b.close()

    具体逻辑是随机一个数和每个IDAT块异或,抄一下大佬的解密脚本:https://blog.csdn.net/qq_42880719/article/details/117389569

    1. import random
    2. import zlib
    3. from Crypto.Util import number
    4. f_d = b''
    5. a = open('out.png','rb').read()
    6. p = [a.find(b'IDAT')]
    7. while 1:
    8. if a.find(b'IDAT',p[len(p)-1]+1) != -1:
    9. p.append(a.find(b'IDAT',p[len(p)-1]+1))
    10. else:
    11. break
    12. b = open('flag.png','wb')
    13. b.write(a[:p[0]-4])
    14. for i in p:
    15. l = number.bytes_to_long(a[i-4:i])
    16. b.write(a[i-4:i])
    17. C = a[i:i+4]
    18. b.write(C)
    19. d = a[i+4:i+4+l]
    20. c = a[i+4+l:i+4+l+4]
    21. for j in range(0,256):
    22. f_d = b''
    23. f_d += C
    24. for k in d:
    25. f_d += number.long_to_bytes(k^j)
    26. if zlib.crc32(f_d)==number.bytes_to_long(c):
    27. break
    28. if i == p[0]:
    29. b.write(d)
    30. else:
    31. b.write(f_d[4:])
    32. b.write(c)
    33. if i == p[-1]:
    34. b.write(a[i+4+l+4:])
    35. b.close()

    跑出来一张图片后,修改高度就可以看到flag。