2.4.7 • Published 3 years ago

react-native-pvt-jail-monkey v2.4.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

WARNING: I don't have the devices to test anymore, so testing is done by those submitting PRs bona fide.

Jail Monkey

Can you ever really trust a phone?

Why?

Are users claiming they are crossing the globe in seconds and collecting all the Pokeballs? Some apps need to protect themselves in order to protect data integrity. JailMonkey allows you to:

  • Identify if a phone has been jail-broken or rooted for iOS/Android.
  • Detect mocked locations for phones set in "developer mode".
  • (ANDROID ONLY) Detect if the application is running on external storage such as an SD card.

Use

import JailMonkey from 'react-native-pvt-jail-monkey'

//debug - if true will skips all validations 
//checkEmulator - check for simulator and emulator 
//keyStoreSignature - [Android only] check signing signature of the install apk (SHA1 format)
let params = {debug:false,checkEmulator:false,keyStoreSignature:"5E:8F:16:206:2E:A3:CD:2C:4A:0D:54:78:76:BA:A6:F3:8C:AB:F6:25"}
//custom method with all security checking 
JailMonkey.isSafe(params).then(()=>{
  // is not rooted/jailbreak/emulator/simulator
},()=>{
  // is rooted/jailbreak/emulator/simulator)
  })


   JailMonkey.externalCheck({ 
    "magisk": true, //android only
    'isRunningOnMac': true, //ios only
    'isJb': true, //ios only
    'isInjectedWithDynamicLibrary': true, //ios only
    'isSecurityCheckPassed': true, //ios only
    'isDebugged':true, //ios only
    'isFromAppStore':true //ios only
   }).then((ok) => {
      console.log("safe device")
    }, ({ code, message }) => {
      // {"code":"error","message":"magisk"}
      console.log("error", JSON.stringify(message))
    })

keystore signature check command

use SHA1 format

keytool -list -v -keystore <keyStore>

IOS Setup

prerequisite content hide when minimize

//in appDelegate.m

#import <JailMonkey.h>

- (void)applicationWillResignActive:(UIApplication *)application{
  [JailMonkey showSecureScreen:[self window]];
}

- (void)applicationDidBecomeActive:(UIApplication *)application{
  [JailMonkey hideSecureScreen:[self window]];
}

API

MethodReturnsDescription
isJailBrokenbooleanis this device jail-broken/rooted.
canMockLocationbooleanCan this device fake its GPS location.
trustFallbooleanChecks if the device violates either isJailBroken or canMockLocation.
isDebuggedModePromise<boolean>Is the application is running in debug mode. Note that this method returns a Promise.
isSafePromise<boolean>Custom methood custom method with all security checking
secureScreenvoidCustom methood enable minimize content hiding (note: android will also disallow screenshot in this mode)
unSecureScreenvoidCustom methood disable minimize content hiding

Android Only APIs

MethodReturnsDescription
hookDetectedbooleanDetects if there is any suspicious installed applications.
isOnExternalStoragebooleanIs the application running on external storage (ie. SD Card)
AdbEnabledbooleanIs Android Debug Bridge enabled.
isDevelopmentSettingsModePromise<boolean>Whether user has enabled development settings on their device. Note that this method returns a Promise.

On iOS all of the Android only methods will return false or Promise<false> where appropriate.

:exclamation: Since emulators are usually rooted, you might want to bypass these checks during development. Unless you're keen on constant false alarms :alarm_clock:

Install

npm i jail-monkey --save
react-native link # Not required as of React Native 0.60.0
cd ios/
pod install #ios will need pod install to link

If you use rnpm, you may have trouble as rnpm does not link Android properly after 0.29.0!

Note: On Android you should include location.isFromMockProvider() from your location provider to compliment JailMonkey.canMockLocation(). Most react-native location libraries already have this check built in

Additional Info

This has been made public to help keep it up to date. As detection measures get better or out-dated, please send updates to this project so it can be the best method of detection.

Special thanks to this fantastic blog article: http://blog.geomoby.com/2015/01/25/how-to-avoid-getting-your-location-based-app-spoofed/

2.4.7

3 years ago

2.4.6

3 years ago

2.4.1

3 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.4.5

3 years ago

2.4.4

3 years ago

2.4.0

4 years ago

2.3.9

4 years ago

2.3.6

4 years ago

2.3.8

4 years ago

2.3.7

4 years ago

2.3.5

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago