Python idaapi.get_input_file_path() Examples
The following are 10 code examples for showing how to use idaapi.get_input_file_path(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
idaapi
, or try the search function
.
Example 1
Project: idasec Author: RobinDavid File: idasec_core.py License: GNU Lesser General Public License v2.1 | 6 votes |
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()
Example 2
Project: vxhunter Author: PAGalaxyLab File: vxhunter_ida.py License: BSD 2-Clause "Simplified" License | 6 votes |
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()
Example 3
Project: vt-ida-plugin Author: VirusTotal File: plugin_loader.py License: Apache License 2.0 | 5 votes |
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')
Example 4
Project: win_driver_plugin Author: FSecureLABS File: win_driver_plugin.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example 5
Project: IDAngr Author: andreafioraldi File: ida_debugger.py License: BSD 2-Clause "Simplified" License | 5 votes |
def input_file(self): path = idaapi.get_input_file_path() f = open(path, "rb") if self.remote: return RemoteFile(f, path) return f
Example 6
Project: DIE Author: ynvb File: DebugAPI.py License: MIT License | 5 votes |
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)
Example 7
Project: DIE Author: ynvb File: DIEDb.py License: MIT License | 5 votes |
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"
Example 8
Project: Sark Author: tmr232 File: data.py License: MIT License | 5 votes |
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)
Example 9
Project: UEFI_RETool Author: yeggor File: utils.py License: MIT License | 5 votes |
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)
Example 10
Project: DROP-IDA-plugin Author: Riscure File: drop.py License: GNU General Public License v3.0 | 5 votes |
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()))