示例#1
0
def FillSegmentWithNops(x):
    """
    Sets every byte in the segment that contains 'x' to a
    NOP by changing its value to 0x90 and marking it as code.
    """
    for Byte in segment.SegmentAddresses(x):
        ida.patch_byte(Byte, 0x90)
        ida.MakeCode(Byte)
示例#2
0
def FillSegmentWithNops(x):
    """
    Sets every byte in the segment that contains 'x' to a
    NOP by changing its value to 0x90 and marking it as code.
    """
    for Byte in segment.SegmentAddresses(x):
        ida.patch_byte(Byte, 0x90)
        ida.MakeCode(Byte)
示例#3
0
def CreateDynamicFunctionStub(Name,StackDelta):
    """Create a function stub for a dynamically resolved routine so that IDA can track X-refs"""
    Seg  = GetDynamicSegment()
    print "Seg: %r" % Seg
    Ea   = FindFirstNop(Seg)
    print "Ea: %r" % Ea
    Name = str(Name)
    print "Name: %r" % Name
    Bytes = [0xc2, StackDelta, 0x00]
    for i,Byte in enumerate(Bytes):
        ida.patch_byte(Ea+i, Byte)
        ida.MakeCode(Ea+i)
    ida.MakeName(Ea,Name)
    ida.MakeFunction(Ea, Ea+len(Bytes))
    return Ea
示例#4
0
def CreateDynamicFunctionStub(Name, StackDelta):
    """Create a function stub for a dynamically resolved routine so that IDA can track X-refs"""
    Seg = GetDynamicSegment()
    print "Seg: %r" % Seg
    Ea = FindFirstNop(Seg)
    print "Ea: %r" % Ea
    Name = str(Name)
    print "Name: %r" % Name
    Bytes = [0xc2, StackDelta, 0x00]
    for i, Byte in enumerate(Bytes):
        ida.patch_byte(Ea + i, Byte)
        ida.MakeCode(Ea + i)
    ida.MakeName(Ea, Name)
    ida.MakeFunction(Ea, Ea + len(Bytes))
    return Ea