Skip to content

Instantly share code, notes, and snippets.

@hax0kartik
Last active July 22, 2025 23:24
Show Gist options
  • Save hax0kartik/e358ce447a4537bcef534aa8de84817c to your computer and use it in GitHub Desktop.
Save hax0kartik/e358ce447a4537bcef534aa8de84817c to your computer and use it in GitHub Desktop.

Revisions

  1. hax0kartik revised this gist Mar 6, 2019. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions export_symbol.idc
    Original file line number Diff line number Diff line change
    @@ -37,16 +37,16 @@ static FuncDump(f, start)

    static main()
    {
    auto current = GetInputFile();
    current = AskFile(-1, current, "What should I write the image to?");
    if(current == 0)
    {
    return -1;
    }
    auto f = fopen(current, "wb");
    Message("FuncDump: Start\n");

    FuncDump(f,0x100000);
    fclose(f);
    //Message("FuncDump: Done\n");
    auto current = GetInputFile();
    current = AskFile(-1, current, "Where should I write the symbols to?");
    if(current == 0)
    {
    return -1;
    }
    auto f = fopen(current, "wb");
    Message("FuncDump: Start\n");

    FuncDump(f,0x100000);
    fclose(f);
    Message("FuncDump: Done\n");
    }
  2. hax0kartik created this gist Mar 6, 2019.
    52 changes: 52 additions & 0 deletions export_symbol.idc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    #include <idc.idc>

    static FuncDump(f, start)
    {
    auto ea, str, count, ref;
    auto end;
    auto teststr;

    ea = start;

    while( ea != BADADDR )
    {
    str = GetFunctionName(ea);
    if( str != 0 )
    {
    end = FindFuncEnd(ea);

    count = 0;
    ref = RfirstB(ea);
    while(ref != BADADDR)
    {
    count = count + 1;
    ref = RnextB(ea, ref);
    }

    teststr = sprintf("sub_%X", ea);
    if( teststr != str )
    {
    fprintf(f, "%s 0x%X\n", str, ea);
    }
    //Message("%s, 0x%d, 0x%x, 0x%x, 0x%x, %d\n", str, count, ea, end, end-ea, end-ea );
    }

    ea = NextFunction(ea);
    }
    }

    static main()
    {
    auto current = GetInputFile();
    current = AskFile(-1, current, "What should I write the image to?");
    if(current == 0)
    {
    return -1;
    }
    auto f = fopen(current, "wb");
    Message("FuncDump: Start\n");

    FuncDump(f,0x100000);
    fclose(f);
    //Message("FuncDump: Done\n");
    }