Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #!/usr/bin/env python2
  2. import profile
  3.  
  4. from pwn import *
  5. from pprint import pprint
  6.  
  7. def ttt4():
  8. rop = ROP(ELF.from_assembly(
  9. '''
  10. pop eax; ret
  11. pop ebx; call eax
  12. mov ecx, ebx; ret
  13. xchg edx, ecx; jmp eax
  14. mov edi, edx; ret;
  15. '''
  16. ))
  17.  
  18. context = {
  19. 'eax': 1,
  20. 'ebx': 2,
  21. 'ecx': 3,
  22. 'edx': 4
  23. }
  24.  
  25. for r, gadgets in rop.setRegisters(context).items():
  26. print '<setting %s>' % r
  27. for g in gadgets:
  28. if isinstance(g, pwnlib.rop.gadgets.Gadget):
  29. print hex(g.address), '; '.join(g.insns)
  30. elif isinstance(g, int): print hex(g)
  31. else: print g
  32.  
  33. if __name__ == "__main__":
  34. #profile.run("ttt4()", "mystats")
  35. profile.run("ttt4()")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement