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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tutorials

Reply
 
LinkBack Thread Tools Display Modes
Old 12-30-2009, 03:03 PM   #26 (permalink)
indie dev
 
rocotilos's Avatar
 
Join Date: Oct 2009
Posts: 2,754
Default

Nice one Shmoopi. Havent read them all, but, looks good. You are the official anti piracy coder for iphonesdk now. LOL!
rocotilos is offline   Reply With Quote
Old 12-30-2009, 04:59 PM   #27 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by FerrariX View Post
Hi Shmoopi,

thanks for your reply,

can I place your is_encrypted{} method somewhere else like the viewDidLoad?

or it absolutely has to be in the int main{}?

if it has to be in int main{}, would it close out if your is_encrypted{} returns a no?

in other words, I'd like to display an UIAlertView that "This App has been modified" then close the app out after one minute.

How caan I pass/receive the output of is_encrypted{} to the rest of my app?

Thanks again for sharing this great information,

-FerrariX
No, your encryption check can go anywhere you like, not just the main file. It doesn't close your app if the is_encrypted{} returns no, the space after return no was purposefully left blank to allow you to put whatever code you wanted there. If you did put the encryption check in the main file, you could return a *Pirated check to NSUserDefaults where upon viewDidLoad your AppDelegate could check to see if it's pirated. No problem Thanks for asking!
Shmoopi is offline   Reply With Quote
Old 12-31-2009, 01:15 AM   #28 (permalink)
Web & Software Developer
 
Join Date: Nov 2009
Posts: 94
Default

When an App goes through the review process, Apple doesn't change anything to change the Time Stamps on the app files, therefore rendering the time checking method useless?
__________________
Ryan Walters - Web & Software Developer
View my portfolio - My iPhone Applications

Turn your ToDo's into Do's with Task Master. The most powerful easy-to-use task manager in the App Store!
RyanW is offline   Reply With Quote
Old 12-31-2009, 09:50 AM   #29 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by RyanW View Post
When an App goes through the review process, Apple doesn't change anything to change the Time Stamps on the app files, therefore rendering the time checking method useless?
No, Apple not changing the Timestamps on the app files is what we want. If they did change the App files, causing the Timestamps to change, the Timestamp method would report piracy every time the app was run, which is bad. What we want to see is if the Cracker tries to change any of the App files, causing the Timestamp of any of the files to change, and then report piracy. Hope that clears it up a bit for you.
Shmoopi is offline   Reply With Quote
Old 01-07-2010, 02:13 PM   #30 (permalink)
Registered Member
 
Join Date: May 2009
Location: Italy
Age: 23
Posts: 12
Send a message via Skype™ to i_mush
Default

Ok guys, another strange question. . .

Now that I implemented my anti-piracy protection code I was looking for a way to test it, but it seems that they only way to "crack 'n try" is to have the app on the appstore and crack it.

Is that true or I'm missing something?
i_mush is offline   Reply With Quote
Old 01-07-2010, 02:55 PM   #31 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by i_mush View Post
Ok guys, another strange question. . .

Now that I implemented my anti-piracy protection code I was looking for a way to test it, but it seems that they only way to "crack 'n try" is to have the app on the appstore and crack it.

Is that true or I'm missing something?
It doesn't necessarily have to be in the App Store per say, but it does have to be cracked to check if most of these methods work. You can add the SignerIdentity Key to the Plist to check if the SignerIdentity methods from the last tutorial work, but it would be somewhat wasted since all the new crack methods use a different method.

By the way, I just read that the new xCrack Application automatically eliminates any Ptrace checks in your source code. Has anyone heard about this yet?
Shmoopi is offline   Reply With Quote
Old 01-07-2010, 06:29 PM   #32 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 395
Default

Good stuff, Shmoopi! Thanks.
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Old 01-08-2010, 08:56 AM   #33 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 2
Default

Awesome! Thank you so much - some of our apps have more than 80% piracy rate!
__________________
Win PS3 Slim + GT5 | Check out Car Guide 2010 app
tomcupr is offline   Reply With Quote
Old 01-08-2010, 09:07 AM   #34 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 395
Default

