Python idaapi 模块,get_import_module_name() 实例源码

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

项目:viv-utils    作者:williballenthin    | 项目源码 | 文件源码
def get_imports():
    '''
    enumerate the imports of the currently loaded module.

    Yields:
      Tuple[int, str, str, int]:
        - address of import table pointer
        - name of imported library
        - name of imported function
        - ordinal of import
    '''
    for i in range(idaapi.get_import_module_qty()):
        dllname = idaapi.get_import_module_name(i)
        if not dllname:
            continue

        entries = []
        def cb(ea, name, ordinal):
            entries.append((ea, name, ordinal))
            return True  # continue enumeration

        idaapi.enum_import_names(i, cb)

        for ea, name, ordinal in entries:
            yield ea, dllname, name, ordinal
项目:HexRaysPyTools    作者:igogo-x86    | 项目源码 | 文件源码
def init_imported_ea(*args):

    def imp_cb(ea, name, ord):
        imported_ea.add(ea)
        # True -> Continue enumeration
        # False -> Stop enumeration
        return True

    print "[Info] Collecting information about imports"
    imported_ea.clear()
    nimps = idaapi.get_import_module_qty()

    for i in xrange(0, nimps):
        name = idaapi.get_import_module_name(i)
        if not name:
            print "[Warning] Failed to get import module name for #%d" % i
            continue

        # print "Walking-> %s" % name
        idaapi.enum_import_names(i, imp_cb)
    print "[Info] Done..."
项目:win_driver_plugin    作者:mwrlabs    | 项目源码 | 文件源码
def driver_type():

    implist = idaapi.get_import_module_qty()

    for i in range(0, implist):
        name = idaapi.get_import_module_name(i)
        idaapi.enum_import_names(i, cb)
    for i in names:
        if name == "FltRegisterFilter":
            return "Mini-Filter"
        elif name == "WdfVersionBind":
            return "WDF"
        elif name == "StreamClassRegisterMinidriver":
            return "Stream Minidriver"
        elif name == "KsCreateFilterFactory":
            return "AVStream"
        elif name == "PcRegisterSubdevice":
            return "PortCls"
    return "WDM"
项目:idapython    作者:mr-tz    | 项目源码 | 文件源码
def get_imports(library_calls):
    """ Populate dictionaries with import information. Return imported modules. """
    import_modules = []
    import_names_callback = make_import_names_callback(library_calls)
    for i in xrange(0, idaapi.get_import_module_qty()):
        import_modules.append(idaapi.get_import_module_name(i))
        idaapi.enum_import_names(i, import_names_callback)
    return import_modules
项目:idascripts    作者:ctfhacker    | 项目源码 | 文件源码
def __iterate__():
        """Iterate through all of the imports in the database.
        Yields (ea,(module,name,ordinal)) for each iteration.
        """
        for idx in xrange(idaapi.get_import_module_qty()):
            module = idaapi.get_import_module_name(idx)
            result = []
            idaapi.enum_import_names(idx, utils.compose(utils.box,result.append,utils.fdiscard(lambda:True)))
            for ea,name,ordinal in result:
                yield (ea,(module,name,ordinal))
            continue
        return
项目:idascripts    作者:ctfhacker    | 项目源码 | 文件源码
def modules(cls):
        '''Return all of the import modules defined in the database.'''
        return [idaapi.get_import_module_name(i) for i in xrange(idaapi.get_import_module_qty())]
项目:ida-batch_decompile    作者:tintinweb    | 项目源码 | 文件源码
def get_imports():
        for i in xrange(0, idaapi.get_import_module_qty()):
            name = idaapi.get_import_module_name(i)
            if name:
                yield name
项目:idasec    作者:RobinDavid    | 项目源码 | 文件源码
def compute_imports():
        imports = {}
        current = ""

        def callback(ea, name, ordinal):
            imports[current].append((ea, name, ordinal))
            return True

        nimps = idaapi.get_import_module_qty()
        for i in xrange(0, nimps):
            current = idaapi.get_import_module_name(i)
            imports[current] = []
            idaapi.enum_import_names(i, callback)
        return imports
项目:FRAPL    作者:FriedAppleTeam    | 项目源码 | 文件源码
def handleBuildImport(self):
        nimps = get_import_module_qty()

        self.imports = []

        for i in xrange(0, nimps):
            self.currentModuleName = get_import_module_name(i)
            if not self.currentModuleName:
                continue

            enum_import_names(i, self.imports_names_cb)