///////////////////////////////////////////////////////////////////////////////////////////////////
//Write repeatble comment to the ida database.Such as the Chinese characters exported from OD //
//The data formart show be like fallows: //
//007714F4 发现无线设备, 连接中…… //
//007714F8 发现有线设备, 连接中…… //
//The first is a address, and then 2 spaces ,and the last is the Comment for the data //
//Script by obaby , site:http://www.h4ck.org.cn ,Email:root@h4ck.ws ,Date:11:59 2011-11-7 //
///////////////////////////////////////////////////////////////////////////////////////////////////
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | /////////////////////////////////////////////////////////////////////////////////////////////////// //Write repeatble comment to the ida database.Such as the Chinese characters exported from OD // //The data formart show be like fallows: // //007714F4 发现无线设备, 连接中...... // //007714F8 发现有线设备, 连接中...... // //The first is a address, and then 2 spaces ,and the last is the Comment for the data // //Script by obaby , site:http://www.h4ck.org.cn ,Email:root@h4ck.ws ,Date:11:59 2011-11-7 // /////////////////////////////////////////////////////////////////////////////////////////////////// #include <idc .idc> static main() { Message("====================IDA repeatble Comments Marker====================\n"); Message(" Code By obaby \n"); Message(" http://www.h4ck.ws \n"); Message("=====================================================================\n"); auto rComm,addr,linetext,oldname,handle,filelen,off,rCommlen,file,path,oldhandle; file = AskFile(1,"*.txt","Please Select the comment file"); path = GetIdbPath(); path = substr(path, 0, strlen(path) - 4) + "CmtBackup.txt";// Back up orginal names oldhandle = fopen(path,"w"); handle = fopen(file,"r"); off = 0; if (handle == 0 || oldhandle == 0) { Message("ReadFile or Createfile Error! \n"); } else { filelen = filelength(handle); if (filelen == 0) { Message("The input file is empty! \n"); } else { Message("Now BackUp Old Comments and Mark new Comments..........\n"); while (off < filelen) { linetext = readstr(handle); addr = substr(linetext,0,8); //get the addres addr = form("0x%s",addr); //format the addres in 0x12345678 type rCommlen = strlen(linetext); rComm = substr(linetext,9,rCommlen -1 );//get the rCommtion name off = off + rCommlen; if (strlen(rComm) == 0) { break; } Message("Comments addr is %s,and Comments is %s. \n",addr,rComm); oldname = Name(addr); //get the old names if (strlen(oldname) ==0) { Message("Error:get Comments at addr %s Failed.\n",addr); }else { writestr(oldhandle,addr + " " + oldname + "\n"); //write the old name and address into the backupfile } if (!MakeRptCmt(addr,rComm)) { Message("Change Function %s,at Address %X failed.\n",rComm,addr); } } } fclose(handle); fclose(oldhandle); Message("Conguratelations,All successed ,now Exit.......\n"); } } |
原创文章,转载请注明: 转载自 obaby@mars
本文标题: 《Import Repeatable Comments to IDA Via Script》
本文链接地址: http://h4ck.org.cn/2011/11/import-repeatable-comments-to-ida-via-script/
一条评论
看好你哦,博主