免费开始
复制一个带有安装步骤和完整 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 助手设置来安装插件。将以下命令添加到您的 AI 工具中,使用 Capgo 技能:
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 syncimport { IsRoot } from '@capgo/capacitor-is-root';API概述
标题为“API概述”的部分isRooted
标题为“isRooted”的部分执行默认的root/jailbreak检测检查。
这是基本root/jailbreak检测的推荐方法。 它运行了平台上最可靠的检测算法的组合。 支持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扩展了默认的检测,包括BusyBox特定的检查(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isRootedWithBusyBox();console.log(result);detectRootManagementApps
标题:detectRootManagementApps检测是否存在已知的root管理应用(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.detectRootManagementApps();console.log(result);detectPotentiallyDangerousApps
标题:detectPotentiallyDangerousApps检测常见于root设备上的潜在危险应用(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.detectPotentiallyDangerousApps();console.log(result);detectTestKeys
Section titled “检测测试密钥”仅限 Android,检测调试/测试构建标签。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.detectTestKeys();console.log(result);checkForBusyBoxBinary
Section titled “检查BusyBox二进制文件”仅限 Android,检查设备上是否存在 BusyBox 二进制文件。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkForBusyBoxBinary();console.log(result);checkForSuBinary
Section titled “检查Su二进制文件”仅限 Android,检查是否存在 su Section titled “检测是否存在Su”
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkForSuBinary();console.log(result);checkSuExists
检测设备上是否存在Copy to clipboard su 仅在 Android 上可执行的二进制文件。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkSuExists();console.log(result);checkForRWPaths
标题:检查RW路径检测世界可写的系统路径(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkForRWPaths();console.log(result);checkForDangerousProps
标题:检查危险属性检测危险的系统属性(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkForDangerousProps();console.log(result);checkForRootNative
标题:执行 RootBeer 本机检查执行 RootBeer 本机检查(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkForRootNative();console.log(result);detectRootCloakingApps
标题:检测根目录伪装应用检测出可以隐藏root(仅限Android)的应用。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.detectRootCloakingApps();console.log(result);isSelinuxFlagInEnabled
节标题“isSelinuxFlagInEnabled”检查SELinux强制执行状态(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isSelinuxFlagInEnabled();console.log(result);isExistBuildTags
节标题“isExistBuildTags”检测操作系统镜像上的测试构建标签(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isExistBuildTags();console.log(result);doesSuperuserApkExist
节标题“doesSuperuserApkExist”检测是否安装了超级用户APK(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.doesSuperuserApkExist();console.log(result);isExistSUPath
节标题“isExistSUPath”检查已知 su (仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isExistSUPath();console.log(result);checkDirPermissions
标题:检查目录权限(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkDirPermissions();console.log(result);checkExecutingCommands
检测应该保护的可写目录标题:执行命令 which su (仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkExecutingCommands();console.log(result);checkInstalledPackages
执行命令以检测 root标题:检查已安装的包裹件(仅限 Android)
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkInstalledPackages();console.log(result);checkforOverTheAirCertificates
检测 OTA 证书检测 OTA 证书(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkforOverTheAirCertificates();console.log(result);isRunningOnEmulator
检测模拟器指纹(仅限 Android)。轻量级模拟器检测(仅限 Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isRunningOnEmulator();console.log(result);simpleCheckEmulator
检测 x86 模拟器指纹(仅限 Android)。Section titled “checkforOverTheAirCertificates”
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.simpleCheckEmulator();console.log(result);simpleCheckSDKBF86
Section titled “isRunningOnEmulator”Section titled “simpleCheckEmulator”
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.simpleCheckSDKBF86();console.log(result);simpleCheckQRREFPH
简单检查QR参考手机检测QC参考手机构建(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.simpleCheckQRREFPH();console.log(result);simpleCheckBuild
简单检查构建检测构建主机异常(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.simpleCheckBuild();console.log(result);checkGenymotion
检查Genymotion检测Genymotion模拟器指纹(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkGenymotion();console.log(result);checkGeneric
检查通用检测通用模拟器指纹(仅限Android)。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkGeneric();console.log(result);checkGoogleSDK
检测Google SDKDetects Google SDK emulator fingerprints (Android only).
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.checkGoogleSDK();console.log(result);togetDeviceInfo
获取设备信息返回检测过程中收集的设备信息。
提供设备信息收集过程中收集的设备的额外上下文和元数据。有助于调试和日志目的。
import { IsRoot } from '@capgo/capacitor-is-root';
const deviceInfo = await IsRoot.togetDeviceInfo();console.log('Device info:', deviceInfo);isRootedWithEmulator
检测Google SDK(仅限Android)扩展了默认检测方法,包括模拟器逻辑(仅限Android)
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isRootedWithEmulator();console.log(result);isRootedWithBusyBoxWithEmulator
检测Google SDK(仅限Android)仅限 Android 的扩展,使用模拟器的 heuristics 检测 BusyBox。
import { IsRoot } from '@capgo/capacitor-is-root';
const result = await IsRoot.isRootedWithBusyBoxWithEmulator();console.log(result);类型参考
类型参考DetectionResult
检测结果检测结果
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上游发生变化。
继续从Getting Started
标题为“继续从Getting Started”如果您正在使用 开始使用 来规划仪表板和API操作,请将其连接到 使用@capgo/capacitor-is-root 用于本地能力的Using @capgo/capacitor-is-root API概述 用于API Overview的实现细节 介绍 为《介绍》中实现细节 API 键 为《API Keys》中实现细节, 设备 为《设备》中实现细节。