Last active
September 11, 2022 22:08
-
-
Save mmkhitaryan/9bfd8b2384ab7d825c9c703ee33a8f12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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