Skip to content

Instantly share code, notes, and snippets.

@mmkhitaryan
Last active September 11, 2022 22:08
Show Gist options
  • Save mmkhitaryan/9bfd8b2384ab7d825c9c703ee33a8f12 to your computer and use it in GitHub Desktop.
Save mmkhitaryan/9bfd8b2384ab7d825c9c703ee33a8f12 to your computer and use it in GitHub Desktop.
import r2pipe
r = r2pipe.open()
r.cmd('ood')
r.cmd('dcu @main')
last_pointer = '1'
while True:
poiner_from_stack = str(r.cmdj('pxqj 8 @rsp')[0])
if last_pointer!=poiner_from_stack:
# will never stop when run as r2 /bin/ls
print(poiner_from_stack)
break
r.cmd('ds')
# why ds does not change pxqj?
import r2pipe
# when used with '/bin/ls' it does not loop forever
r = r2pipe.open('/bin/ls')
r.cmd('ood')
r.cmd('dcu @main')
last_pointer = '1'
while True:
poiner_from_stack = str(r.cmdj('pxqj 8 @rsp')[0])
if last_pointer!=poiner_from_stack:
print(poiner_from_stack)
break
r.cmd('ds')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment