I once wrote a Java version of the infamous unstash script, written in Perl.
As I am picking up Python (so refreshing, so little clutter) I thought it would be nice as a little practice to rewrite it in Python as well. And it is really compact.
This is what I came up with:
#!/usr/bin/python # (c) 2013 Jeroen Zomer http://strelitzia.net import sys def parseStash(): if len(sys.argv) < 2: print "please add the stashfile as argument" return print "extracting password from: " + sys.argv for b in open(sys.argv).read(): if ord(b) == 0xf5 : return sys.stdout.write( chr(ord(b) ^ 0xf5) ) parseStash()
or if we would take the absolute bare minimum, it gets really impressive how powerful and compact python can be:
import sys def parseStash(): for b in open(sys.argv).read(): if ord(b) == 0xf5 : return sys.stdout.write( chr(ord(b) ^ 0xf5) ) parseStash()