Of relevance to the subject at hand, is this old article about copy protection on Spyro the Dragon. I encourage my fellow devs to pay particular attention to the need to distribute copy protection through the game rather than simply on load.
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Old 01-10-2010, 05:38 PM   #35 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 38
Default

Thanks for the great information Shmoopi. I am finding that the the encryption check code always returns NO - Not encrypted. This is true whether I run with the simulator or an iPhone. When running on the phone crypt_cmd->cryptid always equals 0. But I am assuming that encryption should be enabled.

Has anyone had success with the encryption check code?
iPhoneAppStudio is offline   Reply With Quote
Old 01-10-2010, 06:52 PM   #36 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by iPhoneAppStudio View Post
Thanks for the great information Shmoopi. I am finding that the the encryption check code always returns NO - Not encrypted. This is true whether I run with the simulator or an iPhone. When running on the phone crypt_cmd->cryptid always equals 0. But I am assuming that encryption should be enabled.

Has anyone had success with the encryption check code?
That's very strange, if everything is right it should never check for it during a simulator build, which is encrypted anyway, and would find it during anything else. Try running it during a release build after cleaning all targets and see if that works. If it doesn't, take your executable from the build, whether it be debug or release, open up terminal, and type "Otool -l *Drag your executable file here". When you do that, a long line of encryption code from the file will pop up, navigate to command 9 and look for the encryption status, it will be either a 1 or a 0. 1 means that the file is encrypted, 0 means the file is not encrypted. If it shows a 1 then you know their is something with code, if not then report back here and I'll check it and possibly get rid of that method, although I've never had a problem with it. Thanks for the heads up!
Shmoopi is offline   Reply With Quote
Old 01-10-2010, 10:27 PM   #37 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 38
Default

Quote:
Originally Posted by Shmoopi View Post
That's very strange, if everything is right it should never check for it during a simulator build, which is encrypted anyway, and would find it during anything else. Try running it during a release build after cleaning all targets and see if that works. If it doesn't, take your executable from the build, whether it be debug or release, open up terminal, and type "Otool -l *Drag your executable file here". When you do that, a long line of encryption code from the file will pop up, navigate to command 9 and look for the encryption status, it will be either a 1 or a 0. 1 means that the file is encrypted, 0 means the file is not encrypted. If it shows a 1 then you know their is something with code, if not then report back here and I'll check it and possibly get rid of that method, although I've never had a problem with it. Thanks for the heads up!
Thanks for the quick response. Here is the Otool -l command 9 for the release build:

Load command 9
cmd LC_ENCRYPTION_INFO
cmdsize 20
cryptoff 4096
cryptsize 622592
cryptid 0

So the file is not encrypted. The debug build was basically the same. Are only distribution builds encrypted?

btw, when I run in the simulator the program runs all the way through the is_encrypted function and then returns NO at the bottom.
iPhoneAppStudio is offline   Reply With Quote
Old 01-10-2010, 11:12 PM   #38 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 1
Question

I read all the different ways posted in this thread, and the encryption check seemed the best and safest way to go. I've implemented it and I'm in the same situation as above. However I compile my app, I get a crypt_cmd->cryptid equal 0, for all (non-simulator) targets and all configurations.
The assumption though is that binary encryption won't actually occur until Apple signs the binary.
I used the otool -l command to check binaries I previously submitted to Apple and the cryptid is 0. I use it on all apps I downloaded from the App Store, including my apps, and the cryptid is 1.
So I'm not worried about this, binary encryption will occur when Apple signs it and puts it in the store.

But, my concern is this: When the reviewer puts it on their device to test it, is the binary already signed by Apple and therefore encrypted? Cause if it isn't, then the app will think the reviewer is running a pirated copy right?
Iphone Rocks is offline   Reply With Quote
Old 01-11-2010, 09:22 AM   #39 (permalink)
Registered Member
 
Join Date: Mar 2009
Posts: 38
Default

