开始
复制一个包含安装步骤和该插件的完整 Markdown 指南的配置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-is-root`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/is-root/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
安装
标题为“安装”您可以使用我们的 AI 助手设置来安装插件。将 Capgo 技能添加到您的 AI 工具中,使用以下命令:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins然后使用以下提示:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-is-root` plugin in my project.如果您更喜欢手动设置,请按照以下命令安装插件并遵循以下平台特定的说明:
bun add @capgo/capacitor-is-rootbunx cap sync导入
导入import { IsRoot } from '@capgo/capacitor-is-root';API概述
API概述isRooted
isRooted执行默认的root/jailbreak检测检查。
这是基本root/jailbreak检测的推荐方法。 它在Android和iOS平台上运行最可靠的检测算法组合。 支持Android和iOS。
import { IsRoot } from '@capgo/capacitor-is-root';
const { result } = await IsRoot.isRooted();if (result) { console.log('Device is rooted/jailbroken');} else { console.log('Device is not rooted/jailbroken');}isRootedWithBusyBox
isRootedWithBusyBox仅在 Android 上扩展默认检测,使用 BusyBox 特定的检查。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithBusyBox();detectRootManagementApps
标题:检测根管理应用检测已知的根管理应用(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectRootManagementApps();detectPotentiallyDangerousApps
标题:检测潜在危险应用检测常见于根设备上的危险应用(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectPotentiallyDangerousApps();detectTestKeys
标题:检测测试密钥检测 Android 上的调试/测试构建标签。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectTestKeys();checkForBusyBoxBinary
标题:检查 BusyBox 二进制文件检查设备上是否存在 BusyBox 二进制文件 (仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForBusyBoxBinary();checkForSuBinary
标题:检查 BusyBox 二进制文件检查设备上是否存在 su 二进制文件 (仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForSuBinary();checkSuExists
标题:检查是否存在 su检测设备上 su 二进制文件是否可执行 (仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkSuExists();checkForRWPaths
标题:检测可读写路径检测设备上世界可写系统路径 (仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForRWPaths();checkForDangerousProps
标题:检查危险属性检测Android设备上的危险系统属性。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForDangerousProps();checkForRootNative
标题:执行RootBeer原生检查仅在Android设备上执行RootBeer原生检查。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkForRootNative();detectRootCloakingApps
标题:检测根目录伪装应用仅在Android设备上检测可以隐藏根目录的应用。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.detectRootCloakingApps();isSelinuxFlagInEnabled
标题:检查SELinux标志是否启用仅在Android设备上检查SELinux强制执行状态。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isSelinuxFlagInEnabled();isExistBuildTags
标题:isExistBuildTags仅在 Android 上检测 OS 镜像中的测试构建标签。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isExistBuildTags();doesSuperuserApkExist
标题:doesSuperuserApkExist仅在 Android 上检测是否安装了超级用户 APK。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.doesSuperuserApkExist();isExistSUPath
标题:isExistSUPath仅在 Android 上检查已知的 su 二进制位置。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isExistSUPath();checkDirPermissions
标题:checkDirPermissions检测 Android 设备中应该保护的可写目录。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkDirPermissions();checkExecutingCommands
标题:checkExecutingCommands执行 which su 样式命令以检测 root (仅 Android).
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkExecutingCommands();checkInstalledPackages
标题:checkInstalledPackages检测 Android 设备中可疑的安装包。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkInstalledPackages();checkforOverTheAirCertificates
标题:checkforOverTheAirCertificates检测 Android 设备中被篡改的 OTA 证书。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkforOverTheAirCertificates();isRunningOnEmulator
Section titled “isRunningOnEmulator”检测是否在模拟器上运行(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRunningOnEmulator();simpleCheckEmulator
Section titled “simpleCheckEmulator”轻量级模拟器检测(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckEmulator();simpleCheckSDKBF86
Section titled “simpleCheckSDKBF86”检测 x86 模拟器指纹(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckSDKBF86();simpleCheckQRREFPH
Section titled “simpleCheckQRREFPH”检测 QC 参考手机构建(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckQRREFPH();simpleCheckBuild
Section titled “simpleCheckBuild”检测 Android 构建主机异常
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.simpleCheckBuild();checkGenymotion
Section titled “checkGenymotion”检测 Genymotion 模拟器指纹 (仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGenymotion();checkGeneric
Section titled “checkGeneric”检测通用模拟器指纹 (仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGeneric();checkGoogleSDK
Section titled “checkGoogleSDK”检测 Google SDK 模拟器指纹 (仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.checkGoogleSDK();togetDeviceInfo
Section titled “获取设备信息”返回检测过程中收集的设备信息。
提供了设备的额外上下文和元数据,用于在根检测过程中收集的设备信息。有助于调试和日志目的。
import { IsRoot } from '@capgo/capacitor-is-root';
const deviceInfo = await IsRoot.togetDeviceInfo();console.log('Device info:', deviceInfo);isRootedWithEmulator
Section titled “使用模拟器检测是否root”仅适用于 Android,扩展了默认检测,使用模拟器的 heuristics。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithEmulator();isRootedWithBusyBoxWithEmulator
Section titled “使用 BusyBox 和模拟器检测是否root”仅适用于 Android,扩展了 BusyBox 检测,使用模拟器的 heuristics。
import { IsRoot } from '@capgo/capacitor-is-root';
await IsRoot.isRootedWithBusyBoxWithEmulator();DetectionResult
检测结果root/jailbreak 检测方法返回的结果。
export interface DetectionResult { /** * `true` when the associated heuristic detects root/jailbreak artifacts. * `false` when no root/jailbreak indicators are found. * * @since 1.0.0 */ result: boolean;}DeviceInfo
设备信息检测过程中收集的设备信息。
export interface DeviceInfo { /** * Arbitrary key/value device metadata populated by the native implementation. * Contents vary by platform and detection methods used. * * @since 1.0.0 */ [key: string]: any;}真实数据来源
真实数据来源本页面是由插件的 src/definitions.ts当公共 API 在上游发生变化时,请重新运行同步。
继续从开始
继续从开始如果您正在使用 开始 来规划仪表板和API操作,连接它 使用@capgo/capacitor-is-root for the native capability in Using @capgo/capacitor-is-root, 关于API的概述 for the implementation detail in API Overview, 关于__CAPGO_KEEP_0__的实现细节 关于__CAPGO_KEEP_0__的密钥 关于API的实现细节,并且 for the implementation detail in API Keys, and 开始 为设备的实现细节。