本文整理汇总了Python中idaapi.get_input_file_path方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.get_input_file_path方法的具体用法?Python idaapi.get_input_file_path怎么用?Python idaapi.get_input_file_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idaapi
的用法示例。
在下文中一共展示了idaapi.get_input_file_path方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def __init__(self):
self.broker = Broker()
self.trace_id = 0
self.traces = {}
self.configuration = configuration()
self.solvers = []
self.analyses = []
self.nb_cpus = 1
self.binsec_connected = False
self.pinsec_connected = False
self.seg_mapping = None
self.fun_mapping = None
self.update_mapping()
self.nb_instr = self.compute_nb_instr()
self.ftype = "ELF" if open(idaapi.get_input_file_path()).read(2) == ELF else "PE"
self.imports = self.compute_imports()
示例2: handler_auto_fix_idb
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def handler_auto_fix_idb(self):
form = AutoFixIDBForm()
ok = form.Execute()
if ok == 1:
vx_version = int(form.vx_version)
print("vx_version:%s" % vx_version)
firmware_path = idaapi.get_input_file_path()
firmware = open(firmware_path, 'rb').read()
target = VxTarget(firmware=firmware, vx_version=vx_version)
# target.logger.setLevel(logging.DEBUG)
target.quick_test()
if target.load_address:
print("Load Address is:%s" % target.load_address)
else:
target.find_loading_address()
if target.load_address:
print("Load Address is:%s" % target.load_address)
if not target.load_address:
return
symbol_table_start = target.symbol_table_start
symbol_table_end = target.symbol_table_end
load_address = target.load_address
self.fix_vxworks_idb(load_address, vx_version, symbol_table_start, symbol_table_end)
form.Free()
示例3: get_header_file
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def get_header_file():
"""get file header from analysing file"""
if os.path.isfile(idaapi.get_input_file_path()):
with open(idaapi.get_input_file_path(), 'rb') as f:
buf = f.read(512)
else:
buf = b'\x00'
return bytearray(buf)
示例4: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def __init__(self, cfgfile):
self.vt_cfgfile = cfgfile
self.file_path = idaapi.get_input_file_path()
self.file_name = idc.get_root_filename()
logging.getLogger(__name__).addHandler(logging.NullHandler())
if config.DEBUG:
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
format='%(message)s'
)
else:
logging.basicConfig(
stream=sys.stdout,
level=logging.INFO,
format='%(message)s'
)
logging.info(
'\n** VT Plugin for IDA Pro v%s (c) Google, 2020',
VT_IDA_PLUGIN_VERSION
)
logging.info('** VirusTotal integration plugin for Hex-Ray\'s IDA Pro 7')
logging.info('\n** Select an area in the Disassembly Window and right')
logging.info('** click to search on VirusTotal. You can also select a')
logging.info('** string in the Strings Window.\n')
示例5: decode_angr
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def decode_angr():
"""Attempts to locate all the IOCTLs in a function and decode them all using symbolic execution"""
path = idaapi.get_input_file_path()
addr = idc.ScreenEA()
ioctls = angr_analysis.angr_find_ioctls(path, addr)
track_ioctls(ioctls)
示例6: input_file
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def input_file(self):
path = idaapi.get_input_file_path()
f = open(path, "rb")
if self.remote:
return RemoteFile(f, path)
return f
示例7: dbg_process_exit
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def dbg_process_exit(self, pid, tid, ea, exit_code):
"""
TODO: debugging, should be implemented fully.
@return:
"""
try:
if self.is_dbg_profile:
self.profile_stop()
except Exception as ex:
self.logger.error("Failed to stop profiling: %s", ex)
try:
self.end_time = time.time()
self.bp_handler.unsetBPs()
die_db = DIE.Lib.DIEDb.get_db()
die_db.add_run_info(self.callStack,
self.start_time,
self.end_time,
idaapi.get_input_file_path(),
idautils.GetInputFileMD5())
self.bp_handler.save_exceptions(die_db)
except Exception as ex:
self.logger.exception("Failed while finalizing DIE run: %s", ex)
示例8: get_default_db_filename
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def get_default_db_filename(self):
"""
Get the default DIE DB filename
"""
filename, extension = os.path.splitext(idaapi.get_input_file_path())
return filename + ".ddb"
示例9: apply_patches
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def apply_patches(output_path=None):
to_patch = idaapi.get_input_file_path()
if output_path:
shutil.copyfile(to_patch, output_path)
to_patch = output_path
patches = get_patched_bytes()
with open(to_patch, "r+b") as output:
for patch in patches.values():
output.seek(patch.fpos)
patched_byte = bytes([patch.patched])
output.write(patched_byte)
示例10: database_inited
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import get_input_file_path [as 别名]
def database_inited(self, is_new_db, idc_script):
# A file was loaded, reset vars
self.plugin.filename = idaapi.get_input_file_path()
self.plugin.cfg = None
self.plugin.angr_proj = None
self.plugin.global_vars = None
self.plugin.opaque_predicates = dict()
self.plugin.extra_constraints = dict()
self.plugin.symbolic_vars = dict()
# Check if it (still) exists
if not isfile(self.plugin.filename):
print("### Drop error: original input file no longer exists, unable to load it into angr. ###")
return
# Load the file into angr
try:
# This is a bit inefficient, but figure out if it's PIC by loading twice
p = angr.Project(self.plugin.filename, load_options={'auto_load_libs': False})
if p.loader.main_bin.pic:
# Load with IDA's imagebase as base_addr
base_addr = idaapi.get_imagebase()
else:
# Load with 0 as base_addr
base_addr = 0
del p
self.plugin.angr_proj = angr.Project(self.plugin.filename,
load_options={'auto_load_libs': False, 'main_opts': {
'custom_base_addr': base_addr}})
# get and store the file bitness
# Don't use idaapi.get_inf_structure().is_32bit(), it will give True for MIPS64...
self.plugin.bitness = self.plugin.angr_proj.arch.bits
# Save the list of all recognized variables in .bss, .data and .rodata (TODO: why these? any others?)
# TODO: Other segments as well?
self.plugin.global_vars = [var for s in sark.segments() for var in get_segment_names(s) if s.name in [".bss", ".data", ".rodata"]]
print("### Loaded file into angr succesfully! ###")
except:
import traceback
print("ERROR: Failed to load file into angr: {}".format(traceback.format_exc()))