首页
社区
课程
招聘
[旧帖] [分享]发一个ida的提取汇编的脚本 0.00雪花
发表于: 2016-4-16 17:20 2123

[旧帖] [分享]发一个ida的提取汇编的脚本 0.00雪花

2016-4-16 17:20
2123
将下面内容保存到一个文本文件,然后用idapro的装入idc文件执行它,执行前先将光标定位在要生成代码的过程上.

#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;
  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;
  st=ScreenEA();
  if(st==BADADDR)
  {
    Warning("您需要选中一个函数起始地址!");
    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));  
    size=GenFuncIns(st,arrayid,size);
    Message("\r\n");
  }
  DeleteArray(arrayid);


这是dreaman写的,原贴地址 http://bbs.pediy.com/showthread.php?t=23231

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 24363
活跃值: (4327)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
一字不改复制一遍的意义在哪里?
2016-4-16 21:26
0
雪    币: 854
活跃值: (217)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
记录,有的找不到。
2016-5-3 13:52
0
雪    币: 51
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
不错啊,学习。
2016-5-5 11:08
0
游客
登录 | 注册 方可回帖
返回
//