首页
社区
课程
招聘
[求助]ida问题
2007-6-12 11:01 5558

[求助]ida问题

2007-6-12 11:01
5558
我想使用汇编代码里面的一个函数称为mainfuc,mianfuc里面还有N个字函数
ida可以复制mainfuc函数代码的时候把所有字函数的代码一起复制出来吗?

[CTF入门培训]顶尖高校博士及硕士团队亲授《30小时教你玩转CTF》,视频+靶场+题目!助力进入CTF世界

收藏
点赞0
打赏
分享
最新回复 (2)
雪    币: 2504
活跃值: (995)
能力值: (RANK:990 )
在线值:
发帖
回帖
粉丝
CCDebuger 24 2007-6-12 12:03
2
0
以前哪位转过一个IDC文件(loamms?不太记得了),当时保存了一下。附件不传了,自己看源码吧:

#include "idc.idc"

static ElementExist(arrayid,size,val)
{
auto i,v;
for(i=0;i<size;i++)
{
v=GetArrayElement(AR_LONG,arrayid,i);
if(v==val)
return 1;
}
return 0;
}
static GenFuncIns(st,arrayid,size)
{
auto start,end,i,ins,x,xt,funcend;
start=st;
end=FindFuncEnd(start);
for(i=start;i<end;)
{
ins=GetDisasm(i);
for(x=Rfirst(i);x!=BADADDR;x=Rnext(i,x))
{
xt=XrefType();
if(xt == fl_CN && !ElementExist(arrayid,size,x))
{
SetArrayLong(arrayid,size,x);
size++;
}
}
i=ItemEnd(i);/*FindCode(i,1);*/
//Message(form("%s\r\n",ins));
}
return size;
}
static main()
{
auto arrayid,size,pos,st,file,funcend,path;
st=ScreenEA();
path = GetIdbPath();
path = substr(path, 0, strlen(path) - 4) + "Part.asm";
file=fopen(path,"w+");
if(st==BADADDR)
{
Warning("You should choose a start place!");
return;
}
arrayid=CreateArray("gen_func_ins");
if(arrayid<0)
{
arrayid=GetArrayId("gen_func_ins");
}
pos=0;
SetArrayLong(arrayid,pos,st);
size=1;
for(pos=0;pos<size;pos++)
{
st=GetArrayElement(AR_LONG,arrayid,pos);
Message(form("proc:%8.8x\r\n",st));
funcend=FindFuncEnd(st);
if (funcend!=BADADDR)
{
Message("writting asm code... %s \n",path);
GenerateFile(OFILE_ASM,file, st,funcend, 0);
}
else
{
Message(form("proc:%8.8x Write false\r\n",st));
}
size=GenFuncIns(st,arrayid,size);
}
DeleteArray(arrayid);
fclose(file);
Message("All done, exiting...\n");
}
雪    币: 227
活跃值: (370)
能力值: ( LV9,RANK:530 )
在线值:
发帖
回帖
粉丝
lnn1123 13 2007-6-12 13:17
3
0
好,谢谢啊,我研究看看
游客
登录 | 注册 方可回帖
返回