📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

Blogs >> serenade's Blog

Created: Wednesday, January 9 2008 05:49.11 CST Modified: Friday, January 11 2008 04:47.21 CST
Printer Friendly ...
Export All relational ASM in idapro (Just Copied)
Author: serenade # Views: 2253

#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("Please put the cursor at a function start.");
    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("Writing the function to %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");
}


Blog Comments
c1de0x Posted: Tuesday, January 22 2008 11:52.43 CST
cmon, commit it to http://openrce-snippets.googlecode.com !

c1de0x Posted: Tuesday, January 22 2008 11:53.23 CST
cmon, commit it to http://openrce-snippets.googlecode.com !



Add New Comment
Comment:









There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit