Is this iOS anti-piracy code any good? [closed]
Asked Answered
B

5

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?

Burson answered 20/2, 2012 at 22:11 Comment(6)
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.Pamphlet
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.Strutting
Here in Greece Pirated iphones are 70% of the iphones around so that technique is a really bad idea!Burson
@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.Pamphlet
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?Governess
Yeah it does nothing in the endBurson
T
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 :-)

Terhune answered 21/2, 2012 at 0:3 Comment(4)
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.Burson
i think i'll follow @drekka's suggestion!Burson
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.Leftwards
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.Terhune
C
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.

Crescin answered 20/2, 2012 at 22:21 Comment(1)
+1, agreed, better than nothing.Bias
K
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

Kisumu answered 20/2, 2012 at 22:23 Comment(4)
ok i've read that before but where can i implement that method ?on the main.m?Burson
Yeah, I think you need to add it to main.m and do your check before UIApplicationMainKisumu
did you used that code as it is and it worked fine? how did you tested it?I mean the above code!Burson
No, I have not personally used it. But, chpwn (a well known jailbreak tweak developer) recommends using it.Kisumu
F
1

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

Fao answered 20/2, 2012 at 22:20 Comment(2)
ok i want to prevent automatic crackers like craculous do you have any experience with that and the above code?Burson
Well, I'm not really into Crackulous, but AFAIK, it removes them, so it should work.Fao
F
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.

Footstep answered 18/6, 2012 at 5:36 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.