iOS逆向----获取手机安装的所有App列表及路径

Posted 普通网友

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS逆向----获取手机安装的所有App列表及路径相关的知识,希望对你有一定的参考价值。

其实就是ios11之前获取App列表的代码,只不过iOS11及之后的版本在非越狱手机上无法使用这个API获取了,但是越狱手机不受限制,依然可以用。

+ (void)installedApplications 
    Class lsawsc = objc_getClass("LSApplicationWorkspace");
    NSObject* workspace = [lsawsc performSelector:NSSelectorFromString(@"defaultWorkspace")];
    NSArray *apps = [workspace performSelector:NSSelectorFromString(@"allInstalledApplications")];
    Class LSApplicationProxy_class = objc_getClass("LSApplicationProxy");
    for (int i = 0; i < apps.count; i++) 
        NSObject *temp = apps[i];
        if ([temp isKindOfClass:LSApplicationProxy_class]) 
            NSString *appBundleId = [temp performSelector:NSSelectorFromString(@"applicationIdentifier")];
            NSString *appName = [temp performSelector:NSSelectorFromString(@"localizedName")];
            NSString * type = [temp performSelector:NSSelectorFromString(@"applicationType")];
            NSString * shortVersionString = [temp performSelector:NSSelectorFromString(@"shortVersionString")];
            NSString * containerURL = [[temp performSelector:NSSelectorFromString(@"containerURL")] path];
            NSString * resourcesDirectoryURL = [[temp performSelector:NSSelectorFromString(@"resourcesDirectoryURL")] path];
            NSString * bundleExecutable = [temp performSelector:NSSelectorFromString(@"bundleExecutable")];
            NSLog(@"应用类型: %@", type);
            NSLog(@"BundleId: %@", appBundleId);
            NSLog(@"Name: %@", appName);
            NSLog(@"Version: %@", shortVersionString);
            NSLog(@"沙盒路径: %@", containerURL);
            NSLog(@"App包路径: %@", resourcesDirectoryURL);
            NSLog(@"TargetName: %@", bundleExecutable);
            NSLog(@"=============================================");
        
    

获取更多的信息,主要是有个公司名和证书序列号:

+ (void)listApps 
    id space = [NSClassFromString(@"LSApplicationWorkspace") performSelector:@selector(defaultWorkspace)];
    NSArray *plugins = [space performSelector:@selector(installedPlugins)];
    NSMutableSet *list = [[NSMutableSet alloc] init];
    for (id plugin in plugins) 
        id bundle = [plugin performSelector:@selector(containingBundle)];
        if (bundle)
            [list addObject:bundle];
    
    int a = 1;
    for (id plugin in list) 
        NSLog(@"================= %d =================",a);
        a++;
        NSLog(@"bundleIdentifier =%@", [plugin performSelector:@selector(bundleIdentifier)]);//bundleID
        
        NSLog(@"applicationDSID =%@", [plugin performSelector:@selector(applicationDSID)]);
        NSLog(@"applicationIdentifier =%@", [plugin performSelector:@selector(applicationIdentifier)]);
        NSLog(@"applicationType =%@", [plugin performSelector:@selector(applicationType)]);
        NSLog(@"dynamicDiskUsage =%@", [plugin performSelector:@selector(dynamicDiskUsage)]);

        NSLog(@"itemID =%@", [plugin performSelector:@selector(itemID)]);
        NSLog(@"itemName =%@", [plugin performSelector:@selector(itemName)]);
        NSLog(@"minimumSystemVersion =%@", [plugin performSelector:@selector(minimumSystemVersion)]);
        
        NSLog(@"requiredDeviceCapabilities =%@", [plugin performSelector:@selector(requiredDeviceCapabilities)]);
        NSLog(@"sdkVersion =%@", [plugin performSelector:@selector(sdkVersion)]);
        NSLog(@"shortVersionString =%@", [plugin performSelector:@selector(shortVersionString)]);
        
        NSLog(@"sourceAppIdentifier =%@", [plugin performSelector:@selector(sourceAppIdentifier)]);
        NSLog(@"staticDiskUsage =%@", [plugin performSelector:@selector(staticDiskUsage)]);
        NSLog(@"teamID =%@", [plugin performSelector:@selector(teamID)]);
        NSLog(@"vendorName =%@", [plugin performSelector:@selector(vendorName)]);
    

与50位技术专家面对面 20年技术见证,附赠技术全景图

以上是关于iOS逆向----获取手机安装的所有App列表及路径的主要内容,如果未能解决你的问题,请参考以下文章

iOS逆向系列-越狱环境的搭建

Android 逆向获取安装在手机中的应用的 APK 包 ( 进入 adb shell | 获取 root 权限 | 进入 /data/app/ 目录 | 拷贝 base.apk 到外置存储 )(代码

Android 逆向获取安装在手机中的应用的 APK 包 ( 进入 adb shell | 获取 root 权限 | 进入 /data/app/ 目录 | 拷贝 base.apk 到外置存储 )(代码

IOS 解密APP(逆向工程完整详解)

IOS 解密APP(逆向工程完整详解)

安卓导出已安装app的apk