Skip to content

Commit

Permalink
MobileFugitive start and 1st iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
unlucio committed Jul 19, 2013
0 parents commit 7b35d3d
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 0 deletions.
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
mobileFugitive
===========

## Overview

mobileFugitive is a drop-in class that dynamically detects whether the iOS device your app is running on has been jailbroken or not and if this device can install cracked apps or not.

## Install

**Clone this repo:** git clone [email protected]:unlucio/mobileFugitive.git
* Copy "mobileFugitive.m" and "mobileFugitive.h" in your project
* Add "mobileFugitive.m" to Build Phases --> Compile Sources in your project's target.

## Usage:

* Import Lib
```Objective-C
#import "mobileFugitive.h"
```

* Init an object
```Objective-C
MobileFugitive *jbDetector = [MobileFugitive alloc] init];
```

* Check for Jailbreak
```Objective-C
[jbDetector jbDetector];
```

* Init an object
```Objective-C
[jbDetector isCracked];
```

## LICENSE - "MIT License"

Copyright (c) 2013-2012 Luciano Colosio (@unlucio)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
16 changes: 16 additions & 0 deletions mobileFugitive.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// mobileFugitive.h
//
// Created by Luciano Colosio 07/19/2013
//
// Copyright (c) 2013 Luciano Colosio. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface MobileFugitive : NSObject

- (BOOL) isJailbroken;
- (BOOL) isCracked;

@end
125 changes: 125 additions & 0 deletions mobileFugitive.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
//
// mobileFugitive.m
//
// Created by Luciano Colosio 07/19/2013
//
// Copyright (c) 2013 Luciano Colosio. All rights reserved.
//

#import "mobileFugitive.h"

@interface MobileFugitive()
@property (strong, nonatomic, readonly) NSArray *cydiaPaths;
@property (strong, nonatomic, readonly) NSArray *mobileSubstratePaths;
@property (strong, nonatomic, readonly) NSArray *evasi0nPaths;
@property (strong, nonatomic, readonly) NSArray *appSyncPaths;
@property (strong, nonatomic, readonly) NSArray *missingSystemPaths;
@end

@implementation MobileFugitive
BOOL didScan = NO;
BOOL isJialbroken = NO;
BOOL isCracked = NO;

- (id)init {
self = [super init];
if (self) {
_cydiaPaths = @[@"/Applications/Cydia.app",
@"/System/Library/LaunchDaemons/com.saurik.Cydia.Startup.plist",
@"/private/etc/apt", @"/usr/libexec/cydia",
@"/private/var/tmp/cydia.log",
@"/private/var/lib/cydia",
@"/bin/bash"
];

_mobileSubstratePaths = @[@"/Library/MobileSubstrate",
@"/Library/Frameworks/CydiaSubstrate.framework/",
@"/usr/bin/cycc",
@"/usr/bin/cynject",
@"/usr/bin/include/substrate.h",
@"/usr/bin/lib/libsubstrate.0.dylib",
@"/usr/bin/lib/libsubstrate.dylib",
];

_evasi0nPaths = @[@"/usr/libexec/dirhelper",
@"/private/var/evasi0n/"
];

_appSyncPaths = @[@"/Library/MobileSubstrate/DynamicLibraries/AppSync.dylib",
@"/Library/MobileSubstrate/DynamicLibraries/AppSync.plist",
@"/user/bin/patchsync"
];

_missingSystemPaths = @[@"/System/Library/Frameworks/Foundation.framework/Foundation"];

}
return self;
}

- (BOOL)isJailbroken {
[self scanForItems];
return isJialbroken;
}

- (BOOL)isCracked {
[self scanForItems];
return isCracked;
}


- (void) scanForItems {
if (!didScan) {
[self scanCidia];
[self scanMobileSubstrate];
[self scanEvasi0n];
[self scanAppSync];
didScan = YES;
}
}

- (void) scanCidia {
[_cydiaPaths enumerateObjectsUsingBlock:^(id filePath, NSUInteger idx, BOOL *stop) {
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
isJialbroken = YES;
*stop = YES;
}
}];
}

- (void) scanMobileSubstrate {
[_mobileSubstratePaths enumerateObjectsUsingBlock:^(id filePath, NSUInteger idx, BOOL *stop) {
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
isJialbroken = YES;
*stop = YES;
}
}];
}

- (void) scanEvasi0n {
[_evasi0nPaths enumerateObjectsUsingBlock:^(id filePath, NSUInteger idx, BOOL *stop) {
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
isJialbroken = YES;
*stop = YES;
}
}];
}

- (void) scanAppSync {
[_appSyncPaths enumerateObjectsUsingBlock:^(id filePath, NSUInteger idx, BOOL *stop) {
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
isCracked = YES;
*stop = YES;
}
}];
}

- (void) lookForMissingSystemPaths {
[_missingSystemPaths enumerateObjectsUsingBlock:^(id filePath, NSUInteger idx, BOOL *stop) {
if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
isJialbroken = YES;
*stop = YES;
}
}];
}

@end

0 comments on commit 7b35d3d

Please sign in to comment.