# 2.3 模块 (Module)

&#x20;由`Module.load()`和`Process.enumerateModules()`返回的对象。

* `name`: 字符串，模块的标准名
* `base`: `NativePointer`，基地址
* `size`: 数字，大小，单位字节
* `path`: 字符串，完整的系统路径
* `enumerateImports()`: 枚举导入模块，返回一个对象数组，其中每个对象包含以下属性:\
  \* `type`: 字符串，`function` 或 `variable`\
  \* `name`: 字符串，导入名称\
  \* `module`: 字符串，模块名\
  \* `address`: `NativePointer`，模块的绝对地址\
  \* `slot`: `NativePointer`，导入模块的内存位置\
  对于所有的导入，只有`name`属性是保证一定存在的。其他的属性会尽可能的解析，但不保证一定成功。
* `enumerateExports()`: 枚举导出模块，返回一个对象数组，其中每个对象包含以下属性:\
  \* `type`: 字符串，`function` 或 `variable`\
  \* `name`: 字符串，导出名\
  \* `address`: `NativePointer`，绝对地址
* `enumerateSymbols()`: 枚举模块中的所有符号，返回一个对象数组，其中每个对象包含以下属性:\
  \* `isGloable`: 布尔值，指明该符号是否全局可见\
  \* `type`: 字符串: `unknown`, `section`, `undefined(Mach-O)`, `absolute(Mach-O)`, `prebound-undefined(Mach-O)`, `indirect(Mach-O)`, `object(ELF)`, `function(ELF)`, `file(ELF)`, `common(ELF)`, `tls(ELF)`\
  \* `section`: 如果存在，则包含:\
  &#x20; \* `id`: 字符串，包含节索引，段名，节名\
  &#x20; \* `protection`: 保护策略，和`Process.enumerateRanges()`里类似\
  \* `name`: 字符串，符号名\
  \* `address`: `NativePointer`，绝对地址\
  \* `size`: 数字，符号的大小，单位字节
* `enumerateRanges(protection)`: 和`Process.enuerateRanges`一样，不过范围是模块
* `findExportByName(exportName)`, `getExportByName(exportName)`: 返回导出的绝对地址，其中该导出的名称和`exportName`一致。若没有该导出，find类函数会返回`null`，get类函数会抛出异常
* `Module.load(path)`: 从文件系统中加载指定模块，并返回一个模块对象。若目标对象无法加载，则会抛出异常
* `Module.ensureInitialized(name)`: 确保指定模块的初始化部分被运行了。在早期注入中非常重要，这里的早期是指进程生命周期的早期。一个典型案例是与指定模块中ObjC类进行交互时使用。
* `Module.findBaseAddress(name)`, `Module.getBaseAddress(name)`: 返回指定名称的模块的基地址。若没有找到指定模块，find类函数会返回`null`，get类函数会抛出异常
* `Module.findExportByName(moduleName|null, exportName)`, `Module.getExportByName(moduleName|null, exportName)`: 返回模块`ModuleName`中`exportName`的导出的绝对地址。若你不知道具体是哪个模块，你可以传入`null`，不过这样搜索的开销会非常大，尽量不要这么做。若没有目标模块，find类函数会返回`null`，get类函数会抛出异常<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://frida.ivory.cafe/2.-jin-cheng-xian-cheng-mo-kuai-he-nei-cun/2.3-mo-kuai-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
