Python idc 模块,Exit() 实例源码

我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用idc.Exit()

项目:Cyber-Defence    作者:nccgroup    | 项目源码 | 文件源码
def make_enums(self):
        """ 
            Create the enumerations from the files. 
            This function will read all .txt files in a given directory
            and create an enum for each file.
        """

        dir_path = idc.AskStr("", "Enter full path to the directory of dumped PoisonIvy symbols")

        if not os.path.exists(dir_path):
            idc.Warning("Invalid path. Restart script and enter a valid path")
            idc.Exit

        for item in os.listdir(dir_path):
            filename = os.path.join(dir_path, item)

            if not os.path.isfile(filename):
                continue

            if not filename.endswith('.txt'):
                continue

            with open(filename, 'rb') as fh:
                symbols = self.fixdata(fh)
                self.createenum(symbols)
项目:bap-ida-python    作者:BinaryAnalysisPlatform    | 项目源码 | 文件源码
def request(self, service, output):
        if service not in self.services:
            raise ServiceIsNotRegistered(service)

        idc.Wait()
        with open(output, 'w') as out:
            self.services[service](out)
        idc.Exit(0)
项目:idsearch    作者:xorpd    | 项目源码 | 文件源码
def run():

    # Get the path of the idb:
    idb_path = idaapi.cvar.database_idb

    # Set up logging:
    log_file_path = gen_logfile_path(idb_path)
    fh = logging.FileHandler(log_file_path)
    loglevel = logging.INFO
    fh.setLevel(loglevel)
    logger.setLevel(loglevel)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - '
        ' %(message)s')
    fh.setFormatter(formatter)
    logger.addHandler(fh)

    logger.info('Run was called')

    try:
        logger.info('Calling index_idb')
        gen_sdb(sdb_path=None,overwrite=True)
        logger.info('Indexing completed successfully!')
    except:
        logger.exception('Unhandled exception inside run().')
    finally:
        idc.Exit(0)
项目:idsearch    作者:xorpd    | 项目源码 | 文件源码
def run():

    # Get the path of the idb:
    idb_path = idaapi.cvar.database_idb

    # Set up logging:
    log_file_path = gen_logfile_path(idb_path)
    fh = logging.FileHandler(log_file_path)
    loglevel = logging.INFO
    fh.setLevel(loglevel)
    logger.setLevel(loglevel)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - '
        ' %(message)s')
    fh.setFormatter(formatter)
    logger.addHandler(fh)

    logger.info('Run was called')

    try:
        logger.info('Calling index_idb')
        gen_sdb(sdb_path=None,overwrite=True)
        logger.info('Indexing completed successfully!')
    except:
        logger.exception('Unhandled exception inside run().')
    finally:
        idc.Exit(0)
项目:Cyber-Defence    作者:nccgroup    | 项目源码 | 文件源码
def __init__(self):
        ## dict of addresses and enum ids for faster lookup

        addr = idc.AskAddr(0, "Enter the original base address of the file")
        if addr == idaapi.BADADDR:
            idc.Warning("Invalid Address please enter the correct base address")
            idc.Exit

        idc.rebase_program(addr, idaapi.MSF_FIXONCE)
        self.enums = {}
        self.start_addr = None
        self.symbols = {}