Quote:
Originally Posted by Iphone Rocks View Post
I read all the different ways posted in this thread, and the encryption check seemed the best and safest way to go. I've implemented it and I'm in the same situation as above. However I compile my app, I get a crypt_cmd->cryptid equal 0, for all (non-simulator) targets and all configurations.
The assumption though is that binary encryption won't actually occur until Apple signs the binary.
I used the otool -l command to check binaries I previously submitted to Apple and the cryptid is 0. I use it on all apps I downloaded from the App Store, including my apps, and the cryptid is 1.
So I'm not worried about this, binary encryption will occur when Apple signs it and puts it in the store.

But, my concern is this: When the reviewer puts it on their device to test it, is the binary already signed by Apple and therefore encrypted? Cause if it isn't, then the app will think the reviewer is running a pirated copy right?
I think that you are probably correct. I am concerned about what the reviewer might see too. It seems unlikely that Apple would sign the binary before it has been reviewed.

I have an app that was recently featured on the "What's Hot" list. It only had the obscured signer identity check for piracy and was cracked almost immediately. So far piracy doesn't look outrageous but I have had other apps where the piracy was as high as 80%. I've incorporated all of the other countermeasures but I'd like to add encryption before I release the next version.

I was also considering giving Oliver's (Dr Touch) AntiPiracy a try. Honestly, I would rather spend my time developing cool stuff for my apps than trying to thwart the crackers. But of course his code is a bigger target than a home brewed solution.
iPhoneAppStudio is offline   Reply With Quote
Old 01-11-2010, 09:24 PM   #40 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by Iphone Rocks View Post
I read all the different ways posted in this thread, and the encryption check seemed the best and safest way to go. I've implemented it and I'm in the same situation as above. However I compile my app, I get a crypt_cmd->cryptid equal 0, for all (non-simulator) targets and all configurations.
The assumption though is that binary encryption won't actually occur until Apple signs the binary.
I used the otool -l command to check binaries I previously submitted to Apple and the cryptid is 0. I use it on all apps I downloaded from the App Store, including my apps, and the cryptid is 1.
So I'm not worried about this, binary encryption will occur when Apple signs it and puts it in the store.

But, my concern is this: When the reviewer puts it on their device to test it, is the binary already signed by Apple and therefore encrypted? Cause if it isn't, then the app will think the reviewer is running a pirated copy right?
I honestly don't know the answer to that question. I've implemented this check in my code and my app got into the App Store just fine. Either Apple is not thoroughly checking the apps, or they encrypt the app before running it. I'll test this out in my next update, I'll run this check on one of my free apps, and if it returns negative I'll show an alert asking if this person is a tester. What do you think?

Quote:
Originally Posted by iPhoneAppStudio View Post
I think that you are probably correct. I am concerned about what the reviewer might see too. It seems unlikely that Apple would sign the binary before it has been reviewed.

I have an app that was recently featured on the "What's Hot" list. It only had the obscured signer identity check for piracy and was cracked almost immediately. So far piracy doesn't look outrageous but I have had other apps where the piracy was as high as 80%. I've incorporated all of the other countermeasures but I'd like to add encryption before I release the next version.

I was also considering giving Oliver's (Dr Touch) AntiPiracy a try. Honestly, I would rather spend my time developing cool stuff for my apps than trying to thwart the crackers. But of course his code is a bigger target than a home brewed solution.
I agree with you, developers shouldn't have to develop Anti-Piracy code for the iPhone, we should be spending time making cool features for our apps.

I've never used Dr Touch's AntiPiracy code, but just by watching the commercial it seems that he uses the encryption method, and probably a couple more listed in this tutorial. Feel free to try it and tell us how it is though.
Shmoopi is offline   Reply With Quote
Old 01-12-2010, 08:13 AM   #41 (permalink)
Maker of Games
 
Mr Jack's Avatar
 
Join Date: Nov 2009
Location: Coventry, UK
Posts: 395
Default

Quote:
Originally Posted by Shmoopi View Post
I agree with you, developers shouldn't have to develop Anti-Piracy code for the iPhone, we should be spending time making cool features for our apps.
Pretty much any automated anti-piracy system borders on worthless because if it works in an automated fashion, the pirates can automate it's circumvention.
__________________


Visit Mr Jack Games for my blog and more about my games
Mr Jack is offline   Reply With Quote
Old 01-14-2010, 06:09 AM   #42 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 61
Default

Really thanks a lot for sharing all the anticrack things for free. I have one lame questions, what should I do when the code get known that the app has been pirated? Close the app - how? Thanks
!_UK@$ is offline   Reply With Quote
Old 01-14-2010, 05:36 PM   #43 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 72
Default

I am having strange problems with the following preprocessor commands

Code:
#if TARGET_IPHONE_SIMULATOR || defined(DEBUG) || (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))
    return;
#endif
when compiled in release mode and run on the device, I still hit the return code, and the debugger check is effectively disabled.

If I comment out the return statement
Code:
#if TARGET_IPHONE_SIMULATOR || defined(DEBUG) || (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))
//    return;
#endif
then the debugger check is executed.

Anyone else have this issue?
F.R.E.E. is offline   Reply With Quote
Old 01-14-2010, 09:26 PM   #44 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by !_UK@$ View Post
Really thanks a lot for sharing all the anticrack things for free. I have one lame questions, what should I do when the code get known that the app has been pirated? Close the app - how? Thanks
You should do anything that you want to do. If you want to close the app, go ahead and close it by using some of the closing methods listed in the bottom of this tutorial, likewise, if you want to put advertisements, popups, or anything else in there, feel free. This is your app, do whatever you want!
Ultimately though, I would think about what you would do as a cracker if the developer had implemented whatever method you use when you detect it's pirated. Would you be mad? Sad? Frustrated? Think about it from the opposite perspective.

Quote:
Originally Posted by F.R.E.E. View Post
I am having strange problems with the following preprocessor commands

Code:
#if TARGET_IPHONE_SIMULATOR || defined(DEBUG) || (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))
    return;
#endif
when compiled in release mode and run on the device, I still hit the return code, and the debugger check is effectively disabled.

If I comment out the return statement
Code:
#if TARGET_IPHONE_SIMULATOR || defined(DEBUG) || (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))
//    return;
#endif
then the debugger check is executed.

Anyone else have this issue?
Very interesting. I'm going to have to take a lot closer look at the Encryption check method that I've provided. It looks like their should be a more reliable way to implement this check. Thanks, for the comment F.R.E.E., I'll post here when it's updated.
Shmoopi is offline   Reply With Quote
Old 01-14-2010, 09:43 PM   #45 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 72
Default

It has been a vicious problem to track down.

so far it appears to be some kind of interaction between the

Code:
 (!defined(NS_BLOCK_ASSERTIONS) && !defined(NDEBUG))
part of the macro.

either NS_BLOCK_ASSERTIONS is not consistently defined or NDEBUG across the matrix of simulator/device/debug/release

I am still looking at it, but I am not sure where to find out what preprocessor commands are defined for a given configuration. Where do I locate that or how do I produce output to see the gcc command line?
F.R.E.E. is offline   Reply With Quote
Old 01-15-2010, 12:38 AM   #46 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 72
Default

So part of the problem I was having was caused by using the wrong compiler. My project was setup for gcc 4.0 somehow..

anyway, that didn't fix the problem. The basic problem is all the preprocessor macros except for TARGET_IPHONE_SIMULATOR were undefined in all build configurations. Also, TARGET_IPHONE_SIMULATOR is never undefined, so just checking #if TARGET_IPHONE_SIMULATOR has not proven to be enough. The value of the macro does change between 1 and 0

I solved the problem by adding my own preprocessor macro to the debug builds, and checking the value of TARGET_IPHONE_SIMULATOR like so.

Code:
#if (TARGET_IPHONE_SIMULATOR == 1)  || defined( _MY_DEBUG)
  return;
#endif
You can define your own preprocessor macros in the project settings section
"GCC 4.2 Preprocessor".

Anyhow,

thanks for the code samples, they have been very informative and in testing, have proven to be very effective.
F.R.E.E. is offline   Reply With Quote
Old 01-17-2010, 10:35 PM   #47 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 188
Default

Hey guys,

I've never really used any of the jailbroken installer programs before, but the vast majority of cracks are occurring automatically aren't they?

I was reading about Crackulous, and paid users that submit the cracked app which presumably goes through an automated process.

I don't think there are people manually cracking 100s or 1000s of apps every single day.

Is this not the case?
jsonli is offline   Reply With Quote
Old 01-18-2010, 01:16 AM   #48 (permalink)
Registered Member
 
Join Date: Apr 2009
Posts: 105
Default

This is just great, thanks alot for your time Shmoopi.

I had some questions regarding all your methods..
1. SOme of the newer methods you posted, can only one of them be used? Or we should practically implement most never checks.

2. Is there anyway, this cases a backlash in appstore.. (considering its working sweetly on your native development device) and since most of us will not Crack and Check to see if its working, it'll be difficult to predict how it'll behave ?? or am i just being paranoid?

Thanks again for the post.
raheel is offline   Reply With Quote
Old 01-18-2010, 10:28 AM   #49 (permalink)
Shmoopi LLC
 
Shmoopi's Avatar
 
Join Date: Jun 2009
Location: Virginia
Posts: 203
Default

Quote:
Originally Posted by jsonli View Post
Hey guys,

I've never really used any of the jailbroken installer programs before, but the vast majority of cracks are occurring automatically aren't they?

I was reading about Crackulous, and paid users that submit the cracked app which presumably goes through an automated process.

I don't think there are people manually cracking 100s or 1000s of apps every single day.

Is this not the case?
You're right, pirates do not spend all day manually cracking 100's or 1000's of apps. Most pirates are teenagers using XCrack or Crackulous who download a couple apps and crack them, there are actually very few people who take the time to manually crack them. Remember that pirating applications is not (usually) the pirates actual job, almost every pirate does it as a hobby.

Quote:
Originally Posted by raheel View Post
This is just great, thanks alot for your time Shmoopi.

I had some questions regarding all your methods..
1. SOme of the newer methods you posted, can only one of them be used? Or we should practically implement almost every check.

2. Is there anyway, this will cause a backlash in appstore.. (considering its working sweetly on your native development device) and since most of us will not Crack and Check to see if its working, it'll be difficult to predict how it'll behave ?? or am i just being paranoid?

Thanks again for the post.
1. You can implement however many checks you would want. If you want to really protect your applications, then use a lot of the methods. If you think you're safe with one method, use only one. Ultimately, it's up to you.

2. Well, you can take my word for it, or you can check it out yourself. I've taken a lot of time testing and implementing these checks, mostly to see if they'll work in the App Store, and have never had any problems. But if you're still unsure, you can make a dummy application, use some of the checks, submit it to the App Store, and then crack it to see if they'll work. While it may seem like a lot of work, it's worth the effort.

Thanks for the questions guys!
Shmoopi is offline   Reply With Quote
Old 01-18-2010, 08:52 PM   #50 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 188
Default

Quote:
Originally Posted by Shmoopi View Post
You're right, pirates do not spend all day manually cracking 100's or 1000's of apps. Most pirates are teenagers using XCrack or Crackulous who download a couple apps and crack them, there are actually very few people who take the time to manually crack them. Remember that pirating applications is not (usually) the pirates actual job, almost every pirate does it as a hobby.
Okay, just wanted to get that cleared up. I've replied to several posts in the past that have had "nothing is uncrackable / the pirate will just return false to the piracy check" which doesn't really apply to iPhone apps since no one does it manually.

We just need to defend against automated cracks - we've got it much easier in some regards than on the PC.

Questions:
- Why does the cracking program run gdb?
- For the timestamp check, I'm not familiar with the permissions structure on a jailbroken phone, but could the cracking program just run touch to change the timestamps? I'm probably right in assuming anyone writing the cracking software will think of touch as the first way around it.
- Is there some sort of cracking manual you guys are reading? I'd love to get down and dirty with the details and maybe I can contribute some checks as well.
jsonli is offline   Reply With Quote
Reply

Bookmarks

Tags
debugger, iphone, piracy, prevention, protection

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 232
11 members and 221 guests
ADY, CKAmike, Dani77, Duncan C, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:21 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0