Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.