概览
“概览”章节@capgo/capacitor-is-root 检测 越狱的 iOS 设备 以及 已 Root 的 Android 设备 在高风险流程(支付、DRM、企业数据)之前的设备。 isRooted() 是默认的跨平台检测方式。Android 会为风控团队提供更深层的 RootBeer 辅助工具。
平台支持
标题为“平台支持”的部分| 平台 | 备注 |
|---|---|
| iOS | 越狱文件及沙盒写入探测。模拟器始终报告未越狱。 |
| Android | 基于 RootBeer 并增加了额外的启发式检测。模拟器检查通过独立的 API 完成。 |
| Web 端 | 无意义 |
核心功能
标题为“核心功能”的章节isRooted- 执行默认的 root/越狱检测。isRootedWithBusyBox- 扩展了默认检测,增加了针对 BusyBox 的特定检查(仅限 Android)。detectRootManagementApps- 检测是否存在已知的 root 管理应用(仅限 Android)。detectPotentiallyDangerousApps- 检测 root 设备上常见的潜在危险应用(仅限 Android)。
公开 API
标题为“公开 API”的章节| 方法 | 描述 |
|---|---|
isRooted | 执行默认的 root/越狱检测。 |
isRootedWithBusyBox | 在默认检测的基础上增加了 BusyBox 特有的检测(仅限 Android)。 |
detectRootManagementApps | 检测是否存在已知的 Root 管理应用(仅限 Android)。 |
detectPotentiallyDangerousApps | 检测 Root 设备上常见的潜在危险应用(仅限 Android)。 |
detectTestKeys | 检测是否存在 debug/test 构建标签(仅限 Android)。 |
checkForBusyBoxBinary | 检查设备上是否存在 BusyBox 二进制文件(仅限 Android)。 |
checkForSuBinary | 检查是否存在 su 二进制文件(仅限 Android)。 |
checkSuExists | 检测该 su 二进制文件是否可执行(仅限 Android)。 |
checkForRWPaths | 检测全局可写的系统路径(仅限 Android)。 |
checkForDangerousProps | 检测危险的系统属性(仅限 Android)。 |
checkForRootNative | 执行 RootBeer 原生检查(仅限 Android)。 |
detectRootCloakingApps | 检测可隐藏 Root 的应用(仅限 Android)。 |
isSelinuxFlagInEnabled | 检查 SELinux 强制执行状态(仅限 Android)。 |
isExistBuildTags | 检测 OS 镜像上的测试 build 标签(仅限 Android)。 |
doesSuperuserApkExist | 检测是否安装了 superuser APK(仅限 Android)。 |
isExistSUPath | 检查已知的 su 二进制文件位置(仅限 Android)。 |
checkDirPermissions | 检测需要保护的可写目录(仅限 Android)。 |
checkExecutingCommands | 执行 which su style 命令以检测 Root 权限(仅限 Android)。 |
checkInstalledPackages | 检测可疑的已安装软件包(仅限 Android)。 |
checkforOverTheAirCertificates | 检测被篡改的 OTA 证书(仅限 Android)。 |
isRunningOnEmulator | 检测常见的模拟器特征(仅限 Android)。 |
simpleCheckEmulator | 执行轻量级模拟器检查(仅限 Android)。 |
simpleCheckSDKBF86 | 检测 x86 模拟器特征(仅限 Android)。 |
simpleCheckQRREFPH | 检测 QC 参考机型构建(仅限 Android)。 |
simpleCheckBuild | 检测构建主机异常(仅限 Android)。 |
checkGenymotion | 检测 Genymotion 模拟器特征(仅限 Android)。 |
checkGeneric | 检测通用模拟器特征(仅限 Android)。 |
checkGoogleSDK | 检测 Google SDK 模拟器特征(仅限 Android)。 |
togetDeviceInfo | 返回检测过程中收集的设备信息。 |
isRootedWithEmulator | 通过模拟器启发式规则扩展默认检测(仅限 Android)。 |
isRootedWithBusyBoxWithEmulator | 通过模拟器启发式规则扩展 BusyBox 检测(仅限 Android)。 |
getPluginVersion | 获取原生 Capacitor 插件版本。 |
单一事实来源
标题为“单一事实来源”的部分此参考文档同步自 src/definitions.ts 中的 capacitor-is-root.
继续探索 @capgo/capacitor-is-root
标题为“继续探索 @capgo/capacitor-is-root”的章节如果你正在使用 @capgo/capacitor-is-root 要规划原生插件工作,请将其与 使用 @capgo/capacitor-is-root 针对使用 @capgo/capacitor-is-root 时的原生能力, Capgo 插件目录 查看 Capgo 插件目录中的产品工作流, Capgo 提供的 Capacitor 插件 查看由 Capgo 提供的 Capacitor 插件中的实现细节, 添加或更新插件 关于“添加或更新插件”中的实现细节,以及 Ionic Enterprise 插件替代方案 关于“Ionic Enterprise 插件替代方案”中的产品工作流。