8

I want to use that anti piracy code for my app.

NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/_CodeSignature", bundlePath)];
if (!fileExists) {
    //Pirated
    NSLog(@"Pirated");
}
BOOL fileExists2 = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/CodeResources", bundlePath)];
if (!fileExists2) {
    //Pirated
    NSLog(@"Pirated2");
}
BOOL fileExists3 = [[NSFileManager defaultManager] fileExistsAtPath:(@"%@/ResourceRules.plist", bundlePath)];
if (!fileExists3) {
    //Pirated
    NSLog(@"Pirated3");
}

Has anyone used it before? Can it be used for some basic protection, or is it just crap? What suggestions do you have on this topic?

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
Mpampinos Holmens
  • 1,879
  • 5
  • 18
  • 34
  • 7
    Not only is it utterly trivially defeated (the attacker can change the strings), it relies on implementation details that Apple can change at any time. As a legitimate user, I would be immensely annoyed if I upgraded my OS and was treated like a pirate by your app. – Aidan Steele Feb 20 '12 at 22:20
  • 6
    Why not use the time you're spending on this to make the app even better for paying customers? You're not going to stop piracy of your app and most of the people pirating it probably won't buy it either way. – UIAdam Feb 20 '12 at 23:18
  • Here in Greece Pirated iphones are 70% of the iphones around so that technique is a really bad idea! – Mpampinos Holmens Feb 20 '12 at 23:29
  • @MpampinosHolmens: Where did you get that figure? I haven't ever heard of countries with that many _jailbroken_ phones, let alone jailbroken phones with pirated apps on them. – Aidan Steele Feb 21 '12 at 00:02
  • how does this even block pirates? I have used this code to ensure that a file existed. If the file doesn't exist...? it was stolen and removed? is that what you are saying, how did that stop a pirate? – John Riselvato Mar 08 '12 at 21:54
  • Yeah it does nothing in the end – Mpampinos Holmens Mar 08 '12 at 22:44

5 Answers5

6

My two cents is that I think you are going to spend a lot of time trying to stop something that you cannot fully stop. From what is said in some of the comments it sounds like you are concerned about piracy because there are a lot of jailbroken phones in Greece. Greece is just one part of the world and I suspect if you stop thinking locally and start thinking globally you will find that the majority of phones are not jailbroken and are running legit apps.

My suggestion would be to concentrate on those customers who will pay. Spend your time making your app so appealing that they will jump at the chance to buy it.

Second, I would suggest that you look for ways to endear the jailbreakers so that they like your app and want to give you money or buy it. There is a lot of discussion on the net about new business models and how the older piracy hating models are just not working. Hunt around and I think you will find cases where people have embraced the fact that their product is being copied and used it to their advantage. Can you pull off the same trick? If you can, then concerns about piracy will disappear and the people concerned will quite likely become an asset rather than a liability.

Just my thoughts :-)

Jack Lawrence
  • 10,664
  • 1
  • 47
  • 61
drekka
  • 20,957
  • 14
  • 79
  • 135
  • interesting thoughts, i 've read a lot of articles before posting here, but i feel bad for not doing anything to protect my code. It might be just a habit and as soon as i get used to it everything will come back to normal. – Mpampinos Holmens Feb 21 '12 at 00:21
  • i think i'll follow @drekka's suggestion! – Mpampinos Holmens Feb 21 '12 at 08:14
  • 1
    I would like to give a second opinion here, I have an productivity App in the AppStore which was cracked after a month (I don't know what took so long, no anti-piracy code involved). To my surprise, the sales went up by 80% for full 2 weeks before slowly falling back! I don't know if this holds true for any genre and App, it probably won't, but it seems like there really are users who simply want to test an app before giving away money. – JustSid Jun 18 '12 at 05:41
  • Perhaps this is an indicator that it might be worth looking into developing some sort of "light and free" version of your app, which in turns can help drive sales of the main app. – drekka Jun 19 '12 at 04:03
3

It's better than nothing. Note that it can be very easily worked around by just creating empty files with the corresponding names. And figuring out said filenames is easy, someone could just use strings on your binary.

Ecco
  • 1,323
  • 1
  • 11
  • 15
3

I've used this code in apps before, but I don't stop the pirate from using my app. I just have a message displayed to try and guilt the user into purchasing the app.

If you really want to prevent pirates from using your app you should check the encryption of your app binary. Like this: http://landonf.bikemonkey.org/2009/02/index.html

edc1591
  • 10,146
  • 6
  • 40
  • 63
1

Checkout mtiks for Mobile app anti-piracy and real-time analytics. Completely free for developers. It takes only 5 minutes to integrate the library.

Siva
  • 11
  • 1
1

It can be used if the cracker algorithm is not smart enough to add fake ResourceRules etc. files.