IDA Snippets

Started by nanomad, December 09, 2012, 03:03:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

minimimi

Added new method by me.
The subroutine which is only Get/Set memory to naming [SG]etVal_v(Memory Address)

ex:
SetVal_v80c90()
GetVal_v80c90()

1%

Maybe we can have the script name state objects/event managers/etc. In the funtions where they initialize there is usually an address of where the return ends up.

This way its not just dword_sjdflfj

minimimi

Quote from: 1% on April 21, 2013, 09:52:51 PM
Maybe we can have the script name state objects/event managers/etc. In the funtions where they initialize there is usually an address of where the return ends up.

This way its not just dword_sjdflfj

hmm, Now I confusing in Alex's method4 ,,,,  I will try to make it when I  finish it. But I can't understand what you need...
Also I want to mearge g3gg and nanomads script If I can.
Anyway, current code is multiple segment supported . Try it if you interested in it.

1%

Running on all bins now... for the ram segment it would be good if script jumped back to rom and got the name from there.. ramsub+ramoffset = sub in main rom. Naming strings might not be in the copied ram portion.

minimimi

First, I would like to say solved one importand bug in new_name() in my script.
Previous script cant named by Alex's method1.


Quote from: 1% on May 02, 2013, 09:20:23 PM
Running on all bins now... for the ram segment it would be good if script jumped back to rom and got the name from there.. ramsub+ramoffset = sub in main rom. Naming strings might not be in the copied ram portion.
Let me confirm , that is we need to copy names from ROM to RAM, right?
Because some funcs are copyed from ROM to RAM. Is this a correct understanding?

g3gg0

this snippet searches for all functions in the binary and searches for pointers to this function.
set "findall" to 0 to just find pointers to current offset.
thinking about how to make both features accessible easily. hotkeys?

warning: 'findall' runs several minutes


#include <idc.idc>

static find_dword(addr, start, end)
{
    auto addr_str = sprintf("%02X %02X %02X %02X", addr & 0xFF, (addr >> 8) & 0xFF, (addr >> 16) & 0xFF, (addr >> 24) & 0xFF);
    auto location = start;

    Message("    [i] Searching DWORD: %s\n", addr_str);

    do
    {
        location = FindBinary(location, SEARCH_DOWN | SEARCH_CASE, addr_str);
   
        if(location == BADADDR || location > end || location < start)
        {
            return;
        }
       
        if((location % 4) == 0)
        {
            Message("    [i] Found at 0x%08X\n", location);
            MakeDword(location);
            OpOff(location, -1, 0);
            location = location + 4;
        }
        else
        {
            location = location + 1;
        }
    } while(1);
}


static main()
{
    auto findall = 1;
    auto pos = ScreenEA();
    auto segment_start = GetSegmentAttr(pos, SEGATTR_START);
    auto segment_end = GetSegmentAttr(pos, SEGATTR_END);
   
    Message("-----------------\n");
   
    if(findall)
    {
        pos = segment_start;
        do
        {
            Message("    [i] Scanning in 0x%08X-0x%08X\n", segment_start, segment_end);
            find_dword(pos, segment_start, segment_end);
            pos = NextFunction(pos);
        } while(pos != BADADDR);
    }
    else
    {
        Message("    [i] Scanning in 0x%08X-0x%08X\n", segment_start, segment_end);
        find_dword(pos, segment_start, segment_end);
    }
    Message("-----------------\n");
}


Help us with datasheets - Help us with register dumps
magic lantern: 1Magic9991E1eWbGvrsx186GovYCXFbppY, server expenses: [email protected]
ONLY donate for things we have done, not for things you expect!