moveax41h

IDAPython cheatsheet

Dec 6th, 2017
2,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. #IDAPython Cheat Sheet by moveax41h
  2. Heads(start_addr,end_addr) - gets a list of instructions between these two addresses
  3. MinEA() - Lowest address in file - use hex() to view
  4. MaxEA() - Highest address in file - use hex() to view
  5. idc.prev_head(ea,MinEA()) - prev instruction from ea
  6. idc.next_head(ea,MaxEA()) - next instruction from ea
  7. idc.SegName(ea) - Get the section of the current addr such as .text, .rdata, etc..
  8. idc.GetMnem(ea) - Gets the OPERATOR of the current instruction such as push, pop, mov, etc..
  9. idc.GetOpnd(ea,0..) - Gets the OPERANDS of the current instruction specified by 2nd arg begin w/ 0 e.g. eax, dword ptr
  10. idc.get_root_filename() - gets the current file being analyzed's name
  11. idc.get_screen_ea()/ScreenEA() - get address of cursor (current address)
  12. idc.get_segm_start(ea)/SegStart(ea) - Get the segment start addr of an address
  13. idc.get_segm_end(ea)/SegEnd(ea) - Get the segment end addr of an address
  14. idc.get_reg_value('name') - gets the value of the specified reg in debugger mode
  15. idc.set_color(ea,TypeOfItem,ColorIn0xHex)/SetColor - sets an item color, see CIC_* constants for mid arg CIC_ITEM
  16. FindBinary(base, SEARCH_NEXT|SEARCH_DOWN|SEARCH_CASE, '"%s"' % string) - searches for a string
  17. idaapi.get_imagebase() - gets imagebase
  18. idaapi.autoWait() - wait for analysis to finish before running plugin
  19. idc.GetDisasm(ea) - gets the line of disassembly at the supplied address
  20. idc.MakeComm(ea,string) - places the specified text string as a comment at the ea address
  21. idc.MakeRptCmt(ea, string) - places a repeatable comment at the ea address
  22. help(func_name_here) - looks up the func signature for func_name_here
  23. import inspect followed by inspect.getsource(func_name) - gets the source code for func_name
  24. dir(construct) gives you the props/methods available to construct
Advertisement
Add Comment
Please, Sign In to add comment