Skip to content

Instantly share code, notes, and snippets.

@kira924age
Last active December 25, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kira924age/d551aae610a2bd0e9852 to your computer and use it in GitHub Desktop.
Save kira924age/d551aae610a2bd0e9852 to your computer and use it in GitHub Desktop.
This is a solution of SECCON WARS 2015.

When I converted mp4 to gif, I cutted from 00:25 to 01:05 in the movie.

Size of gif is widh:600, weigh:437, and frame rate is 2 frames per seccond.

  • Finally, run wars_solver_ver2.py, and scan flag.png as a QR code.
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from PIL import Image
gif = Image.open('hoge.gif')
width, height = gif.size
png = Image.new('RGB', gif.size, 'black')
while True:
gif.load()
for pos in ((x, y) for x in range(width) for y in range(height)):
if gif.getpixel(pos) < 0x80:
png.putpixel(pos, (0xff, 0xff, 0xff))
try:
gif.seek(gif.tell() + 1)
except:
break
png.save('flag.png', 'PNG')
@kira924age
Copy link
Author

  • hoge.gif

hoge

  • flag.png

flag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment