nativeScript-jailbreak-detector
此插件可检测安卓设备中的root权限以及iOS设备中的越狱状态
npm i --save nativescript-jailbreak-detector

NativeScript-Jailbreak-Detector

NPM version Downloads TotalDownloads

一个 NativeScript 插件,可轻松检测 root 和越狱。

贡献者

RootBeer

DTTJailbreakDetection

支持的平台

  • iOS
  • Android

安装

tns plugin add nativescript-jailbreak-detector

iOS

无需任何配置。

Android

无需任何配置。

使用方法

Typescript

import { JailbreakDetector } from 'nativescript-jailbreak-detector';
if (new JailbreakDetector().isRooted()) {
// Logic here
}

iOS

JailbreakDetector 包含用于 iOS 的 isJailBroken() 方法。

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
}

注意:isRooted() 会内部调用 isJailBroken() 以检测 iOS 设备,因此在 iOS 上使用 isRooted() 时无需检查平台。

Android

此插件使用 rootbeer 包来检测设备是否已root。因此也暴露了其他所有辅助方法。

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

演示

# install required dependencies for demo and 
cd src && npm run postclone
# iOS
npm run demo.ios
# Android
npm run demo.android