コード例 #1
0
        def activate(self, ctx):
            if regFu.isHighlightedEffective():
                addr = regFu.getOffset()
                simicsString = gdbProt.Evalx('SendGDBMonitor("@cgc.getMemoryValue(0x%x)");' % addr) 
                print('effective addr 0x%x value %s' % (addr, simicsString))
                value = getHex(simicsString)
            else:
                highlighted = idaapi.get_highlighted_identifier()
                addr = getHex(highlighted)
                if addr is None:
                    print('ModMemoryHandler unable to parse hex from %s' % highlighted)
                    return
                simicsString = gdbProt.Evalx('SendGDBMonitor("@cgc.getMemoryValue(0x%x)");' % addr) 
                print('addr 0x%x value %s' % (addr, simicsString))
                value = getHex(simicsString)

            # Sample form from kernwin.hpp
            s = """Modify memory
            Address: %$
            <~E~nter value:S:32:16::>
            """
            num = Form.NumericArgument('N', value=value)
            ok = idaapi.AskUsingForm(s,
                    Form.NumericArgument('$', addr).arg,
                    num.arg)
            if ok == 1:
                print("You entered: %x" % num.value)
                simicsString = gdbProt.Evalx('SendGDBMonitor("@cgc.writeWord(0x%x, 0x%x)");' % (addr, num.value)) 
                time.sleep(1)
                idc.RefreshDebuggerMemory()
コード例 #2
0
ファイル: ex_askusingform.py プロジェクト: mfhw20/idapython-1
def ida_main_legacy():
    # Here we simply show how to use the old style form format using Python

    # Sample form from kernwin.hpp
    s = """Sample dialog box


This is sample dialog box for %A
using address %$

<~E~nter value:N:32:16::>
"""

    # Use either StringArgument or NumericArgument to pass values to the function
    num = Form.NumericArgument('N', value=123)
    ok = idaapi.AskUsingForm(s,
                             Form.StringArgument("PyAskUsingForm").arg,
                             Form.NumericArgument('$', 0x401000).arg, num.arg)
    if ok == 1:
        print("You entered: %x" % num.value)
コード例 #3
0
ファイル: reHooks.py プロジェクト: wyu0hop/RESim
    def activate(self, ctx):
        if regFu.isHighlightedEffective():
            addr = regFu.getOffset()
            simicsString = gdbProt.Evalx(
                'SendGDBMonitor("@cgc.getMemoryValue(0x%x)");' % addr)
            print('effective addr 0x%x value %s' % (addr, simicsString))
            value = simicsString
        else:
            highlighted = idaapi.get_highlighted_identifier()
            addr = getHex(highlighted)
            if addr is None:
                print('ModMemoryHandler unable to parse hex from %s' %
                      highlighted)
                return
            simicsString = gdbProt.Evalx(
                'SendGDBMonitor("@cgc.getMemoryValue(0x%x)");' % addr)
            print('addr 0x%x value %s' % (addr, simicsString))
            value = simicsString

        # Sample form from kernwin.hpp
        s = """Modify memory
            Address: %$
            <~E~nter value:t40:80:50::>
            """
        ti = idaapi.textctrl_info_t(value)
        ok = idaapi.AskUsingForm(
            s,
            Form.NumericArgument('$', addr).arg,
            idaapi.pointer(idaapi.c_void_p.from_address(ti.clink_ptr)))
        '''
            string = Form.StringArgument(value)
            ok = idaapi.AskUsingForm(s,
                    Form.NumericArgument('$', addr).arg,
                    string.arg)
            '''
        if ok == 1:
            arg = "'%s'" % ti.text.strip()
            print("You entered: %s <%s>" % (ti.text, arg))
            cmd = "@cgc.writeString(0x%x, %s)" % (addr, arg)
            print cmd
            simicsString = gdbProt.Evalx('SendGDBMonitor("%s");' % (cmd))
            time.sleep(1)
            idc.RefreshDebuggerMemory()