本文整理汇总了Python中idaapi.add_segm方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.add_segm方法的具体用法?Python idaapi.add_segm怎么用?Python idaapi.add_segm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idaapi
的用法示例。
在下文中一共展示了idaapi.add_segm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: myAddSeg
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import add_segm [as 别名]
def myAddSeg(startea, endea, base, use32, name, clas):
s = idaapi.segment_t()
s.start_ea = startea
s.end_ea = endea
s.sel = idaapi.setup_selector(base)
s.bitness = use32
s.align = idaapi.saRelPara
s.comb = idaapi.scPub
#idaapi.add_segm_ex(s, name, clas, idaapi.ADDSEG_NOSREG|idaapi.ADDSEG_OR_DIE)
idaapi.add_segm(base, startea, endea, name, clas)
示例2: load_file
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import add_segm [as 别名]
def load_file(f, neflags, format):
f.seek(0)
magic = f.read(4);
version = struct.unpack("<I", f.read(4))[0];
flags = struct.unpack("<I", f.read(4))[0];
memType = struct.unpack("<I", f.read(4))[0];
serviceType = struct.unpack("<I", f.read(4))[0];
numInstances = struct.unpack("<I", f.read(4))[0];
uuid = struct.unpack("<IIII", f.read(16));
driverId = struct.unpack("<I", f.read(4))[0];
numThreads = struct.unpack("<I", f.read(4))[0];
textVA = struct.unpack("<I", f.read(4))[0];
textLen = struct.unpack("<I", f.read(4))[0];
dataVA = struct.unpack("<I", f.read(4))[0];
dataLen = struct.unpack("<I", f.read(4))[0];
bssLen = struct.unpack("<I", f.read(4))[0];
entry = struct.unpack("<I", f.read(4))[0];
f.seek(MCLF_TEXT_INFO_OFFSET)
idaapi.set_processor_type("arm", ida_idp.SETPROC_LOADER)
# Set VA for .text and add the segment
f.file2base(0, textVA, textVA + textLen, True)
idaapi.add_segm(0, textVA, textVA + textLen, ".text", "CODE")
# Set VA for .data and add the segment
f.file2base(textLen, dataVA, dataVA + dataLen, True)
idaapi.add_segm(0, dataVA, dataVA + dataLen, ".data", "DATA")
# Add BSS segment after .text and .data
idaapi.add_segm(0, dataVA + dataLen, dataVA + dataLen + bssLen, ".bss", "BSS")
if entry % 4 == 1:
#Thumb address is always +1 to set the T bit
idaapi.add_entry(entry-1, entry-1, "_entry", 1)
split_sreg_range(entry-1, "T", 0x1, ida_segregs.SR_user)
else:
idaapi.add_entry(entry, entry, "_entry", 1)
split_sreg_range(entry, "T", 0x0, ida_segregs.SR_user)
ida_bytes.create_data(tlApiLibEntry, FF_DWORD, 4, ida_idaapi.BADADDR)
set_name(tlApiLibEntry,"tlApiLibEntry", SN_CHECK)
return 1
示例3: load_file
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import add_segm [as 别名]
def load_file(f, neflags, format):
f.seek(0)
magic = f.read(4);
version = struct.unpack("<I", f.read(4))[0];
flags = struct.unpack("<I", f.read(4))[0];
memType = struct.unpack("<I", f.read(4))[0];
serviceType = struct.unpack("<I", f.read(4))[0];
numInstances = struct.unpack("<I", f.read(4))[0];
uuid = struct.unpack("<IIII", f.read(16));
driverId = struct.unpack("<I", f.read(4))[0];
numThreads = struct.unpack("<I", f.read(4))[0];
textVA = struct.unpack("<I", f.read(4))[0];
textLen = struct.unpack("<I", f.read(4))[0];
dataVA = struct.unpack("<I", f.read(4))[0];
dataLen = struct.unpack("<I", f.read(4))[0];
bssLen = struct.unpack("<I", f.read(4))[0];
entry = struct.unpack("<I", f.read(4))[0];
f.seek(MCLF_TEXT_INFO_OFFSET)
idaapi.set_processor_type("arm", SETPROC_ALL)
# Set VA for .text and add the segment
f.file2base(0, textVA, textVA + textLen, True)
idaapi.add_segm(0, textVA, textVA + textLen, ".text", "CODE")
# Set VA for .data and add the segment
f.file2base(textLen, dataVA, dataVA + dataLen, True)
idaapi.add_segm(0, dataVA, dataVA + dataLen, ".data", "DATA")
# Add BSS segment after .text and .data
idaapi.add_segm(0, dataVA + dataLen, dataVA + dataLen + bssLen, ".bss", "BSS")
if entry % 4 == 1:
#Thumb address is always +1 to set the T bit
idaapi.add_entry(entry-1, entry-1, "_entry", 1)
SetRegEx(entry-1, "T", 0x1, SR_user);
else:
idaapi.add_entry(entry, entry, "_entry", 1)
SetRegEx(entry, "T", 0x0, SR_user);
MakeDword(tlApiLibEntry)
MakeName(tlApiLibEntry,"tlApiLibEntry");
return 1