Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. from manticore import Manticore
  2.  
  3. m = Manticore("./a.out")
  4.  
  5. @m.hook(0x400703)
  6. def hook(state):
  7. #change the builtin buffer to symbolic
  8. blen = 4
  9. cpu = state.cpu
  10. buf = state.new_symbolic_buffer(blen, cstring=True)
  11. cpu.write_bytes(cpu.read_register("RAX"), buf)
  12. m.context['buf'] = (buf, blen)
  13.  
  14. @m.hook(0x40071f)
  15. def hook2(state):
  16. #solve for a crc
  17. cpu = state.cpu
  18. state.add(cpu.RAX == 0xff)
  19. buf, len = m.context['buf']
  20. print buf, cpu.RAX
  21. for i in xrange(len-1):
  22. print state.solve_one(buf[i])
  23.  
  24.  
  25. m.verbosity = 2
  26. m.run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement