当前位置: 首页>>代码示例>>Python>>正文


Python ida_bytes.create_data方法代码示例

本文整理汇总了Python中ida_bytes.create_data方法的典型用法代码示例。如果您正苦于以下问题:Python ida_bytes.create_data方法的具体用法?Python ida_bytes.create_data怎么用?Python ida_bytes.create_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ida_bytes的用法示例。


在下文中一共展示了ida_bytes.create_data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _make_array_entry

# 需要导入模块: import ida_bytes [as 别名]
# 或者: from ida_bytes import create_data [as 别名]
def _make_array_entry(ea, item_size):
  if item_size == 4:
    item_type = idc.FF_DWORD
  elif item_size == 8:
    item_type = idc.FF_QWORD
  else:
    raise ValueError("Invalid item size")

  ida_bytes.create_data(ea, item_type, item_size, ida_idaapi.BADADDR)

# Try to create an array at `ea`, that extends into something that also looks
# like an array down the line. The idea is that sometimes there are arrays,
# but prefixes of those arrays are missed by IDA (curiously, idaq will sometimes
# correctly get these, but idal64 won't). If we find an immediate that looks
# like it could point at an array entry, then we want to treat it as a
# reference. To do that, we may need to make an array.
#
# TODO(pag): For now, we will assume that items must be at least 4 or 8 bytes
#            i.e. pointer or offset sized entries.
#
# TODO(pag): Should we check that all the entries agree in terms of zero-ness?
#            i.e. if the next entry is zero, then everything up to it should be
#            zero, and if the next entry is non-zero, then everything up to it
#            should be non-zero. 
开发者ID:lifting-bits,项目名称:mcsema,代码行数:26,代码来源:refs.py

示例2: __init__

# 需要导入模块: import ida_bytes [as 别名]
# 或者: from ida_bytes import create_data [as 别名]
def __init__(self, logger, num_bits, is_elf, data_fptr_alignment=4, mixed_code_and_data=False):
        """Create the analyzer's base class instance.

        Args:
            logger (logger): logger instance
            num_bits (int): bitness of the CPU (32 bits by default)
            data_fptr_alignment (int, optional): byte alignment needed for global fptrs (4 by default)
            mixed_code_and_data (bool, optional): True iff the main code section includes RO data constants (False by default)
        """
        self.logger = logger
        self._num_bits = num_bits
        self._is_elf = is_elf
        self.data_fptr_alignment = data_fptr_alignment
        self._mixed_code_and_data = mixed_code_and_data
        if num_bits == 64:
            self._address_parse_fn = idc.get_qword
            self._address_make_fn = lambda x: ida_bytes.create_data(x, idc.FF_QWORD, 8, idc.BADADDR)
            self.address_pack_format = "Q"
        elif num_bits == 32:
            self._address_parse_fn = idc.get_wide_dword
            self._address_make_fn = lambda x: ida_bytes.create_data(x, idc.FF_DWORD, 4, idc.BADADDR)
            self.address_pack_format = "L"
        else:
            self._address_parse_fn = idc.get_wide_word
            self._address_make_fn = lambda x: ida_bytes.create_data(x, idc.FF_WORD, 2, idc.BADADDR)
            self.address_pack_format = "H"
        # fields to be linked later on
        self.func_classifier = None
        self.fptr_identifier = None
        self.str_identifier = None
        self.locals_identifier = None
        self.switch_identifier = None
        # code types
        self._active_code_types = list(self.codeTypes()) 
开发者ID:CheckPointSW,项目名称:Karta,代码行数:36,代码来源:analyzer.py

示例3: __call__

# 需要导入模块: import ida_bytes [as 别名]
# 或者: from ida_bytes import create_data [as 别名]
def __call__(self):
        ida_bytes.create_data(self.ea, self.flags, self.size, self.tid) 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:4,代码来源:events.py

示例4: MakeDWord

# 需要导入模块: import ida_bytes [as 别名]
# 或者: from ida_bytes import create_data [as 别名]
def MakeDWord(self, ea):
        if idaapi.IDA_SDK_VERSION < 700:
            return idc.MakeDword(ea)
        else:
            return ida_bytes.create_data(ea, FF_DWORD, 4, idaapi.BADADDR) 
开发者ID:danielplohmann,项目名称:apiscout,代码行数:7,代码来源:IdaProxy.py

示例5: MakeQWord

# 需要导入模块: import ida_bytes [as 别名]
# 或者: from ida_bytes import create_data [as 别名]
def MakeQWord(self, ea):
        if idaapi.IDA_SDK_VERSION < 700:
            return idc.MakeQword(ea)
        else:
            return ida_bytes.create_data(ea, FF_QWORD, 8, idaapi.BADADDR) 
开发者ID:danielplohmann,项目名称:apiscout,代码行数:7,代码来源:IdaProxy.py

示例6: load_file

# 需要导入模块: import ida_bytes [as 别名]
# 或者: from ida_bytes import create_data [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 
开发者ID:ghassani,项目名称:mclf-ida-loader,代码行数:47,代码来源:mclf_loader.py


注:本文中的ida_bytes.create_data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。