Created
July 17, 2015 03:22
-
-
Save lieanu/66c236d71d01874b44ed 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
| #!/usr/bin/env python2 | |
| import profile | |
| from pwn import * | |
| from pprint import pprint | |
| def ttt4(): | |
| rop = ROP(ELF.from_assembly( | |
| ''' | |
| pop eax; ret | |
| pop ebx; call eax | |
| mov ecx, ebx; ret | |
| xchg edx, ecx; jmp eax | |
| mov edi, edx; ret; | |
| ''' | |
| )) | |
| context = { | |
| 'eax': 1, | |
| 'ebx': 2, | |
| 'ecx': 3, | |
| 'edx': 4 | |
| } | |
| for r, gadgets in rop.setRegisters(context).items(): | |
| print '<setting %s>' % r | |
| for g in gadgets: | |
| if isinstance(g, pwnlib.rop.gadgets.Gadget): | |
| print hex(g.address), '; '.join(g.insns) | |
| elif isinstance(g, int): print hex(g) | |
| else: print g | |
| if __name__ == "__main__": | |
| #profile.run("ttt4()", "mystats") | |
| profile.run("ttt4()") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment