Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. # I didn't check this code, use carefully, beware of errors
  2.  
  3. import idc
  4. import idaapi
  5. import idautils
  6.  
  7. def set_breakpoints_on_refs(ea):
  8. list_of_referencing_functions = ["All"]
  9. print "In setting bp ..."
  10. for ref in idautils.DataRefsTo(ea):
  11. func_name = idaapi.get_func_name(ref)
  12. if not func_name is None and not func_name in list_of_referencing_functions:
  13. list_of_referencing_functions.append(func_name)
  14. print "refrlist done", list_of_referencing_functions
  15. width = 0
  16. for r in list_of_referencing_functions:
  17. if len(r) > width:
  18. width = len(r)
  19.  
  20. ch = idaapi.Choose(list_of_referencing_functions, "Choose a function", 1 )
  21. ch.width = width
  22. print "Chooser created"
  23. res = ch.choose()
  24. if res > 0:
  25. print "selected ...",
  26. chosen = ch.list[res -1]
  27. print chosen
  28. set_at_all = False
  29. if chosen == "All":
  30. set_at_all = True
  31.  
  32. for ref in idautils.DataRefsTo(ea):
  33. if set_at_all:
  34. idc.AddBpt(ref)
  35. continue
  36. func_name = idaapi.get_func_name(ref)
  37. if func_name == chosen:
  38. idc.AddBpt(ref)
  39.  
  40.  
  41. def set_breakpoints_on_refs_to_screen_ea():
  42. print "Started"
  43. set_breakpoints_on_refs(idc.ScreenEA())
  44.  
  45. idaapi.add_hotkey("Alt-Y", set_breakpoints_on_refs_to_screen_ea)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement