Get fileSize info.plist to prevent piracy

I am trying to put anti-piracy code into my application. The previous answer to this question (which I cannot associate due to the status of my member - sucks) can be easily contrasted, since the string "SignerIdentity" can be searched and replaced in binary using a hex editor.

Instead, checking the fileSize file of the info.plist file and comparing it with the reference value sounds more solid (since info.plist changes here and there when the application is hacked). How should I do it? I tried the following, but it writes 0.

NSBundle *bundle = [NSBundle mainBundle]; NSDictionary *mainDictionary = [bundle infoDictionary]; NSLog(@"%d", [mainDictionary fileSize]); 
+8
ios iphone plist piracy-protection nsbundle
May 24 '09 at 5:34
source share
4 answers

You could prevent noobish crackers from finding links to "SignerIdentity" in your code using ROT13 or a similar simple shading algorithm http://en.wikipedia.org/wiki/ROT13

After applying ROT13, "SignerIdentity" will become "FvtareVqragvgl".

In any case, the answer to your question (how do you get the size of the Info.plist file):

 NSBundle *bundle = [NSBundle mainBundle]; NSString* bundlePath = [bundle bundlePath]; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString* path = [NSString stringWithFormat:@"%@/Info.plist", bundlePath ]; NSDictionary *fileAttributes = [fileManager attributesOfItemAtPath:path error:NULL]; if (fileAttributes != nil) { NSNumber *fileSize; if (fileSize = [fileAttributes objectForKey:NSFileSize]) { NSLog(@"File size: %qi\n", [fileSize unsignedLongLongValue]); } } 

Also keep in mind that the size (in bytes) of the Info.plist in the Xcode project directory and the Info.plist inside the package may be different. You probably want to build the game once, and then look at the size of <your app bundle.app>/Info.plist , and then update your anti-piracy code.

+7
May 24 '09 at
source share

I never programmed for the iPhone, but could you just take the hash of this file and compare it with the link, perhaps sticking the hash value so that someone just changes the hash link to a new one?

+5
May 24 '09 at 13:52
source share

this code has many more gifts:

Info.plist string is easy to find. NSFileSize is also very suspicious ....

+2
Sep 19 '09 at 22:47
source share

As stated here Determining that iPhone is hacked Jail Programmatically , it looks like some of the last cracked applications installed via install0us do not change their info.plist, (at least info.plist does not contain a signignidentity key). How could we detect a crack in this case?

+2
Jan 11 '10 at 10:21
source share



All Articles