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:    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
def __init__(self): = 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.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:    License: BSD 2-Clause "Simplified" License 6 votes vote down vote up
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)

            if target.load_address:
                print("Load Address is:%s" % target.load_address)
                if target.load_address:
                    print("Load Address is:%s" % target.load_address)
            if not target.load_address:
            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)
Example 3
Project: vt-ida-plugin   Author: VirusTotal   File:    License: Apache License 2.0 5 votes vote down vote up
def __init__(self, cfgfile):
    self.vt_cfgfile = cfgfile
    self.file_path = idaapi.get_input_file_path()
    self.file_name = idc.get_root_filename()


    if config.DEBUG:
        '\n** VT Plugin for IDA Pro v%s (c) Google, 2020',
    )'** VirusTotal integration plugin for Hex-Ray\'s IDA Pro 7')'\n** Select an area in the Disassembly Window and right')'** click to search on VirusTotal. You can also select a')'** string in the Strings Window.\n') 
Example 4
Project: win_driver_plugin   Author: FSecureLABS   File:    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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)
Example 5
Project: IDAngr   Author: andreafioraldi   File:    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
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:    License: MIT License 5 votes vote down vote up
def dbg_process_exit(self, pid, tid, ea, exit_code):
        TODO: debugging, should be implemented fully.
            if self.is_dbg_profile:

        except Exception as ex:
            self.logger.error("Failed to stop profiling: %s", ex)

            self.end_time = time.time()

            die_db = DIE.Lib.DIEDb.get_db()



        except Exception as ex:
            self.logger.exception("Failed while finalizing DIE run: %s", ex) 
Example 7
Project: DIE   Author: ynvb   File:    License: MIT License 5 votes vote down vote up
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:    License: MIT License 5 votes vote down vote up
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():
            patched_byte = bytes([patch.patched])
Example 9
Project: UEFI_RETool   Author: yeggor   File:    License: MIT License 5 votes vote down vote up
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 =
        buf = b'\x00'
    return bytearray(buf) 
Example 10
Project: DROP-IDA-plugin   Author: Riscure   File:    License: GNU General Public License v3.0 5 votes vote down vote up
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. ###")

        # Load the file into angr
            # 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()
                # 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 in [".bss", ".data", ".rodata"]]
            print("### Loaded file into angr succesfully! ###")
            import traceback
            print("ERROR: Failed to load file into angr: {}".format(traceback.format_exc()))