Skip to content

Instantly share code, notes, and snippets.

@nk0t
Created September 4, 2013 10:20
Show Gist options
  • Save nk0t/6435219 to your computer and use it in GitHub Desktop.
Save nk0t/6435219 to your computer and use it in GitHub Desktop.
ASIS CTF Stego/Chessboard
import Image
import base64
chess = Image.open('chess.png')
b64charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
stack = []
for y in range(8):
for x in range(8):
index = x + (7-y)*8
p = (x*32, y*32)
color = chess.getpixel(p)
if color != (0, 0, 0):
stack.append((color[0], index))
stack.sort()
encoded = ''.join([b64charset[i[1]] for i in stack])
flag = base64.b64decode(encoded)
print flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment