Skip to content

Instantly share code, notes, and snippets.

@poulter7
Created February 21, 2012 20:24
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 poulter7/1878668 to your computer and use it in GitHub Desktop.
Save poulter7/1878668 to your computer and use it in GitHub Desktop.
2column message crack: >python imagecrack.py http://staffwww.dcs.shef.ac.uk/people/R.Clayton/UoSsecret.png
# Run with:
# python imagecrack.py http://staffwww.dcs.shef.ac.uk/people/R.Clayton/UoSsecret.png
import Image
from numpy import asarray
from urllib2 import urlopen
from cStringIO import StringIO
from sys import argv
png = asarray(Image.open(StringIO(urlopen(argv[1]).read()))) # open the image from URL as an array
print ''.join([chr(png[x,y]) for (x,y) in png[:,0:2]-1]) # for each leading pair in the array find the corresponding character (-1 from its value MATLAB 1 indexing...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment