Advertisement
joxeankoret

IDA Python's idc.py <= 7.3 compatibility module

Oct 11th, 2019
2,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 24.50 KB | None | 0 0
  1. """
  2. IDA Python's idc.py <= 7.3 compatibility module
  3. Author: Joxean Koret
  4.  
  5. Public Domain
  6. """
  7.  
  8. import idc
  9. import ida_ua
  10. import ida_ida
  11. import ida_idp
  12. import ida_dbg
  13. import ida_pro
  14. import ida_name
  15. import ida_xref
  16. import ida_auto
  17. import ida_nalt
  18. import ida_name
  19. import ida_enum
  20. import ida_lines
  21. import ida_fixup
  22. import ida_frame
  23. import ida_funcs
  24. import ida_bytes
  25. import ida_loader
  26. import ida_search
  27. import ida_struct
  28. import ida_segment
  29. import ida_kernwin
  30.  
  31. from idc import *
  32.  
  33. GetString = ida_bytes.get_strlit_contents
  34. GetRegValue = idc.get_reg_value
  35. LocByName = idc.get_name_ea_simple
  36. AddBpt = idc.add_bpt
  37.  
  38. def Compile(file): return idc.CompileEx(file, 1)
  39.  
  40. def OpOffset(ea, base): return idc.op_plain_offset(ea, -1, base)
  41.  
  42. def OpNum(ea): return idc.op_num(ea, -1)
  43.  
  44. def OpChar(ea): return idc.op_chr(ea, -1)
  45.  
  46. def OpSegment(ea): return idc.op_seg(ea, -1)
  47.  
  48. def OpDec(ea): return idc.op_dec(ea, -1)
  49.  
  50. def OpAlt1(ea, str): return idc.op_man(ea, 0, str)
  51.  
  52. def OpAlt2(ea, str): return idc.op_man(ea, 1, str)
  53.  
  54. def StringStp(x): return idc.set_inf_attr(INF_STRLIT_BREAK, x)
  55.  
  56. def LowVoids(x): return idc.set_inf_attr(INF_LOW_OFF, x)
  57.  
  58. def HighVoids(x): return idc.set_inf_attr(INF_HIGH_OFF, x)
  59.  
  60. def TailDepth(x): return idc.set_inf_attr(INF_MAXREF, x)
  61.  
  62. def Analysis(x): return idc.set_flag(INF_GENFLAGS, INFFL_AUTO, x)
  63.  
  64. def Comments(x): return idc.set_flag(INF_CMTFLAG, SW_ALLCMT, x)
  65.  
  66. def Voids(x): return idc.set_flag(INF_OUTFLAGS, OFLG_SHOW_VOID, x)
  67.  
  68. def XrefShow(x): return idc.set_inf_attr(INF_XREFNUM, x)
  69.  
  70. def Indent(x): return idc.set_inf_attr(INF_INDENT, x)
  71.  
  72. def CmtIndent(x): return idc.set_inf_attr(INF_COMMENT, x)
  73.  
  74. def AutoShow(x): return idc.set_flag(INF_OUTFLAGS, OFLG_SHOW_AUTO, x)
  75.  
  76. def MinEA(): return idc.get_inf_attr(INF_MIN_EA)
  77.  
  78. def MaxEA(): return idc.get_inf_attr(INF_MAX_EA)
  79.  
  80. def StartEA(): return idc.get_inf_attr(INF_START_EA)
  81.  
  82. def set_start_cs(x): return idc.set_inf_attr(INF_START_CS, x)
  83.  
  84. def set_start_ip(x): return idc.set_inf_attr(INF_START_IP, x)
  85.  
  86. def auto_make_code(x): return idc.auto_mark_range(x, (x)+1, AU_CODE);
  87.  
  88. def AddConst(enum_id, name, value): return idc.add_enum_member(enum_id, name, value, -1)
  89.  
  90. def AddStruc(index, name): return idc.add_struc(index, name, 0)
  91.  
  92. def AddUnion(index, name): return idc.add_struc(index, name, 1)
  93.  
  94. def OpStroff(ea, n, strid): return idc.op_stroff(ea, n, strid, 0)
  95.  
  96. def OpEnum(ea, n, enumid): return idc.op_enum(ea, n, enumid, 0)
  97.  
  98. def DelConst(id, v, mask): return idc.del_enum_member(id, v, 0, mask)
  99.  
  100. def GetConst(id, v, mask): return idc.get_enum_member(id, v, 0, mask)
  101.  
  102. AnalyseRange = idc.plan_and_wait
  103. AnalyseArea = idc.plan_and_wait
  104. AnalyzeArea = idc.plan_and_wait
  105.  
  106. def MakeStruct(ea, name): return idc.create_struct(ea, -1, name)
  107.  
  108. def Name(ea): return idc.get_name(ea, ida_name.GN_VISIBLE)
  109.  
  110. GetTrueName = ida_name.get_ea_name
  111.  
  112. def MakeName(ea, name): return idc.set_name(ea, name, SN_CHECK)
  113.  
  114. def GetFrame(ea): return idc.get_func_attr(ea, FUNCATTR_FRAME)
  115.  
  116. def GetFrameLvarSize(ea): return idc.get_func_attr(ea, FUNCATTR_FRSIZE)
  117.  
  118. def GetFrameRegsSize(ea): return idc.get_func_attr(ea, FUNCATTR_FRREGS)
  119.  
  120. def GetFrameArgsSize(ea): return idc.get_func_attr(ea, FUNCATTR_ARGSIZE)
  121.  
  122. def GetFunctionFlags(ea): return idc.get_func_attr(ea, FUNCATTR_FLAGS)
  123.  
  124. def SetFunctionFlags(ea, flags): return idc.set_func_attr(ea, FUNCATTR_FLAGS, flags)
  125.  
  126. SegCreate = idc.AddSeg
  127. SegDelete = idc.del_segm
  128. SegBounds = idc.set_segment_bounds
  129. SegRename = idc.set_segm_name
  130. SegClass = idc.set_segm_class
  131. SegAddrng = idc.set_segm_addressing
  132. SegDefReg = idc.set_default_sreg_value
  133.  
  134. def Comment(ea): return idc.get_cmt(ea, 0)
  135.  
  136. def RptCmt(ea): return idc.get_cmt(ea, 1)
  137.  
  138. def MakeByte(ea): return ida_bytes.create_data(ea, FF_BYTE, 1, ida_idaapi.BADADDR)
  139.  
  140. def MakeWord(ea): return ida_bytes.create_data(ea, FF_WORD, 2, ida_idaapi.BADADDR)
  141.  
  142. def MakeDword(ea): return ida_bytes.create_data(ea, FF_DWORD, 4, ida_idaapi.BADADDR)
  143.  
  144. def MakeQword(ea): return ida_bytes.create_data(ea, FF_QWORD, 8, ida_idaapi.BADADDR)
  145.  
  146. def MakeOword(ea): return ida_bytes.create_data(ea, FF_OWORD, 16, ida_idaapi.BADADDR)
  147.  
  148. def MakeYword(ea): return ida_bytes.create_data(ea, FF_YWORD, 32, ida_idaapi.BADADDR)
  149.  
  150. def MakeFloat(ea): return ida_bytes.create_data(ea, FF_FLOAT, 4, ida_idaapi.BADADDR)
  151.  
  152. def MakeDouble(ea): return ida_bytes.create_data(ea, FF_DOUBLE, 8, ida_idaapi.BADADDR)
  153.  
  154. def MakePackReal(ea): return ida_bytes.create_data(ea, FF_PACKREAL, 10, ida_idaapi.BADADDR)
  155.  
  156. def MakeTbyte(ea): return ida_bytes.create_data(ea, FF_TBYTE, 10, ida_idaapi.BADADDR)
  157.  
  158. def MakeCustomData(ea, size, dtid, fid): return ida_bytes.create_data(ea, FF_CUSTOM, size, dtid|((fid)<<16))
  159.  
  160. def SetReg(ea, reg, value): return idc.split_sreg_range(ea, reg, value, SR_user)
  161.  
  162. SegByName = idc.selector_by_name
  163. MK_FP = idc.to_ea
  164. toEA = idc.to_ea
  165. MakeCode = idc.create_insn
  166. MakeNameEx = idc.set_name
  167. MakeArray = idc.make_array
  168. MakeData = ida_bytes.create_data
  169. GetRegValue = idc.get_reg_value
  170. SetRegValue = idc.set_reg_value
  171. Byte = idc.get_wide_byte
  172. Word = idc.get_wide_word
  173. Dword = idc.get_wide_dword
  174. Qword = idc.get_qword
  175. LocByName = idc.get_name_ea_simple
  176. ScreenEA = idc.get_screen_ea
  177. GetTinfo = idc.get_tinfo
  178. OpChr = idc.op_chr
  179. OpSeg = idc.op_seg
  180. OpNumber = idc.op_num
  181. OpDecimal = idc.op_dec
  182. OpOctal = idc.op_oct
  183. OpBinary = idc.op_bin
  184. OpHex = idc.op_hex
  185. OpAlt = idc.op_man
  186. OpSign = idc.toggle_sign
  187. OpNot = idc.toggle_bnot
  188. OpEnumEx = idc.op_enum
  189. OpStroffEx = idc.op_stroff
  190. OpStkvar = idc.op_stkvar
  191. OpFloat = idc.op_flt
  192. OpOffEx = idc.op_offset
  193. OpOff = idc.op_plain_offset
  194. MakeStructEx = idc.create_struct
  195. Jump = ida_kernwin.jumpto
  196. GenerateFile = idc.gen_file
  197. GenFuncGdl = idc.gen_flow_graph
  198. GenCallGdl = idc.gen_simple_call_chart
  199. IdbByte = ida_bytes.get_db_byte
  200. DbgByte = idc.read_dbg_byte
  201. DbgWord = idc.read_dbg_word
  202. DbgDword = idc.read_dbg_dword
  203. DbgQword = idc.read_dbg_qword
  204. DbgRead = idc.read_dbg_memory
  205. DbgWrite = idc.write_dbg_memory
  206. PatchDbgByte = idc.patch_dbg_byte
  207. PatchByte = ida_bytes.patch_byte
  208. PatchWord = ida_bytes.patch_word
  209. PatchDword = ida_bytes.patch_dword
  210. PatchQword = ida_bytes.patch_qword
  211. SetProcessorType = ida_idp.set_processor_type
  212. SetTargetAssembler = ida_idp.set_target_assembler
  213. Batch = idc.batch
  214. SetSegDefReg = idc.set_default_sreg_value
  215. GetReg = idc.get_sreg
  216. SetRegEx = idc.split_sreg_range
  217.  
  218. def AskStr(defval, prompt): return ida_kernwin.ask_str(defval, 0, prompt)
  219.  
  220. AskFile = ida_kernwin.ask_file
  221. AskAddr = ida_kernwin.ask_addr
  222. AskLong = ida_kernwin.ask_long
  223. AskSeg = ida_kernwin.ask_seg
  224.  
  225. def AskIdent(defval, prompt): return ida_kernwin.ask_str(defval, ida_kernwin.HIST_IDENT, prompt)
  226.  
  227. AskYN = ida_kernwin.ask_yn
  228. DeleteAll = idc.delete_all_segments
  229. AddSegEx = idc.add_segm_ex
  230. SetSegBounds = idc.set_segment_bounds
  231. RenameSeg = idc.set_segm_name
  232. SetSegClass = idc.set_segm_class
  233. SetSegAddressing = idc.set_segm_addressing
  234. SetSegmentAttr = idc.set_segm_attr
  235. GetSegmentAttr = idc.get_segm_attr
  236. SetStorageType = ida_bytes.change_storage_type
  237. MoveSegm = idc.move_segm
  238. RebaseProgram = ida_segment.rebase_program
  239. LocByNameEx = ida_name.get_name_ea
  240. SegByBase = idc.get_segm_by_sel
  241. GetCurrentLine = idc.get_curline
  242. SelStart = idc.read_selection_start
  243. SelEnd = idc.read_selection_end
  244. FirstSeg = idc.get_first_seg
  245. NextSeg = idc.get_next_seg
  246. SegName = idc.get_segm_name
  247. CommentEx = ida_bytes.get_cmt
  248. AltOp = ida_bytes.get_forced_operand
  249. GetDisasmEx = idc.generate_disasm_line
  250. GetMnem = idc.print_insn_mnem
  251. GetOpType = idc.get_operand_type
  252. GetOperandValue = idc.get_operand_value
  253. DecodeInstruction = ida_ua.decode_insn
  254. NextAddr = ida_bytes.next_addr
  255. PrevAddr = ida_bytes.prev_addr
  256. NextNotTail = ida_bytes.next_not_tail
  257. PrevNotTail = ida_bytes.prev_not_tail
  258. ItemHead = ida_bytes.get_item_head
  259. ItemEnd = ida_bytes.get_item_end
  260. ItemSize = idc.get_item_size
  261. AnalyzeRange = idc.plan_and_wait
  262. Eval = idc.eval_idc
  263. Exit = ida_pro.qexit
  264. FindVoid = ida_search.find_suspop
  265. FindCode = ida_search.find_code
  266. FindData = ida_search.find_data
  267. FindUnexplored = ida_search.find_unknown
  268. FindExplored = ida_search.find_defined
  269. FindImmediate = ida_search.find_imm
  270. AddCodeXref = ida_xref.add_cref
  271. DelCodeXref = ida_xref.del_cref
  272. Rfirst = ida_xref.get_first_cref_from
  273. RfirstB = ida_xref.get_first_cref_to
  274. Rnext = ida_xref.get_next_cref_from
  275. RnextB = ida_xref.get_next_cref_to
  276. Rfirst0 = ida_xref.get_first_fcref_from
  277. RfirstB0 = ida_xref.get_first_fcref_to
  278. Rnext0 = ida_xref.get_next_fcref_from
  279. RnextB0 = ida_xref.get_next_fcref_to
  280. Dfirst = ida_xref.get_first_dref_from
  281. Dnext = ida_xref.get_next_dref_from
  282. DfirstB = ida_xref.get_first_dref_to
  283. DnextB = ida_xref.get_next_dref_to
  284. XrefType = idc.get_xref_type
  285. AutoUnmark = ida_auto.auto_unmark
  286. AutoMark2 = ida_auto.auto_mark_range
  287. SetSelector = ida_segment.set_selector
  288. AskSelector = idc.sel2para
  289. ask_selector = idc.sel2para
  290. FindSelector = idc.find_selector
  291. DelSelector = ida_segment.del_selector
  292. MakeFunction = ida_funcs.add_func
  293. DelFunction = ida_funcs.del_func
  294. SetFunctionEnd = ida_funcs.set_func_end
  295. NextFunction = idc.get_next_func
  296. PrevFunction = idc.get_prev_func
  297. GetFunctionAttr = idc.get_func_attr
  298. SetFunctionAttr = idc.set_func_attr
  299. GetFunctionName = idc.get_func_name
  300. GetFunctionCmt = idc.get_func_cmt
  301. SetFunctionCmt = idc.set_func_cmt
  302. ChooseFunction = idc.choose_func
  303. GetFuncOffset = idc.get_func_off_str
  304. MakeLocal = idc.define_local_var
  305. FindFuncEnd = idc.find_func_end
  306. GetFrameSize = idc.get_frame_size
  307. MakeFrame = idc.set_frame_size
  308. GetSpd = idc.get_spd
  309. GetSpDiff = idc.get_sp_delta
  310. DelStkPnt = idc.del_stkpnt
  311. AddAutoStkPnt2 = idc.add_auto_stkpnt
  312. RecalcSpd = ida_frame.recalc_spd
  313. GetMinSpd = idc.get_min_spd_ea
  314. GetFchunkAttr = idc.get_fchunk_attr
  315. SetFchunkAttr = idc.set_fchunk_attr
  316. GetFchunkReferer = ida_funcs.get_fchunk_referer
  317. NextFchunk = idc.get_next_fchunk
  318. PrevFchunk = idc.get_prev_fchunk
  319. AppendFchunk = idc.append_func_tail
  320. RemoveFchunk = idc.remove_fchunk
  321. SetFchunkOwner = idc.set_tail_owner
  322. FirstFuncFchunk = idc.first_func_chunk
  323. NextFuncFchunk = idc.next_func_chunk
  324. GetEntryPointQty = ida_entry.get_entry_qty
  325. AddEntryPoint = ida_entry.add_entry
  326. GetEntryName = ida_entry.get_entry_name
  327. GetEntryOrdinal = ida_entry.get_entry_ordinal
  328. GetEntryPoint = ida_entry.get_entry
  329. RenameEntryPoint = ida_entry.rename_entry
  330. GetNextFixupEA = ida_fixup.get_next_fixup_ea
  331. GetPrevFixupEA = ida_fixup.get_prev_fixup_ea
  332. GetFixupTgtType = idc.get_fixup_target_type
  333. GetFixupTgtFlags = idc.get_fixup_target_flags
  334. GetFixupTgtSel = idc.get_fixup_target_sel
  335. GetFixupTgtOff = idc.get_fixup_target_off
  336. GetFixupTgtDispl = idc.get_fixup_target_dis
  337. SetFixup = idc.set_fixup
  338. DelFixup = ida_fixup.del_fixup
  339. MarkPosition = idc.put_bookmark
  340. GetMarkedPos = idc.get_bookmark
  341. GetMarkComment = idc.get_bookmark_desc
  342. GetStrucQty = ida_struct.get_struc_qty
  343. GetFirstStrucIdx = ida_struct.get_first_struc_idx
  344. GetLastStrucIdx = ida_struct.get_last_struc_idx
  345. GetNextStrucIdx = ida_struct.get_next_struc_idx
  346. GetPrevStrucIdx = ida_struct.get_prev_struc_idx
  347. GetStrucIdx = ida_struct.get_struc_idx
  348. GetStrucId = ida_struct.get_struc_by_idx
  349. GetStrucIdByName = ida_struct.get_struc_id
  350. GetStrucName = ida_struct.get_struc_name
  351. GetStrucComment = ida_struct.get_struc_cmt
  352. GetStrucSize = ida_struct.get_struc_size
  353. GetMemberQty = idc.get_member_qty
  354. GetStrucPrevOff = idc.get_prev_offset
  355. GetStrucNextOff = idc.get_next_offset
  356. GetFirstMember = idc.get_first_member
  357. GetLastMember = idc.get_last_member
  358. GetMemberOffset = idc.get_member_offset
  359. GetMemberName = idc.get_member_name
  360. GetMemberComment = idc.get_member_cmt
  361. GetMemberSize = idc.get_member_size
  362. GetMemberFlag = idc.get_member_flag
  363. GetMemberStrId = idc.get_member_strid
  364. GetMemberId = idc.get_member_id
  365. AddStrucEx = idc.add_struc
  366. IsUnion = idc.is_union
  367. DelStruc = idc.del_struc
  368. SetStrucIdx = idc.set_struc_idx
  369. SetStrucName = ida_struct.set_struc_name
  370. SetStrucComment = ida_struct.set_struc_cmt
  371. AddStrucMember = idc.add_struc_member
  372. DelStrucMember = idc.del_struc_member
  373. SetMemberName = idc.set_member_name
  374. SetMemberType = idc.set_member_type
  375. SetMemberComment = idc.set_member_cmt
  376. ExpandStruc = idc.expand_struc
  377. SetLineNumber = ida_nalt.set_source_linnum
  378. GetLineNumber = ida_nalt.get_source_linnum
  379. DelLineNumber = ida_nalt.del_source_linnum
  380. AddSourceFile = ida_lines.add_sourcefile
  381. GetSourceFile = ida_lines.get_sourcefile
  382. DelSourceFile = ida_lines.del_sourcefile
  383. CreateArray = idc.create_array
  384. GetArrayId = idc.get_array_id
  385. RenameArray = idc.rename_array
  386. DeleteArray = idc.delete_array
  387. SetArrayLong = idc.set_array_long
  388. SetArrayString = idc.set_array_string
  389. GetArrayElement = idc.get_array_element
  390. DelArrayElement = idc.del_array_element
  391. GetFirstIndex = idc.get_first_index
  392. GetNextIndex = idc.get_next_index
  393. GetLastIndex = idc.get_last_index
  394. GetPrevIndex = idc.get_prev_index
  395. SetHashLong = idc.set_hash_long
  396. SetHashString = idc.set_hash_string
  397. GetHashLong = idc.get_hash_long
  398. GetHashString = idc.get_hash_string
  399. DelHashElement = idc.del_hash_string
  400. GetFirstHashKey = idc.get_first_hash_key
  401. GetNextHashKey = idc.get_next_hash_key
  402. GetLastHashKey = idc.get_last_hash_key
  403. GetPrevHashKey = idc.get_prev_hash_key
  404. GetEnumQty = ida_enum.get_enum_qty
  405. GetnEnum = ida_enum.getn_enum
  406. GetEnumIdx = ida_enum.get_enum_idx
  407. GetEnum = ida_enum.get_enum
  408. GetEnumName = ida_enum.get_enum_name
  409. GetEnumCmt = ida_enum.get_enum_cmt
  410. GetEnumSize = ida_enum.get_enum_size
  411. GetEnumWidth = ida_enum.get_enum_width
  412. GetEnumFlag = ida_enum.get_enum_flag
  413. GetConstByName = ida_enum.get_enum_member_by_name
  414. GetConstValue = ida_enum.get_enum_member_value
  415. GetConstBmask = ida_enum.get_enum_member_bmask
  416. GetConstEnum = ida_enum.get_enum_member_enum
  417. GetConstEx = idc.get_enum_member
  418. GetFirstBmask = ida_enum.get_first_bmask
  419. GetLastBmask = ida_enum.get_last_bmask
  420. GetNextBmask = ida_enum.get_next_bmask
  421. GetPrevBmask = ida_enum.get_prev_bmask
  422. GetFirstConst = idc.get_first_enum_member
  423. GetLastConst = idc.get_last_enum_member
  424. GetNextConst = idc.get_next_enum_member
  425. GetPrevConst = idc.get_prev_enum_member
  426. GetConstName = idc.get_enum_member_name
  427. GetConstCmt = idc.get_enum_member_cmt
  428. AddEnum = idc.add_enum
  429. DelEnum = ida_enum.del_enum
  430. SetEnumIdx = ida_enum.set_enum_idx
  431. SetEnumName = ida_enum.set_enum_name
  432. SetEnumCmt = ida_enum.set_enum_cmt
  433. SetEnumFlag = ida_enum.set_enum_flag
  434. SetEnumWidth = ida_enum.set_enum_width
  435. SetEnumBf = ida_enum.set_enum_bf
  436. AddConstEx = idc.add_enum_member
  437. DelConstEx = idc.del_enum_member
  438. SetConstName = ida_enum.set_enum_member_name
  439. SetConstCmt = ida_enum.set_enum_member_cmt
  440. IsBitfield = ida_enum.is_bf
  441. SetBmaskName = idc.set_bmask_name
  442. GetBmaskName = idc.get_bmask_name
  443. SetBmaskCmt = idc.set_bmask_cmt
  444. GetBmaskCmt = idc.get_bmask_cmt
  445. GetLongPrm = idc.get_inf_attr
  446. GetShortPrm = idc.get_inf_attr
  447. GetCharPrm = idc.get_inf_attr
  448. SetLongPrm = idc.set_inf_attr
  449. SetShortPrm = idc.set_inf_attr
  450. SetCharPrm = idc.set_inf_attr
  451. ChangeConfig = idc.process_config_line
  452. AddHotkey = ida_kernwin.add_idc_hotkey
  453. DelHotkey = ida_kernwin.del_idc_hotkey
  454. GetInputFile = ida_nalt.get_root_filename
  455. GetInputFilePath = ida_nalt.get_input_file_path
  456. SetInputFilePath = ida_nalt.set_root_filename
  457. Exec = idc.call_system
  458. Sleep = idc.qsleep
  459. GetIdaDirectory = idc.idadir
  460. GetIdbPath = idc.get_idb_path
  461. GetInputMD5 = ida_nalt.retrieve_input_file_md5
  462. OpHigh = idc.op_offset_high16
  463. MakeAlign = ida_bytes.create_align
  464. Demangle = idc.demangle_name
  465. SetManualInsn = ida_bytes.set_manual_insn
  466. GetManualInsn = ida_bytes.get_manual_insn
  467. SetArrayFormat = idc.set_array_params
  468. LoadTil = idc.add_default_til
  469. Til2Idb = idc.import_type
  470. GetMaxLocalType = idc.get_ordinal_qty
  471. SetLocalType = idc.set_local_type
  472. GetLocalTinfo = idc.get_local_tinfo
  473. GetLocalTypeName = idc.get_numbered_type_name
  474. PrintLocalTypes = idc.print_decls
  475. SetStatus = ida_auto.set_ida_state
  476. Refresh = ida_kernwin.refresh_idaview_anyway
  477. RefreshLists = ida_kernwin.refresh_choosers
  478. RunPlugin = ida_loader.load_and_run_plugin
  479. ApplySig = ida_funcs.plan_to_apply_idasgn
  480. GetStringType = idc.get_str_type
  481. GetOriginalByte = ida_bytes.get_original_byte
  482. HideRange = ida_bytes.add_hidden_range
  483. SetHiddenRange = idc.update_hidden_range
  484. DelHiddenRange = ida_bytes.del_hidden_range
  485. GetType = idc.get_type
  486. GuessType = idc.guess_type
  487. ParseType = idc.parse_decl
  488. GetColor = idc.get_color
  489. SetColor = idc.set_color
  490. GetBptQty = ida_dbg.get_bpt_qty
  491. GetBptEA = idc.get_bpt_ea
  492. GetBptAttr = idc.get_bpt_attr
  493. SetBptAttr = idc.set_bpt_attr
  494. SetBptCndEx = idc.set_bpt_cond
  495. SetBptCnd = idc.set_bpt_cond
  496. AddBptEx = ida_dbg.add_bpt
  497. AddBpt = ida_dbg.add_bpt
  498. DelBpt = ida_dbg.del_bpt
  499. EnableBpt = ida_dbg.enable_bpt
  500. CheckBpt = ida_dbg.check_bpt
  501. LoadDebugger = ida_dbg.load_debugger
  502. StartDebugger = ida_dbg.start_process
  503. StopDebugger = ida_dbg.exit_process
  504. PauseProcess = ida_dbg.suspend_process
  505.  
  506. def GetProcessQty(): return ida_dbg.get_processes().size
  507.  
  508. def GetProcessPid(idx): return ida_dbg.get_processes()[idx].pid
  509.  
  510. def GetProcessName(idx): return ida_dbg.get_processes()[idx].name
  511.  
  512. AttachProcess = ida_dbg.attach_process
  513. DetachProcess = ida_dbg.detach_process
  514. GetThreadQty = ida_dbg.get_thread_qty
  515. GetThreadId = ida_dbg.getn_thread
  516. GetCurrentThreadId = ida_dbg.get_current_thread
  517. SelectThread = ida_dbg.select_thread
  518. SuspendThread = ida_dbg.suspend_thread
  519. ResumeThread = ida_dbg.resume_thread
  520. GetFirstModule = idc.get_first_module
  521. GetNextModule = idc.get_next_module
  522. GetModuleName = idc.get_module_name
  523. GetModuleSize = idc.get_module_size
  524. StepInto = ida_dbg.step_into
  525. StepOver = ida_dbg.step_over
  526. RunTo = ida_dbg.run_to
  527. StepUntilRet = ida_dbg.step_until_ret
  528. GetDebuggerEvent = ida_dbg.wait_for_next_event
  529. GetProcessState = ida_dbg.get_process_state
  530. SetDebuggerOptions = ida_dbg.set_debugger_options
  531. SetRemoteDebugger = ida_dbg.set_remote_debugger
  532. GetDebuggerEventCondition = ida_dbg.get_debugger_event_cond
  533. SetDebuggerEventCondition = ida_dbg.set_debugger_event_cond
  534. GetEventId = idc.get_event_id
  535. GetEventPid = idc.get_event_pid
  536. GetEventTid = idc.get_event_tid
  537. GetEventEa = idc.get_event_ea
  538. IsEventHandled = idc.is_event_handled
  539. GetEventModuleName = idc.get_event_module_name
  540. GetEventModuleBase = idc.get_event_module_base
  541. GetEventModuleSize = idc.get_event_module_size
  542. GetEventExitCode = idc.get_event_exit_code
  543. GetEventInfo = idc.get_event_info
  544. GetEventBptHardwareEa = idc.get_event_bpt_hea
  545. GetEventExceptionCode = idc.get_event_exc_code
  546. GetEventExceptionEa = idc.get_event_exc_ea
  547. GetEventExceptionInfo = idc.get_event_exc_info
  548. CanExceptionContinue = idc.can_exc_continue
  549. RefreshDebuggerMemory = ida_dbg.refresh_debugger_memory
  550. TakeMemorySnapshot = ida_segment.take_memory_snapshot
  551. EnableTracing = idc.enable_tracing
  552. GetStepTraceOptions = ida_dbg.get_step_trace_options
  553. SetStepTraceOptions = ida_dbg.set_step_trace_options
  554. DefineException = ida_dbg.define_exception
  555. BeginTypeUpdating = ida_typeinf.begin_type_updating
  556. EndTypeUpdating = ida_typeinf.end_type_updating
  557. ValidateNames = idc.validate_idb_names
  558.  
  559. def SegAlign(ea, alignment): return idc.set_segm_attr(ea, SEGATTR_ALIGN, alignment)
  560.  
  561. def SegComb(ea, comb): return idc.set_segm_attr(ea, SEGATTR_COMB, comb)
  562.  
  563. def MakeComm(ea, cmt): return idc.set_cmt(ea, cmt, 0)
  564.  
  565. def MakeRptCmt(ea, cmt): return idc.set_cmt(ea, cmt, 1)
  566.  
  567. MakeUnkn = ida_bytes.del_items
  568. MakeUnknown = ida_bytes.del_items
  569.  
  570. def LineA(ea, n): return ida_lines.get_extra_cmt(ea, E_PREV + (n))
  571.  
  572. def LineB(ea, n): return ida_lines.get_extra_cmt(ea, E_NEXT + (n))
  573.  
  574. def ExtLinA(ea, n, line): return ida_lines.update_extra_cmt(ea, E_PREV + (n), line)
  575.  
  576. def ExtLinB(ea, n, line): return ida_lines.update_extra_cmt(ea, E_NEXT + (n), line)
  577.  
  578. def DelExtLnA(ea, n): return ida_lines.del_extra_cmt(ea, E_PREV + (n))
  579.  
  580. def DelExtLnB(ea, n): return ida_lines.del_extra_cmt(ea, E_NEXT + (n))
  581.  
  582. SetSpDiff = ida_frame.add_user_stkpnt
  583. AddUserStkPnt = ida_frame.add_user_stkpnt
  584.  
  585. def NameEx(From, ea): return idc.get_name(ea, ida_name.GN_VISIBLE | calc_gtn_flags(From, ea))
  586.  
  587. def GetTrueNameEx(From, ea): return idc.get_name(ea, calc_gtn_flags(From, ea))
  588.  
  589. Message = ida_kernwin.msg
  590. UMessage = ida_kernwin.msg
  591. DelSeg = ida_segment.del_segm
  592. Wait = ida_auto.auto_wait
  593. LoadTraceFile = ida_dbg.load_trace_file
  594. SaveTraceFile = ida_dbg.save_trace_file
  595. CheckTraceFile = ida_dbg.is_valid_trace_file
  596. DiffTraceFile = ida_dbg.diff_trace_file
  597. SetTraceDesc = ida_dbg.get_trace_file_desc
  598. GetTraceDesc = ida_dbg.set_trace_file_desc
  599. GetMaxTev = ida_dbg.get_tev_qty
  600. GetTevEa = ida_dbg.get_tev_ea
  601. GetTevType = ida_dbg.get_tev_type
  602. GetTevTid = ida_dbg.get_tev_tid
  603. GetTevCallee = ida_dbg.get_call_tev_callee
  604. GetTevReturn = ida_dbg.get_ret_tev_return
  605. GetBptTevEa = ida_dbg.get_bpt_tev_ea
  606. ArmForceBLJump = idc.force_bl_jump
  607. ArmForceBLCall = idc.force_bl_call
  608. BochsCommand = idc.send_dbg_command
  609. SendGDBMonitor = idc.send_dbg_command
  610. WinDbgCommand = idc.send_dbg_command
  611.  
  612. def SetAppcallOptions(x): return idc.set_inf_attr(INF_APPCALL_OPTIONS, x)
  613.  
  614. def GetAppcallOptions(): return idc.get_inf_attr(INF_APPCALL_OPTIONS)
  615.  
  616. AF2_ANORET = ida_ida.AF_ANORET
  617. AF2_CHKUNI = ida_ida.AF_CHKUNI
  618. AF2_DATOFF = ida_ida.AF_DATOFF
  619. AF2_DOCODE = ida_ida.AF_DOCODE
  620. AF2_DODATA = ida_ida.AF_DODATA
  621. AF2_FTAIL = ida_ida.AF_FTAIL
  622. AF2_HFLIRT = ida_ida.AF_HFLIRT
  623. AF2_JUMPTBL = ida_ida.AF_JUMPTBL
  624. AF2_PURDAT = ida_ida.AF_PURDAT
  625. AF2_REGARG = ida_ida.AF_REGARG
  626. AF2_SIGCMT = ida_ida.AF_SIGCMT
  627. AF2_SIGMLT = ida_ida.AF_SIGMLT
  628. AF2_STKARG = ida_ida.AF_STKARG
  629. AF2_TRFUNC = ida_ida.AF_TRFUNC
  630. AF2_VERSP = ida_ida.AF_VERSP
  631. AF_ASCII = ida_ida.AF_STRLIT
  632. ASCF_AUTO = ida_ida.STRF_AUTO
  633. ASCF_COMMENT = ida_ida.STRF_COMMENT
  634. ASCF_GEN = ida_ida.STRF_GEN
  635. ASCF_SAVECASE = ida_ida.STRF_SAVECASE
  636. ASCF_SERIAL = ida_ida.STRF_SERIAL
  637. ASCSTR_C = ida_nalt.STRTYPE_C
  638. ASCSTR_LEN2 = ida_nalt.STRTYPE_LEN2
  639. ASCSTR_LEN4 = ida_nalt.STRTYPE_LEN4
  640. ASCSTR_PASCAL = ida_nalt.STRTYPE_PASCAL
  641. ASCSTR_TERMCHR = ida_nalt.STRTYPE_TERMCHR
  642. ASCSTR_ULEN2 = ida_nalt.STRTYPE_LEN2_16
  643. ASCSTR_ULEN4 = ida_nalt.STRTYPE_LEN4_16
  644. ASCSTR_UNICODE = ida_nalt.STRTYPE_C_16
  645. DOUNK_SIMPLE = ida_bytes.DELIT_SIMPLE
  646. DOUNK_EXPAND = ida_bytes.DELIT_EXPAND
  647. DOUNK_DELNAMES = ida_bytes.DELIT_DELNAMES
  648. FF_ASCI = ida_bytes.FF_STRLIT
  649. FF_DWRD = ida_bytes.FF_DWORD
  650. FF_OWRD = ida_bytes.FF_OWORD
  651. FF_QWRD = ida_bytes.FF_QWORD
  652. FF_STRU = ida_bytes.FF_STRUCT
  653. FF_TBYT = ida_bytes.FF_TBYTE
  654. FIXUP_BYTE = ida_fixup.FIXUP_OFF8
  655. FIXUP_CREATED = ida_fixup.FIXUPF_CREATED
  656. FIXUP_EXTDEF = ida_fixup.FIXUPF_EXTDEF
  657. FIXUP_REL = ida_fixup.FIXUPF_REL
  658. FIXUP_UNUSED = ida_fixup.FIXUPF_UNUSED
  659. GetFlags = ida_bytes.get_full_flags
  660. ResumeProcess = idc.resume_process
  661. isEnabled = ida_bytes.is_mapped
  662. hasValue = ida_bytes.has_value
  663. isByte = ida_bytes.is_byte
  664. isWord = ida_bytes.is_word
  665. isDwrd = ida_bytes.is_dword
  666. isQwrd = ida_bytes.is_qword
  667. isOwrd = ida_bytes.is_oword
  668. isTbyt = ida_bytes.is_tbyte
  669. isFloat = ida_bytes.is_float
  670. isDouble = ida_bytes.is_double
  671. isASCII = ida_bytes.is_strlit
  672. isStruct = ida_bytes.is_struct
  673. isAlign = ida_bytes.is_align
  674. isChar0 = ida_bytes.is_char0
  675. isChar1 = ida_bytes.is_char1
  676. isCode = ida_bytes.is_code
  677. isData = ida_bytes.is_data
  678. isDefArg0 = ida_bytes.is_defarg0
  679. isDefArg1 = ida_bytes.is_defarg1
  680. isEnum0 = ida_bytes.is_enum0
  681. isEnum1 = ida_bytes.is_enum1
  682. isFlow = ida_bytes.is_flow
  683. isHead = ida_bytes.is_head
  684. isLoaded = ida_bytes.is_loaded
  685. isOff0 = ida_bytes.is_off0
  686. isOff1 = ida_bytes.is_off1
  687. isPackReal = ida_bytes.is_pack_real
  688. isSeg0 = ida_bytes.is_seg0
  689. isSeg1 = ida_bytes.is_seg1
  690. isStkvar0 = ida_bytes.is_stkvar0
  691. isStkvar1 = ida_bytes.is_stkvar1
  692. isStroff0 = ida_bytes.is_stroff0
  693. isStroff1 = ida_bytes.is_stroff1
  694. isTail = ida_bytes.is_tail
  695. isUnknown = ida_bytes.is_unknown
  696. SEGDEL_KEEP = ida_segment.SEGMOD_KEEP
  697. SEGDEL_PERM = ida_segment.SEGMOD_KILL
  698. SEGDEL_SILENT = ida_segment.SEGMOD_SILENT
  699. SETPROC_ALL = ida_idp.SETPROC_LOADER_NON_FATAL
  700. SETPROC_COMPAT = ida_idp.SETPROC_IDB
  701. SETPROC_FATAL = ida_idp.SETPROC_LOADER
  702. INF_CHANGE_COUNTER = idc.INF_DATABASE_CHANGE_COUNT
  703. INF_LOW_OFF = idc.INF_LOWOFF
  704. INF_HIGH_OFF = idc.INF_HIGHOFF
  705. INF_START_PRIVRANGE = idc.INF_PRIVRANGE_START_EA
  706. INF_END_PRIVRANGE = idc.INF_PRIVRANGE_END_EA
  707. INF_TYPE_XREFS = idc.INF_TYPE_XREFNUM
  708. INF_REFCMTS = idc.INF_REFCMTNUM
  709. INF_XREFS = idc.INF_XREFFLAG
  710. INF_NAMELEN = idc.INF_MAX_AUTONAME_LEN
  711. INF_SHORT_DN = idc.INF_SHORT_DEMNAMES
  712. INF_LONG_DN = idc.INF_LONG_DEMNAMES
  713. INF_CMTFLAG = idc.INF_CMTFLG
  714. INF_BORDER = idc.INF_LIMITER
  715. INF_BINPREF = idc.INF_BIN_PREFIX_SIZE
  716. INF_COMPILER = idc.INF_CC_ID
  717. INF_MODEL = idc.INF_CC_CM
  718. INF_SIZEOF_INT = idc.INF_CC_SIZE_I
  719. INF_SIZEOF_BOOL = idc.INF_CC_SIZE_B
  720. INF_SIZEOF_ENUM = idc.INF_CC_SIZE_E
  721. INF_SIZEOF_ALGN = idc.INF_CC_DEFALIGN
  722. INF_SIZEOF_SHORT = idc.INF_CC_SIZE_S
  723. INF_SIZEOF_LONG = idc.INF_CC_SIZE_L
  724. INF_SIZEOF_LLONG = idc.INF_CC_SIZE_LL
  725. INF_SIZEOF_LDBL = idc.INF_CC_SIZE_LDBL
  726. REF_VHIGH = ida_nalt.V695_REF_VHIGH
  727. REF_VLOW = ida_nalt.V695_REF_VLOW
  728. GetOpnd = idc.print_operand
  729. patch_long = ida_bytes.patch_dword
  730.  
  731. def python_on(): return ida_loader.load_and_run_plugin("idapython", 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement