An open API service indexing awesome lists of open source software.

https://github.com/Cap-go/capacitor-is-root

Capacitor plugin to detect Jailbreak/Root
https://github.com/Cap-go/capacitor-is-root

capacitor plugin

Last synced: about 1 month ago
JSON representation

Capacitor plugin to detect Jailbreak/Root

Awesome Lists containing this project

README

          

# @capgo/capacitor-is-root
Capgo - Instant updates for capacitor


➡️ Get Instant updates for your App with Capgo


Missing a feature? We’ll build the plugin for you 💪


Jailbreak/Root Detection Plugin for Capacitor

## Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/is-root/

## Compatibility

| Plugin version | Capacitor compatibility | Maintained |
| -------------- | ----------------------- | ---------- |
| v8.\*.\* | v8.\*.\* | ✅ |
| v7.\*.\* | v7.\*.\* | On demand |
| v6.\*.\* | v6.\*.\* | ❌ |
| v5.\*.\* | v5.\*.\* | ❌ |

> **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

## Install

```bash
npm install @capgo/capacitor-is-root
npx cap sync
```

## API

* [`isRooted()`](#isrooted)
* [`isRootedWithBusyBox()`](#isrootedwithbusybox)
* [`detectRootManagementApps()`](#detectrootmanagementapps)
* [`detectPotentiallyDangerousApps()`](#detectpotentiallydangerousapps)
* [`detectTestKeys()`](#detecttestkeys)
* [`checkForBusyBoxBinary()`](#checkforbusyboxbinary)
* [`checkForSuBinary()`](#checkforsubinary)
* [`checkSuExists()`](#checksuexists)
* [`checkForRWPaths()`](#checkforrwpaths)
* [`checkForDangerousProps()`](#checkfordangerousprops)
* [`checkForRootNative()`](#checkforrootnative)
* [`detectRootCloakingApps()`](#detectrootcloakingapps)
* [`isSelinuxFlagInEnabled()`](#isselinuxflaginenabled)
* [`isExistBuildTags()`](#isexistbuildtags)
* [`doesSuperuserApkExist()`](#doessuperuserapkexist)
* [`isExistSUPath()`](#isexistsupath)
* [`checkDirPermissions()`](#checkdirpermissions)
* [`checkExecutingCommands()`](#checkexecutingcommands)
* [`checkInstalledPackages()`](#checkinstalledpackages)
* [`checkforOverTheAirCertificates()`](#checkforovertheaircertificates)
* [`isRunningOnEmulator()`](#isrunningonemulator)
* [`simpleCheckEmulator()`](#simplecheckemulator)
* [`simpleCheckSDKBF86()`](#simplechecksdkbf86)
* [`simpleCheckQRREFPH()`](#simplecheckqrrefph)
* [`simpleCheckBuild()`](#simplecheckbuild)
* [`checkGenymotion()`](#checkgenymotion)
* [`checkGeneric()`](#checkgeneric)
* [`checkGoogleSDK()`](#checkgooglesdk)
* [`togetDeviceInfo()`](#togetdeviceinfo)
* [`isRootedWithEmulator()`](#isrootedwithemulator)
* [`isRootedWithBusyBoxWithEmulator()`](#isrootedwithbusyboxwithemulator)
* [`getPluginVersion()`](#getpluginversion)
* [Interfaces](#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()

```typescript
isRooted() => Promise
```

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()

```typescript
isRootedWithBusyBox() => Promise
```

Extends the default detection with BusyBox specific checks (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### detectRootManagementApps()

```typescript
detectRootManagementApps() => Promise
```

Detects if known root management applications are present (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### detectPotentiallyDangerousApps()

```typescript
detectPotentiallyDangerousApps() => Promise
```

Detects potentially dangerous applications commonly found on rooted devices (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### detectTestKeys()

```typescript
detectTestKeys() => Promise
```

Detects debug/test build tags (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkForBusyBoxBinary()

```typescript
checkForBusyBoxBinary() => Promise
```

Checks whether a BusyBox binary exists on the device (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkForSuBinary()

```typescript
checkForSuBinary() => Promise
```

Checks whether a `su` binary is present (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkSuExists()

```typescript
checkSuExists() => Promise
```

Detects if the `su` binary can be executed (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkForRWPaths()

```typescript
checkForRWPaths() => Promise
```

Detects world writable system paths (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkForDangerousProps()

```typescript
checkForDangerousProps() => Promise
```

Detects dangerous system properties (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkForRootNative()

```typescript
checkForRootNative() => Promise
```

Executes RootBeer native checks (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### detectRootCloakingApps()

```typescript
detectRootCloakingApps() => Promise
```

Detects applications that can hide root (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### isSelinuxFlagInEnabled()

```typescript
isSelinuxFlagInEnabled() => Promise
```

Checks the SELinux enforcement state (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### isExistBuildTags()

```typescript
isExistBuildTags() => Promise
```

Detects test build tags on the OS image (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### doesSuperuserApkExist()

```typescript
doesSuperuserApkExist() => Promise
```

Detects if superuser APKs are installed (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### isExistSUPath()

```typescript
isExistSUPath() => Promise
```

Checks for known `su` binary locations (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkDirPermissions()

```typescript
checkDirPermissions() => Promise
```

Detects writable directories that should be protected (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkExecutingCommands()

```typescript
checkExecutingCommands() => Promise
```

Executes `which su` style commands to detect root (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkInstalledPackages()

```typescript
checkInstalledPackages() => Promise
```

Detects suspicious installed packages (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkforOverTheAirCertificates()

```typescript
checkforOverTheAirCertificates() => Promise
```

Detects tampered OTA certificates (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### isRunningOnEmulator()

```typescript
isRunningOnEmulator() => Promise
```

Detects common emulator fingerprints (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### simpleCheckEmulator()

```typescript
simpleCheckEmulator() => Promise
```

Performs a lightweight emulator check (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### simpleCheckSDKBF86()

```typescript
simpleCheckSDKBF86() => Promise
```

Detects x86 emulator fingerprints (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### simpleCheckQRREFPH()

```typescript
simpleCheckQRREFPH() => Promise
```

Detects QC reference phone builds (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### simpleCheckBuild()

```typescript
simpleCheckBuild() => Promise
```

Detects build host anomalies (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkGenymotion()

```typescript
checkGenymotion() => Promise
```

Detects Genymotion emulator fingerprints (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkGeneric()

```typescript
checkGeneric() => Promise
```

Detects generic emulator fingerprints (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### checkGoogleSDK()

```typescript
checkGoogleSDK() => Promise
```

Detects Google SDK emulator fingerprints (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### togetDeviceInfo()

```typescript
togetDeviceInfo() => Promise
```

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()

```typescript
isRootedWithEmulator() => Promise
```

Extends the default detection with emulator heuristics (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### isRootedWithBusyBoxWithEmulator()

```typescript
isRootedWithBusyBoxWithEmulator() => Promise
```

Extends the BusyBox detection with emulator heuristics (Android only).

**Returns:** Promise<DetectionResult>

--------------------

### getPluginVersion()

```typescript
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