Example #1
0
def main():

	if not idaapi.is_debugger_on():
		print "Please run the process first!"
		return
	
	
		
	filename = AskFile(0,'*','Choose file to load')

	if filename:
		address = AskAddr(GetRegValue('esp'), 'Memory address')
		f = loader_input_t()
		fsize = os.path.getsize(filename)
		if f.open(filename):
			buffer = f.read(fsize)
			idaapi.dbg_write_memory(address, buffer)
			refresh_debugger_memory()
			f.close()
			if AskYN(1,"Load file size in EAX? (Size: %d)" % (fsize)) == 1:
				SetRegValue(fsize, 'EAX')
Example #2
0
def DMA(dmau, dmal):

    DMA_T = (dmal >> 1) & 1

    if (DMA_T):

        MEM_ADDR = (dmau >> 5) << 5
        LC_ADDR = (dmal >> 5) << 5

        MEM_ADDR |= 0x80000000

        DMA_LEN_U = (dmau & 0x1F) << 8
        DMA_LEN_L = (dmal >> 2) & 3

        LEN = DMA_LEN_U | DMA_LEN_L

        if (LEN == 0):
            LEN = 0x80

        DMA_LD = (dmal >> 4) & 1

        print "DMA: mem = 0x%X, cache = 0x%X, len = 0x%X, LD = %d\n" % (
            MEM_ADDR, LC_ADDR, LEN, DMA_LD)

        if (DMA_LD):

            buf = idaapi.dbg_read_memory(MEM_ADDR, LEN)

            for i in range(len(buf)):
                idaapi.dbg_write_memory(LC_ADDR + i, buf[i])
        else:

            buf = idaapi.dbg_read_memory(LC_ADDR, LEN)

            for i in range(len(buf)):
                idaapi.dbg_write_memory(MEM_ADDR + i, buf[i])
Example #3
0
def test_readwrite():
    ea = cpu.Eip
    buf = idaapi.dbg_read_memory(ea, 5)
    print "read: ", [hex(ord(x)) for x in buf]
    idaapi.dbg_write_memory(ea, buf)
Example #4
0
def test_readwrite():
    ea  = cpu.Eip
    buf = idaapi.dbg_read_memory(ea, 5)
    print "read: ", [hex(ord(x)) for x in buf]
    idaapi.dbg_write_memory(ea, buf)