本文整理匯總了Python中idc.set_name方法的典型用法代碼示例。如果您正苦於以下問題:Python idc.set_name方法的具體用法?Python idc.set_name怎麽用?Python idc.set_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類idc
的用法示例。
在下文中一共展示了idc.set_name方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: import_symbol
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def import_symbol(self, symbol):
"""
Adds a symbol name at the specified address.
Args:
symbol: SYMBOL XML element.
Contains symbol name and address. Optionally includes
type and mangled symbol.
"""
if self.options.Symbols.checked == False:
return
addr = self.get_address(symbol, ADDRESS)
name = self.get_attribute(symbol, NAME)
if self.has_attribute(symbol, MANGLED):
name = self.get_attribute(symbol, MANGLED)
flag = idc.SN_NOWARN
if self.has_attribute(symbol, TYPE):
typ = self.get_attribute(symbol, TYPE)
if typ == 'local':
flag |= idc.SN_LOCAL
idc.set_name(addr, name, flag)
self.update_counter(SYMBOL)
示例2: _find_est
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def _find_est(self, gvar, start, end):
RAX = 0
BS_OFFSET = 0x60
EFI_SYSTEM_TABLE = 'EFI_SYSTEM_TABLE *'
if self.arch == 'x86':
BS_OFFSET = 0x3c
ea = start
while (ea < end):
if ((idc.print_insn_mnem(ea) == 'mov')
and (idc.get_operand_value(ea, 0) == RAX)
and (idc.get_operand_value(ea, 1) == BS_OFFSET)):
if idc.SetType(gvar, EFI_SYSTEM_TABLE):
idc.set_name(gvar, 'gSt_{addr:#x}'.format(addr=gvar))
return True
ea = idc.next_head(ea)
return False
示例3: make_names
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def make_names(self):
"""make names in idb"""
EFI_GUID = 'EFI_GUID *'
EFI_GUID_ID = idc.get_struc_id('EFI_GUID')
self.get_boot_services()
self.get_protocols()
self.get_prot_names()
data = self.Protocols['all']
empty = True
for element in data:
try:
idc.SetType(element['address'], EFI_GUID)
self.apply_struct(element['address'], 16, EFI_GUID_ID)
name = '{prot_name}_{addr:#x}'.format(prot_name=element['protocol_name'], addr=element['address'])
idc.set_name(element['address'], name)
empty = False
print('[ {ea} ] {name}'.format(
ea='{addr:#010x}'.format(addr=element['address']),
name=name))
except:
continue
if empty:
print(' * list is empty')
示例4: resolve
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def resolve(self, address, nids, symbol):
# Resolve the NID...
idc.set_cmt(self.VALUE, 'NID: ' + symbol, False)
function = nids.get(symbol[:11], symbol)
#print('Function: %s | number: %s' % (function, idaapi.get_func_num(self.VALUE)))
if idaapi.get_func_num(self.VALUE) > 0:
idc.del_func(self.VALUE)
if self.VALUE > 0:
idc.add_func(self.VALUE)
idc.add_entry(self.VALUE, self.VALUE, function, True)
idc.set_name(self.VALUE, function, SN_NOCHECK | SN_NOWARN | SN_FORCE)
idc.set_cmt(address, '%s | %s' % (function, self.info()), False)
# PROGRAM START
# Open File Dialog...
示例5: import_names
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def import_names(names, sections):
"""
Import symbol names
:param names: Dict containing symbol info
:param sections: Dict containing section info
"""
for addr, name in names.items():
addr = adjust_addr(sections, int(addr))
if addr is None:
continue
name = sanitize_name(name)
if idc.get_name_ea_simple(name) == idaapi.BADADDR:
idc.set_name(addr, name)
示例6: parse_strings
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def parse_strings(self):
idc.set_name(Reader.pos, "cpool_strings")
count = Reader.get_array_count()
for i in xrange(1, count, 1):
size = Reader.read_encoded_u32()
start = Reader.pos
string = ""
for i in xrange(size):
string += chr(Reader.read_byte())
self.abc_strings.append(string)
create_strlit(start, size, idc.STRTYPE_C)
示例7: parse_metadata
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def parse_metadata(self):
start = Reader.pos
idc.set_name(Reader.pos, "cpool_metadata")
count = Reader.get_array_count()
for i in xrange(count):
name = Reader.read_encoded_u32()
item_count = Reader.get_array_count()
items = []
for j in xrange(item_count):
key = Reader.read_encoded_u32()
value = Reader.read_encoded_u32()
items.append({"key": key, "value": value})
self.abc_metadata.append({"name": name, "items": items})
create_byte(start, Reader.pos - start)
示例8: makeNameHard_ida7
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def makeNameHard_ida7(ea, name):
'''Keeps trying to name the given ea until it works, adding the optional _%d suffix'''
count = 0
ret = idc.set_name(ea, name, idc.SN_PUBLIC|idc.SN_NOWARN)
m = HARD_NAME_RE.match(name)
if m is not None:
#already a name in <name>_<count> format
name, count = m.group(1,2)
count = int(count)
if ret == 0:
while (count < 100) and (ret == 0):
newName = '%s_%d' % (name, count)
ret = idc.set_name(ea, newName, idc.SN_PUBLIC|idc.SN_NOWARN)
count += 1
########################################
示例9: renameFunction
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def renameFunction(self, ea, name):
"""Rename the function at the specified address, using the supplied name.
Args:
ea (int): effective address of the wanted function
name (str): new name for the function
"""
idc.set_name(ea, name, idc.SN_CHECK)
# Overridden base function
示例10: set_symbol_name
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def set_symbol_name(ea, name):
global _FORCED_NAMES
flags = idaapi.SN_PUBLIC | idaapi.SN_NOCHECK | idaapi.SN_NON_AUTO | idaapi.SN_NOWARN
_FORCED_NAMES[ea] = name
idc.set_name(ea, name, flags)
# Tries to get the name of a symbol.
示例11: name
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def name(self, value):
idc.set_name(self.ea, value)
示例12: process
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def process(self, nids, symbols):
if self.INFO > Relocation.R_X86_64_ORBIS_GOTPCREL_LOAD:
self.INDEX = self.INFO >> 32
self.INFO &= 0xFF
# Symbol Value + AddEnd (S + A)
if self.type() == 'R_X86_64_64':
self.INDEX += self.ADDEND
if self.type() != 'R_X86_64_DTPMOD64':
symbol = next(value for key, value in enumerate(symbols) if key + 2 == self.INDEX)[1]
# String (Offset) == Base + AddEnd (B + A)
if self.type() == 'R_X86_64_RELATIVE':
idaapi.put_qword(self.OFFSET, self.ADDEND)
idaapi.create_data(self.OFFSET, FF_QWORD, 0x8, BADNODE)
# TLS Object
elif self.type() in ['R_X86_64_DTPMOD64', 'R_X86_64_DTPOFF64']:
idc.set_name(self.OFFSET, 'tls_access_struct', SN_NOCHECK | SN_NOWARN | SN_FORCE)
# Object
else:
# Resolve the NID...
idc.set_cmt(self.OFFSET, 'NID: ' + symbol, False)
object = nids.get(symbol[:11], symbol)
# Rename the Object...
idc.set_name(self.OFFSET, object, SN_NOCHECK | SN_NOWARN | SN_FORCE)
idaapi.create_data(self.OFFSET, FF_QWORD, 0x8, BADNODE)
return self.type()
示例13: MakeName
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def MakeName(self, ea, name):
if idaapi.IDA_SDK_VERSION < 700:
return idc.MakeNameEx(ea, name, 256)
else:
return idc.set_name(ea, name, 256)
示例14: parse_integers
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def parse_integers(self):
start = Reader.pos
idc.set_name(Reader.pos, "cpool_ints")
count = Reader.get_array_count()
for i in xrange(1, count, 1):
self.abc_ints.append(Reader.read_encoded_u32())
create_byte(start, Reader.pos - start)
示例15: parse_uintegers
# 需要導入模塊: import idc [as 別名]
# 或者: from idc import set_name [as 別名]
def parse_uintegers(self):
start = Reader.pos
idc.set_name(Reader.pos, "cpool_uints")
count = Reader.get_array_count()
for i in xrange(1, count, 1):
self.abc_uints.append(Reader.read_encoded_u32())
create_byte(start, Reader.pos - start)