Could someone with Python expertise check this code please?
<p>When I run <a href="http://gunslingerc0de.wordpress.com/2010/06/04/381/" rel="nofollow">this</a> prog it doesn't run for some reason. The author's notes at the top of the code on the link provided show example output, like for example "encode/decode" doesn't appear in place of <code>%sencode%s</code> / <code>%sdecode%s</code>, so not sure what the problem is.</p>

<pre><code>#!/usr/bin/python
import binascii, sys, time

RED = '\033[31m'
WHITE = '\033[37m'
RESET = '\033[0;0m'

def main():
  print "shellcode hex encode decoder"
  print "programmer : gunslinger_ &lt;yudha.gunslinger[at]gmail.com&gt;"
  print "what do you want to do ? %sencode%s / %sdecode%s" % (RED, RESET, WHITE, RESET)
  q = raw_input("=&gt; ")

if q == "encode": 
    inputtype = raw_input("Please input data : ")
    print "shellcode =&gt; ",
    for encoded in inputtype:
        print "\b\\x"+encoded.encode("hex"),
        sys.stdout.flush()
        time.sleep(0.5)
        print RESET

elif q == "decode":
    inputtype = raw_input("Please input data : ")
    cleaninput = inputtype.replace("\\x","")
    print "hex       =&gt; ",cleaninput
    print "plaintext =&gt; ",
    print "\b"+cleaninput.decode("hex")

else:
    print "wrong answer ! your choice is %sencode%s or %sdecode%s" % (RED, RESET, WHITE, RESET)
    sys.exit(1)   


if __name__ == '__main__':
main()
</code></pre>
