當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。