nativescript-jailbreak-detector
Version:
This plugin checks for root in android devices as well as for jailbreak in IOS devices
100 lines (73 loc) • 2.56 kB
Markdown
//img.shields.io/npm/v/nativescript-jailbreak-detector.svg
[ ]:https://www.npmjs.com/package/nativescript-jailbreak-detector
[ ]:http://img.shields.io/npm/dm/nativescript-jailbreak-detector.svg
[ ]:http://img.shields.io/npm/dt/nativescript-jailbreak-detector.svg?label=total%20downloads
A Nativescript plugin that makes detection of root and jailbreak hassle free.
[ ](https://github.com/scottyab/rootbeer)
[ ](https://github.com/thii/DTTJailbreakDetection)
- iOS
- Android
```bash
tns plugin add nativescript-jailbreak-detector
```
Does not need any configuration.
Does not need any configuration.
```typescript
import { JailbreakDetector } from 'nativescript-jailbreak-detector';
if (new JailbreakDetector().isRooted()) {
// Logic here
}
```
`JailbreakDetector` contains `isJailBroken()` method for IOS.
```typescript
import { JailbreakDetector } from 'nativescript-jailbreak-detector';import {isIOS} from "tns-core-modules/platform";
import {isIOS} from "tns-core-modules/platform";
if (isIOS && new JailbreakDetector().isJailBroken()) {
// Logic here
}
```
`Note: isRooted() will call isJailBroken() internally for IOS devices
so there is no need to check for platform before using isRooted() even on IOS.`
### Android
This plugin uses rootbeer package to find out is the device is rooted or not.
Hence it exposes all the other helper methods too.
```typescript
import { JailbreakDetector } from 'nativescript-jailbreak-detector';
const jailDetector = new JailbreakDetector();
// All the available methods
jailDetector.isRooted();
jailDetector.checkForBusyBoxBinary();
jailDetector.checkForDangerousProps();
jailDetector.checkForMagiskBinary();
jailDetector.checkForRootNative();
jailDetector.checkForRWPaths();
jailDetector.checkForSuBinary();
jailDetector.checkSuExists();
jailDetector.detectPotentiallyDangerousApps();
jailDetector.detectRootCloakingApps();
jailDetector.detectRootManagementApps();
jailDetector.detectTestKeys();
jailDetector.isRootedOrBusyboxInstalled();
jailDetector.isSelinuxFlagInEnabled();
```
```bash
cd src && npm run postclone
npm run demo.ios
npm run demo.android
```
[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[![TotalDownloads][total-downloads-image]][npm-url]
[ ]:https: