Advertisement
foryou97

angr_startflag{}.py

Oct 16th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.35 KB | None | 0 0
  1. import angr # angr-5.6.8.22
  2. import simuvex
  3. import logging
  4.  
  5. class __printf_chk(simuvex.SimProcedure):
  6.     def run(self):
  7.         print 'useless'
  8.  
  9. p = angr.Project("./packer-release", load_options={'auto_load_libs': False})
  10. #p.hook_symbol('__printf_chk', __printf_chk)
  11. arg1 = angr.claripy.BVS('arg1', 30 * 8)
  12. initial_state = p.factory.entry_state(args=['./packer-release', arg1], remove_options={simuvex.s_options.LAZY_SOLVES})
  13.  
  14. logging.getLogger('angr.path_group').setLevel(logging.DEBUG)
  15.  
  16. count = 0
  17.  
  18. for c in arg1.chop(8):
  19.   if count == 0:
  20.     initial_state.add_constraints(c == ord('f'))
  21.   if count == 1:
  22.     initial_state.add_constraints(c == ord('l'))
  23.   if count == 2:
  24.     initial_state.add_constraints(c == ord('a'))
  25.   if count == 3:
  26.     initial_state.add_constraints(c == ord('g'))
  27.   if count == 4:
  28.     initial_state.add_constraints(c == ord('{'))
  29.   if count == 29:
  30.     initial_state.add_constraints(c == ord('}'))
  31.   initial_state.add_constraints(c >= 32)
  32.   initial_state.add_constraints(c <= 126)
  33.   count += 1
  34.  
  35. base_ida = 0x80483D0
  36. base_angr = 0x400000
  37. nope = 0x804870F
  38. nice = 0x804870A
  39. print "nice ", hex(nice)
  40. pathgroup = p.factory.path_group(initial_state)
  41. print pathgroup
  42. pathgroup.explore(find=nice, avoid=nope)
  43. print pathgroup
  44.  
  45. #print pathgroup.deadended[0].state
  46. for path in pathgroup.found:
  47.     print path.state.se.any_str(arg1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement