Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-12-2010, 05:02 PM   #87 (permalink)
Steake
Registered Member
 
Join Date: Jul 2009
Posts: 19
Steake is on a distinguished road
Default

Quote:
Originally Posted by iPhoneDevelopment View Post
Hi,

I have taken two of the methods from here and combined them to make it twice as hard to crack my app (I understand the argument about there always being a way around whatever protection is put in place, but it is nice to at least feel like you are helping stop your app being cracked):

Code:
-(void) crackCheck { 
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSString* path = [NSString stringWithFormat:@"%@/Info.plist", bundlePath];
NSString* path2 = [NSString stringWithFormat:@"%@/AppName", bundlePath];
NSDate* infoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:path traverseLink:YES] fileModificationDate];
NSDate* infoModifiedDate2 = [[[NSFileManager defaultManager] fileAttributesAtPath:path2 traverseLink:YES] fileModificationDate];
NSDate* pkgInfoModifiedDate = [[[NSFileManager defaultManager] fileAttributesAtPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"PkgInfo"] traverseLink:YES] fileModificationDate];

if(fabs([infoModifiedDate timeIntervalSinceReferenceDate] - [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) > 600) {	
	if (gameState == kGameStateRunning) {
		gameState = kGameStatePaused;
		if (crackedProgress.hidden) {
			crackedProgress.hidden = NO;}
		if (crackedAlert.hidden) {
			crackedAlert.hidden = NO;}
	}
}
if(fabs([infoModifiedDate2 timeIntervalSinceReferenceDate] - [pkgInfoModifiedDate timeIntervalSinceReferenceDate]) > 600) {	
	if (gameState == kGameStateRunning) {
		gameState = kGameStatePaused;
		if (crackedProgress.hidden) {
			crackedProgress.hidden = NO;}
		if (crackedAlert.hidden) {
			crackedAlert.hidden = NO;}
	}
} 
	BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/_CodeSignature", bundlePath)];
	if (!fileExists) {
		if (gameState == kGameStateRunning) {
			gameState = kGameStatePaused;
			if (crackedProgress.hidden) {
				crackedProgress.hidden = NO;}
			if (crackedAlert.hidden) {
				crackedAlert.hidden = NO;}
		}
	}
	BOOL fileExists2 = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/CodeResources", bundlePath)];
	if (!fileExists2) {
		if (gameState == kGameStateRunning) {
			gameState = kGameStatePaused;
			if (crackedProgress.hidden) {
				crackedProgress.hidden = NO;}
			if (crackedAlert.hidden) {
				crackedAlert.hidden = NO;}
		}
	}
	BOOL fileExists3 = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/ResourceRules.plist", bundlePath)];
	if (!fileExists3) {
		if (gameState == kGameStateRunning) {
			gameState = kGameStatePaused;
			if (crackedProgress.hidden) {
				crackedProgress.hidden = NO;}
			if (crackedAlert.hidden) {
				crackedAlert.hidden = NO;}
		}
	}
}
I then halt the game and show an alert and a fake progress bar saying that the device's data is being sent to Apple... that should make them delete the cracked app :P.

Just one question.. is there any way to test the protection without cracking it and putting on a jailbroken phone (not being something I want to do)?

Thanks

Cam
My app congratulates the user on actually cracking it... Because i'm cool
Steake is offline   Reply With Quote
 

» Advertisements
» Online Users: 775
16 members and 759 guests
AngryOrange, bomzie, carmeliaxw97, erdinc27, hacker073, HemiMG, iekei, ilmman, lzwasyc, mkjarred, Nuncha, reficul, Sophie100, stevenkik, thassman, tim0504
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,473
Threads: 94,040
Posts: 402,625
Top Poster: BrianSlick (7,978)
Welcome to our newest member, iram91417
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:47 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.