import sysimport r2pipe
r2 = r2pipe.open('./slammer')r2.cmd('doo')r2.cmd('e dbg.profile=w.rr2')r2.cmd('db 0x0060016A')r2.cmd('dc')r2.cmd('sr rip')
def fun():    r2.cmd('ds')    r2.cmd('sr rip')
w = ''while True:    try:        s = r2.cmdj('pdj 1')[0]['opcode']        if 'inc rcx' == s:            fun()            ss = r2.cmdj('pdj 1')[0]['opcode']            if 'cmp byte [rcx]' == ss[:14]:                a = int(ss[-4:], 16)                r2.cmd('wx %x @rcx' % a)                w += chr(a)                sys.stdout.write('\r' + w)                sys.stdout.flush()    except TypeError:        fun()        continue    fun()