// vim: ft=cpp sw=4 ts=4 et /* (C) 2003-2008 Willem Jan Hengeveld * * Web: http://www.xs4all.nl/~itsme/projects/ida/ */ // this scripts loads some convenient hotkeys for ida. // initialize by running 'addhotkeys();' // // Shift-I _idc0 repeat last manual idc script // Shift-H HK_Help show help + info (like xrefs and flags) on current line // Shift-C HK_Code covert selection to code // Shift-O HK_Offset convert selection to offsets, also correctly handling Thumb offsets ( which have bit0 set ) // Shift-G HK_Guid convert current data to a GUID // Shift-L HK_Align // Shift-A HK_String_mixed detect and convert to string, unicode and ascii strings // Shift-D HK_Dwords convert to dwords // Shift-P HK_ParsePdata process the .pdata section, and update function definitions accordingly // Shift-F FixFunctions change function bounds to include constant pools, this makes it easier to see where data is referenced from // Shift-J FixJumpCalls // Shift-R findstrange find incorrect offsets ( like off_20000, when an immediate was intended ) // Shift-U summarize_unk group all unknown data // Shift-X HK_ExchangeUp rotate selected instruction range up // Shift-Y HK_ExchangeDown rotate selected instruction range down // Shift-V HK_setregofs try to find the value of the current REG+ofs expression // Shift-T HK_setthis assumes the function is named like TYPE_methodname, and a struct 'struc_TYPE' exists. then it traces where R0 ends up, and creates struc_TYPE fields, and new TYPE_methodname functions accordingly // //todo: make this a standalone .idc, which is included from ida.idc // #include #include #include #include #include //----------------------------------------------------------------------- // Get name of the current processor static get_processor(void) { auto i,procname,chr; procname = ""; for ( i=0; i < 8; i++ ) { chr = GetCharPrm(INF_PROCNAME+i); if ( chr == 0 ) break; procname = procname + chr; } return procname; } static cpu_isX86() { return get_processor()=="386"; } static cpu_isARM() { return get_processor()=="ARM"; } static HK_NumberedNames() { // todo: // get name of first item, // find hex/dec digits, and continue numbering these // with step 1 or 4. // ... think of a way of encoding the (hex,dec) and (1,4) params naturally } static HK_Align() { Table("l"); } static HK_String_mixed() { Table("Al"); } static HK_Dwords() { Table("d"); } static HK_ParsePdata() { ParsePdata(-1,-1); } static HK_String_ascii() { Table("al"); } static HK_Code() { Table("p"); } static HK_Offset() { Table("o"); } static HK_Guid() { Table("g"); } // .. this function is obsolete, replaced by HK_setregofs static HK_setdataofs() { auto ea; if (SelStart()!=BADADDR) { for (ea= SelStart() ; ea!=BADADDR ; ea= NextHead(ea+1, SelEnd())) { setdataofs(ea); } } else { setdataofs(ScreenEA()); } } static HK_setregofs() { auto ea; if (SelStart()!=BADADDR) { for (ea= SelStart() ; ea!=BADADDR ; ea= NextHead(ea+1, SelEnd())) { setregofs(ea); } } else { setregofs(ScreenEA()); } } static HK_setthis() { setthis(ScreenEA()); } static HK_ExchangeUp() { auto ea; if (SelStart()!=BADADDR) { ea= PrevNotTail(SelEnd()); while (ea>SelStart()) { ExchangeInstructions(PrevNotTail(ea), ea); ea= PrevNotTail(ea); } } else { ExchangeInstructions(PrevNotTail(ScreenEA()), ScreenEA()); } } static HK_ExchangeDown() { auto ea; if (SelStart()!=BADADDR) { ea=SelStart(); while (ea