IDA脚本,从txt里面读数据写入IDA当中

#include <idc.idc>

static main()
{
auto fileHandle,line,currAddr,addr;
auto cn=0;
addr = 0x1090BF3F8;//写入地址
currAddr = ScreenEA();
fileHandle = fopen("/Users/sorke/Desktop/IDA/mem.txt",“r”);
line = fgetc(fileHandle); //得到一个字节
Message(“OEP = %x 起始地址: %x 内容: %x \n”,currAddr,addr,line);
while(line != -1)
{
Message(“地址: %x 内容: %x \n”,addr,line);
PatchByte(addr,line);
line = fgetc(fileHandle);
addr=addr+1;

}
fclose(fileHandle);

}

import ida_bytes

ida_bytes.patch_bytes(0x1090BF3F8, open("/Users/sorke/Desktop/IDA/mem.txt", 'rb').read())
1 Like

厉害!比我那一堆省事多了。