views:

59

answers:

4

Hello, So basically I'm working on an application, and one of the features is an anti-cracking feature. It checks the webpage for the UDID number of the device, and if it is there, it allows the application to run, if it's not there, it runs exit(0);. So far, this is what I have.

This is in my AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    [window addSubview:mainViewController.view];

    if ([[[UIDevice currentDevice] uniqueIdentifier] isEqualToString:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://example.com" ]]]) {
        NSLog(@"Match!");
        [window makeKeyAndVisible];
    }
    else {
        NSLog(@"No match.");
        alertView = [[UIAlertView alloc] initWithTitle:@"Access denied!" message:@"You aren't using an official version of this application." delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
        [alertView show];
        [alertView release];
    }

    return YES;
}

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 0) {
    exit(0);
    }
}

And so basically, where you see

if ([[[UIDevice currentDevice] uniqueIdentifier] isEqualToString:[NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://example.com" ]]]) {

When it runs that, it can only detect all of the text, rather than indexing it and finding that UDID number. So I can only put 1 UDID number on there, therefore making every user's application crash. I want to set it up so that I can have as many things on there as I want, and it will just index it and search for that UDID number on the page. Can anybody help me please? It's very important!

Thank you very much!

+2  A: 

Yay so if I buy your app and your server is down (stringWithContentsOfURL returns nil) your app wil think I pirated your software!

How about spending time on bug free end-user features instead of this?

St3fan
No. You don't get the point of it. If the UDID number is not listed on the site, the app terminates itself. Did you even read the code? The site is a whitelist, not a blacklist. EDIT* Nevermind, sorry. Read it to fast and thought you were saying if you cracked it. Basically, the server crashing would depend on Apple. So it would be their problem, since it's hosted on iDisk.
Daniel Ricany
I understand very well what you are doing and I think it is a totally stupid thing to implement. If iDisk is not available because of whatever reason (maintenance, local routing problem, firewall, internet issues, whatever) and a LEGIT user cannot use the app because you think he is a pirating your software then whos problem is it exactly? I think you can expect a lot of refunds and bad reviews as soon as people find out.
St3fan
A: 

As for me, it would be easier to generate an xml of UDIDs, then parse it into an array and then compare each element with paticular UDID

NR4TR
Can you explain a little more on how to do this?
Daniel Ricany
you are going to create a webpage with list of udid. I propose you to replace your webpage with xml page with a structure like <udids><udid value="udid1_value_here" /><udid value="udid2_value_here" /><udids> and then implement delegate of NSXMLParser which could parse this xml page into an array. If parsing is an issue let me know.
NR4TR
I'm sorry, could you do some sample code? I'm not familiar with this part of the SDK and it's very confusing. Thanks!
Daniel Ricany
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { if ([elementName isEqualToString:@"udid"]) { [self.udidMutableArray addObject:[attributeDict objectForKey:@"value"]]; }}
NR4TR
Sorry but self.udidMutableArray isn't working. As I said earlier, I'm not really familiar with this part of the SDK, but after some reading I understand this functionality a little more. Apparently, where self.<something> is, the <something> must be a delegate... just I have no idea what to put there. Thank you very much!
Daniel Ricany
self.udidMutableArray is a public property of your parser delegate
NR4TR
+2  A: 

I don't understand how this is supposed to be an "anti-cracking feature", unless you plan to somehow obtain the UDIDs of all the devices of a user who has legally purchased your app through iTunes. You can't get such a list. And even if you could, it might be a violation of Apple's developer agreement, especially the section on privacy and storage of information.

So in summary:

  • This solution is fundamentally and fatally flawed.
  • There are other anti-cracking techniques that will be more effective, especially those that use a softer approach... but none will be perfect.
  • As St3fan says, your technique requires a working Internet connection, which is not something you can always assume. In which case, this technique does not fail gracefully. In which case, Apple can reject your app. It will not be "[Apple's] problem" if it fails. It is your problem.

And finally, a 0% accept rate on 10 questions doesn't bode well for getting advice in the future here. You should know that sticks out like a sore thumb.

Shaggy Frog
It's targeting the Jailbreak community, and the app is only for iPhone. Can you tell me how to scan the whole webpage? Thank you.
Daniel Ricany
Irrespective of the community you're targeting, the approach is fundamentally flawed. Also: anti-cracking solution for the *jailbreak* community? Are you serious?
Shaggy Frog
No matter how hard you try, **someone** will bypass your solution. Billions of dollars are spent every year on anti-piracy measures by companies like Apple, Microsoft and Google - what makes you think you can do any better? Also, as Shaggy mentioned, the approach simply won't work. If someone who legitimately paid for your app tries to use it while out of range of WiFi or has no cellular data connection, the app is going to quit. When apps quit by themselves on the iPhone, users assume its a crash because its the same behaviour. People will think your app is crashy.
Jasarien
It is an application that automatically replies to text messages that are received. It needs to be connected to the towers anyway, and it only processes this on launch. And plus I can just do some NSUserDefaults.
Daniel Ricany
A: 

Hi.

This is useful for enterprise ad hoc applications. Did you find a solution for this Daniel?

Cheers, Ompah

Ompah