Created
July 23, 2020 21:45
-
-
Save mrT4ntr4/8e619140179ec84e1ad3ab1efceeecec to your computer and use it in GitHub Desktop.
r2pipe solver script for https://0x00sec.org/t/reverseme-recursion/21802
This file contains 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 | |
import struct | |
password = "" | |
fname = "rec_pwd.txt" | |
f = open(fname, 'w') | |
with open('rec_profile.rr2', 'w') as prof: | |
prof.write('#!/usr/bin/rarun2\nstdin="%s"\n'%('A'*80)) | |
r = r2pipe.open('rec_crackme',flags=['-2']) | |
r.cmd("e dbg.profile=rec_profile.rr2") | |
r.cmd("doo ; aaa") | |
r.cmd("db ?v main+380 ; dc") | |
r.cmd("db ?v rdx+0x5c") | |
while True: | |
r.cmd("dc ; db-*") | |
edi = int(r.cmd("dr edi"),16) | |
if edi == 0: | |
break | |
password += struct.pack('<I', edi) | |
r.cmd("dr esi=edi") | |
r.cmd("db ?v rax+0x5c") | |
f.write(password) | |
print "Password successfully saved at %s !!" % fname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment