@capgo/capacitor-is-root
v8.1.0
Published
Jailbreak/Root Detection Plugin for Capacitor
Maintainers
Readme
@capgo/capacitor-is-root
Jailbreak/Root Detection Plugin for Capacitor
Documentation
The most complete doc is available here: https://capgo.app/docs/plugins/is-root/
Install
npm install @capgo/capacitor-is-root
npx cap syncAPI
isRooted()isRootedWithBusyBox()detectRootManagementApps()detectPotentiallyDangerousApps()detectTestKeys()checkForBusyBoxBinary()checkForSuBinary()checkSuExists()checkForRWPaths()checkForDangerousProps()checkForRootNative()detectRootCloakingApps()isSelinuxFlagInEnabled()isExistBuildTags()doesSuperuserApkExist()isExistSUPath()checkDirPermissions()checkExecutingCommands()checkInstalledPackages()checkforOverTheAirCertificates()isRunningOnEmulator()simpleCheckEmulator()simpleCheckSDKBF86()simpleCheckQRREFPH()simpleCheckBuild()checkGenymotion()checkGeneric()checkGoogleSDK()togetDeviceInfo()isRootedWithEmulator()isRootedWithBusyBoxWithEmulator()getPluginVersion()- Interfaces
Capacitor Is Root Plugin for detecting rooted (Android) or jailbroken (iOS) devices.
This plugin provides comprehensive detection methods to identify if a device has been rooted or jailbroken, which can be important for security-sensitive applications.
Most methods are Android-only and use various heuristics to detect root access.
The basic isRooted() method works on both Android and iOS.
isRooted()
isRooted() => Promise<DetectionResult>Performs the default root/jailbreak detection checks.
This is the recommended method for basic root/jailbreak detection. It runs a combination of the most reliable detection heuristics for the platform. Works on both Android and iOS.
Returns: Promise<DetectionResult>
Since: 1.0.0
isRootedWithBusyBox()
isRootedWithBusyBox() => Promise<DetectionResult>Extends the default detection with BusyBox specific checks (Android only).
Returns: Promise<DetectionResult>
detectRootManagementApps()
detectRootManagementApps() => Promise<DetectionResult>Detects if known root management applications are present (Android only).
Returns: Promise<DetectionResult>
detectPotentiallyDangerousApps()
detectPotentiallyDangerousApps() => Promise<DetectionResult>Detects potentially dangerous applications commonly found on rooted devices (Android only).
Returns: Promise<DetectionResult>
detectTestKeys()
detectTestKeys() => Promise<DetectionResult>Detects debug/test build tags (Android only).
Returns: Promise<DetectionResult>
checkForBusyBoxBinary()
checkForBusyBoxBinary() => Promise<DetectionResult>Checks whether a BusyBox binary exists on the device (Android only).
Returns: Promise<DetectionResult>
checkForSuBinary()
checkForSuBinary() => Promise<DetectionResult>Checks whether a su binary is present (Android only).
Returns: Promise<DetectionResult>
checkSuExists()
checkSuExists() => Promise<DetectionResult>Detects if the su binary can be executed (Android only).
Returns: Promise<DetectionResult>
checkForRWPaths()
checkForRWPaths() => Promise<DetectionResult>Detects world writable system paths (Android only).
Returns: Promise<DetectionResult>
checkForDangerousProps()
checkForDangerousProps() => Promise<DetectionResult>Detects dangerous system properties (Android only).
Returns: Promise<DetectionResult>
checkForRootNative()
checkForRootNative() => Promise<DetectionResult>Executes RootBeer native checks (Android only).
Returns: Promise<DetectionResult>
detectRootCloakingApps()
detectRootCloakingApps() => Promise<DetectionResult>Detects applications that can hide root (Android only).
Returns: Promise<DetectionResult>
isSelinuxFlagInEnabled()
isSelinuxFlagInEnabled() => Promise<DetectionResult>Checks the SELinux enforcement state (Android only).
Returns: Promise<DetectionResult>
isExistBuildTags()
isExistBuildTags() => Promise<DetectionResult>Detects test build tags on the OS image (Android only).
Returns: Promise<DetectionResult>
doesSuperuserApkExist()
doesSuperuserApkExist() => Promise<DetectionResult>Detects if superuser APKs are installed (Android only).
Returns: Promise<DetectionResult>
isExistSUPath()
isExistSUPath() => Promise<DetectionResult>Checks for known su binary locations (Android only).
Returns: Promise<DetectionResult>
checkDirPermissions()
checkDirPermissions() => Promise<DetectionResult>Detects writable directories that should be protected (Android only).
Returns: Promise<DetectionResult>
checkExecutingCommands()
checkExecutingCommands() => Promise<DetectionResult>Executes which su style commands to detect root (Android only).
Returns: Promise<DetectionResult>
checkInstalledPackages()
checkInstalledPackages() => Promise<DetectionResult>Detects suspicious installed packages (Android only).
Returns: Promise<DetectionResult>
checkforOverTheAirCertificates()
checkforOverTheAirCertificates() => Promise<DetectionResult>Detects tampered OTA certificates (Android only).
Returns: Promise<DetectionResult>
isRunningOnEmulator()
isRunningOnEmulator() => Promise<DetectionResult>Detects common emulator fingerprints (Android only).
Returns: Promise<DetectionResult>
simpleCheckEmulator()
simpleCheckEmulator() => Promise<DetectionResult>Performs a lightweight emulator check (Android only).
Returns: Promise<DetectionResult>
simpleCheckSDKBF86()
simpleCheckSDKBF86() => Promise<DetectionResult>Detects x86 emulator fingerprints (Android only).
Returns: Promise<DetectionResult>
simpleCheckQRREFPH()
simpleCheckQRREFPH() => Promise<DetectionResult>Detects QC reference phone builds (Android only).
Returns: Promise<DetectionResult>
simpleCheckBuild()
simpleCheckBuild() => Promise<DetectionResult>Detects build host anomalies (Android only).
Returns: Promise<DetectionResult>
checkGenymotion()
checkGenymotion() => Promise<DetectionResult>Detects Genymotion emulator fingerprints (Android only).
Returns: Promise<DetectionResult>
checkGeneric()
checkGeneric() => Promise<DetectionResult>Detects generic emulator fingerprints (Android only).
Returns: Promise<DetectionResult>
checkGoogleSDK()
checkGoogleSDK() => Promise<DetectionResult>Detects Google SDK emulator fingerprints (Android only).
Returns: Promise<DetectionResult>
togetDeviceInfo()
togetDeviceInfo() => Promise<DeviceInfo>Returns device information collected during detection.
Provides additional context and metadata about the device that was gathered during the root detection process. Useful for debugging and logging purposes.
Returns: Promise<DeviceInfo>
Since: 1.0.0
isRootedWithEmulator()
isRootedWithEmulator() => Promise<DetectionResult>Extends the default detection with emulator heuristics (Android only).
Returns: Promise<DetectionResult>
isRootedWithBusyBoxWithEmulator()
isRootedWithBusyBoxWithEmulator() => Promise<DetectionResult>Extends the BusyBox detection with emulator heuristics (Android only).
Returns: Promise<DetectionResult>
getPluginVersion()
getPluginVersion() => Promise<{ version: string; }>Get the native Capacitor plugin version.
Returns: Promise<{ version: string; }>
Since: 1.0.0
Interfaces
DetectionResult
Result returned by root/jailbreak detection methods.
| Prop | Type | Description | Since |
| ------------ | -------------------- | --------------------------------------------------------------------------------------------------------------------------- | ----- |
| result | boolean | true when the associated heuristic detects root/jailbreak artifacts. false when no root/jailbreak indicators are found. | 1.0.0 |
DeviceInfo
Device information collected during detection.
Credits
This plugin was inspired by the work in https://github.com/WuglyakBolgoink/cordova-plugin-iroot
