Last active
April 8, 2018 19:58
-
-
Save MariaRigaki/f89addf44b37f04610facd1accd14e10 to your computer and use it in GitHub Desktop.
Read extra lines from PNG file (Avast reversing challenge at Security session 2018)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import png | |
| rdr = png.Reader('E3EA158BA24F4D9573C04A0687F47F3BA3DB096ADA14729ECF7574678733E8AF.png') | |
| w, h, pixels, meta = rdr.read() | |
| # read returns width, height, pixels as Map and metadata | |
| # (600, | |
| # 790, | |
| # <map at 0x7ff98c07e908>, | |
| # {'alpha': False, | |
| # 'bitdepth': 8, | |
| # 'greyscale': False, | |
| # 'interlace': 0, | |
| # 'planes': 3, | |
| # 'size': (600, 790)}) | |
| # Increase the height to 800 pixels to view the secret message | |
| writer = png.Writer(width=w, height=h+10, | |
| planes=meta['planes'], | |
| bitdepth=meta['bitdepth'], | |
| interlace=meta['interlace'], | |
| alpha=meta['alpha']) | |
| with open('extended.png', 'wb') as f: | |
| writer.write(f, pixels) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment