Python idc.PatchByte() Examples

The following are 8 code examples of idc.PatchByte(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module idc , or try the search function .
Example #1
Source File: ida_utilities.py    From ida_kernelcache with MIT License 6 votes vote down vote up
def patch_word(ea, value, wordsize=WORD_SIZE):
    """Patch the word at the given address.

    Words are patched using PatchByte(), PatchWord(), PatchDword(), or PatchQword(), as
    appropriate.
    """
    if wordsize == 1:
        idc.PatchByte(ea, value)
    elif wordsize == 2:
        idc.PatchWord(ea, value)
    elif wordsize == 4:
        idc.PatchDword(ea, value)
    elif wordsize == 8:
        idc.PatchQword(ea, value)
    else:
        raise ValueError('Invalid argument: wordsize={}'.format(wordsize)) 
Example #2
Source File: simple_x64.py    From LKD with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def reset():
        idc.MakeUnknown(idc.MinEA(), 0x1000, 0)
        for i in range(0x1000):
            idc.PatchByte(idc.MinEA() + i, 0) 
Example #3
Source File: simple_x86.py    From LKD with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def reset():
        idc.MakeUnknown(idc.MinEA(), 0x1000, 0)
        for i in range(0x1000):
            idc.PatchByte(idc.MinEA() + i, 0) 
Example #4
Source File: 16_输入与输出.py    From IDAPython_Note with MIT License 5 votes vote down vote up
def patch(self, temp = None):
        #用object.buffer中的数据给idb打补丁
        if temp != None:
            self.buffer = temp
            for index,byte in enumerate(self.buffer):
                idc.PatchByte(self.start + index, ord(byte)) 
Example #5
Source File: 15_补丁.py    From IDAPython_Note with MIT License 5 votes vote down vote up
def xor(size, key, buff):
    for index in range(0, size):
        cur_addr = buff + index
        temp = idc.Byte(cur_addr) ^ key
        idc.PatchByte(cur_addr, temp) 
Example #6
Source File: simple_x64.py    From PythonForWindows with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def reset():
        idc.MakeUnknown(idc.MinEA(), 0x1000, 0)
        for i in range(0x1000):
            idc.PatchByte(idc.MinEA() + i, 0) 
Example #7
Source File: simple_x86.py    From PythonForWindows with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def reset():
        idc.MakeUnknown(idc.MinEA(), 0x1000, 0)
        for i in range(0x1000):
            idc.PatchByte(idc.MinEA() + i, 0) 
Example #8
Source File: dsc_fix.py    From dsc_fix with GNU General Public License v3.0 5 votes vote down vote up
def memcpy(addr, data):
    """ writes data to the virtual address in IDA's database """
    for i in xrange(0, len(data)):
        idc.PatchByte(addr + i, ord(data[i]))