NSFileManager cannot browse below specific directories

I am trying to write some code to check or modify (not malicious or something like that) other iOS applications installed on a user device. In particular, on the Jailbroken device. On a damaged device, I can view files outside the application sandbox, and when I look at "/ private / var / mobile / Applications /" using NSFileManager, I see a list of directories (named as hexadecimal), as expected.

Unfortunately, when I look at each directory, they all return (in addition to the running application) FALSE for isDirectory and NULL for the attributes of OfItemAtPath. I need to have access to .app inside each of these folders, but I can not see them below, and each returns incorrect information.

The following is the code I'm using:

  NSString *path = @"/private/var/mobile/Applications/";
        NSFileManager *manager = [NSFileManager defaultManager];
        NSArray *fileList = [manager contentsOfDirectoryAtPath:path error:nil]; 


            for(NSString *file in fileList) {


  NSString *fullpath = [path stringByAppendingPathComponent:file];
            NSLog(@"fullpath = %@", fullpath);

        BOOL isDir = nil;
            [manager fileExistsAtPath:fullpath isDirectory:(&isDir)];
            if(isDir) {
                NSLog(@"isDir");
                //NSArray *subfiles = [self filesBeneathDirectory:fullpath withExtension:extension];
            } else {


            NSLog(@"!isDir");
                    NSDictionary *attributes = [manager attributesOfItemAtPath:fullpath error:nil];
                    NSLog(@"attributes = %@",attributes);
            }

     }

I would appreciate help in locating files under these directories. I assumed that the iPhone will have full root access (which is a jailbreak device and that's it).

+3
source share
1 answer

From your application, you can access your sandbox. It will not be good if you access files in other directories; there are some very good reasons why Apple has restricted access.

+2

All Articles