mirror of
https://github.com/somegeekintn/SimDirs.git
synced 2026-04-27 14:57:40 +00:00
add mobile_installation.log scan back
This commit is contained in:
parent
25c8ebd36e
commit
2d8d365e25
3 changed files with 89 additions and 29 deletions
|
|
@ -17,7 +17,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.3</string>
|
<string>0.3.1</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,8 @@
|
||||||
|
|
||||||
- (void) updateFromLastLaunchMapInfo: (NSDictionary *) inMapInfo
|
- (void) updateFromLastLaunchMapInfo: (NSDictionary *) inMapInfo
|
||||||
{
|
{
|
||||||
NSString *path;
|
self.bundlePath = inMapInfo[@"BundleContainer"];
|
||||||
|
self.sandBoxPath = inMapInfo[@"Container"];
|
||||||
path = inMapInfo[@"BundleContainer"];
|
|
||||||
if (self.bundlePath == nil && [self testPath: path]) {
|
|
||||||
self.bundlePath = path;
|
|
||||||
}
|
|
||||||
path = inMapInfo[@"Container"];
|
|
||||||
if (self.sandBoxPath == nil && [self testPath: path]) {
|
|
||||||
self.sandBoxPath = path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) updateFromAppStateInfo: (NSDictionary *) inStateInfo
|
- (void) updateFromAppStateInfo: (NSDictionary *) inStateInfo
|
||||||
|
|
@ -57,16 +49,8 @@
|
||||||
NSDictionary *compatInfo = inStateInfo[@"compatibilityInfo"];
|
NSDictionary *compatInfo = inStateInfo[@"compatibilityInfo"];
|
||||||
|
|
||||||
if (compatInfo != nil) {
|
if (compatInfo != nil) {
|
||||||
NSString *path;
|
self.bundlePath = compatInfo[@"bundlePath"];
|
||||||
|
self.sandBoxPath = compatInfo[@"sandboxPath"];
|
||||||
path = compatInfo[@"bundlePath"];
|
|
||||||
if (self.bundlePath == nil && [self testPath: path]) {
|
|
||||||
self.bundlePath = path;
|
|
||||||
}
|
|
||||||
path = compatInfo[@"sandboxPath"];
|
|
||||||
if (self.sandBoxPath == nil && [self testPath: path]) {
|
|
||||||
self.sandBoxPath = path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +69,9 @@
|
||||||
NSString *appPath = [appURL path];
|
NSString *appPath = [appURL path];
|
||||||
|
|
||||||
if ([[appPath lastPathComponent] rangeOfString: @".app"].location != NSNotFound) {
|
if ([[appPath lastPathComponent] rangeOfString: @".app"].location != NSNotFound) {
|
||||||
self.bundlePath = appPath;
|
// setter won't let us reset so access ivar directly
|
||||||
|
_bundlePath = appPath;
|
||||||
|
_childItems = nil;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -246,14 +232,18 @@
|
||||||
|
|
||||||
- (void) setBundlePath: (NSString *) inBundlePath
|
- (void) setBundlePath: (NSString *) inBundlePath
|
||||||
{
|
{
|
||||||
_bundlePath = inBundlePath;
|
if (_bundlePath == nil && [self testPath: inBundlePath]) {
|
||||||
_childItems = nil;
|
_bundlePath = inBundlePath;
|
||||||
|
_childItems = nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setSandBoxPath: (NSString *) inSandBoxPath
|
- (void) setSandBoxPath: (NSString *) inSandBoxPath
|
||||||
{
|
{
|
||||||
_sandBoxPath = inSandBoxPath;
|
if (_sandBoxPath == nil && [self testPath: inSandBoxPath]) {
|
||||||
_childItems = nil;
|
_sandBoxPath = inSandBoxPath;
|
||||||
|
_childItems = nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *) title
|
- (NSString *) title
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@
|
||||||
|
|
||||||
[self gatherAppInfoFromLastLaunchMap];
|
[self gatherAppInfoFromLastLaunchMap];
|
||||||
[self gatherAppInfoFromAppState];
|
[self gatherAppInfoFromAppState];
|
||||||
|
[self gatherAppInfoFromInstallLogs];
|
||||||
[self cleanupAndRefineAppList];
|
[self cleanupAndRefineAppList];
|
||||||
|
|
||||||
initOK = YES;
|
initOK = YES;
|
||||||
|
|
@ -129,10 +130,10 @@
|
||||||
- (void) gatherAppInfoFromAppState
|
- (void) gatherAppInfoFromAppState
|
||||||
{
|
{
|
||||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
NSURL *apStateInfoURL = [self.baseURL URLByAppendingPathComponent: @"data/Library/BackBoard/applicationState.plist"];
|
NSURL *appStateInfoURL = [self.baseURL URLByAppendingPathComponent: @"data/Library/BackBoard/applicationState.plist"];
|
||||||
|
|
||||||
if (apStateInfoURL != nil && [fileManager fileExistsAtPath: [apStateInfoURL path]]) {
|
if (appStateInfoURL != nil && [fileManager fileExistsAtPath: [appStateInfoURL path]]) {
|
||||||
NSData *plistData = [NSData dataWithContentsOfURL: apStateInfoURL];
|
NSData *plistData = [NSData dataWithContentsOfURL: appStateInfoURL];
|
||||||
NSDictionary *stateInfo;
|
NSDictionary *stateInfo;
|
||||||
|
|
||||||
stateInfo = [NSPropertyListSerialization propertyListWithData: plistData options: NSPropertyListImmutable format: nil error: nil];
|
stateInfo = [NSPropertyListSerialization propertyListWithData: plistData options: NSPropertyListImmutable format: nil error: nil];
|
||||||
|
|
@ -149,6 +150,75 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mobile_installation.log.0 is my least favorite, most fragile way to scan for app installations
|
||||||
|
// try this after everything else
|
||||||
|
- (void) gatherAppInfoFromInstallLogs
|
||||||
|
{
|
||||||
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
|
NSURL *installLogURL = [self.baseURL URLByAppendingPathComponent: @"data/Library/Logs/MobileInstallation/mobile_installation.log.0"];
|
||||||
|
|
||||||
|
if (installLogURL != nil && [fileManager fileExistsAtPath: [installLogURL path]]) {
|
||||||
|
NSString *installLog = [[NSString alloc] initWithContentsOfURL: installLogURL usedEncoding: nil error: nil];
|
||||||
|
|
||||||
|
if (installLog != nil) {
|
||||||
|
// check these from most recent to oldest
|
||||||
|
for (NSString *line in [[installLog componentsSeparatedByCharactersInSet: [NSCharacterSet newlineCharacterSet]] reverseObjectEnumerator]) {
|
||||||
|
if ([line rangeOfString: @"com.apple"].location == NSNotFound) {
|
||||||
|
NSRange logHintRange;
|
||||||
|
|
||||||
|
logHintRange = [line rangeOfString: @"makeContainerLiveReplacingContainer"];
|
||||||
|
if (logHintRange.location != NSNotFound) {
|
||||||
|
[self extractBundleLocationFromLogEntry: line];
|
||||||
|
}
|
||||||
|
|
||||||
|
logHintRange = [line rangeOfString: @"_refreshUUIDForContainer"];
|
||||||
|
if (logHintRange.location != NSNotFound) {
|
||||||
|
[self extractSandboxLocationFromLogEntry: line];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) extractBundleLocationFromLogEntry: (NSString *) inLine
|
||||||
|
{
|
||||||
|
NSArray *logComponents = [inLine componentsSeparatedByString: @" "];
|
||||||
|
NSString *bundlePath = [logComponents lastObject];
|
||||||
|
|
||||||
|
if (bundlePath != nil) {
|
||||||
|
NSInteger bundleIDIndex = [logComponents count] - 3;
|
||||||
|
|
||||||
|
if (bundleIDIndex >= 0) {
|
||||||
|
NSString *bundleID = [logComponents objectAtIndex: bundleIDIndex];
|
||||||
|
QSSimAppInfo *appInfo = [self appInfoWithBundleID: bundleID];
|
||||||
|
|
||||||
|
if (appInfo != nil) {
|
||||||
|
appInfo.bundlePath = bundlePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) extractSandboxLocationFromLogEntry: (NSString *) inLine
|
||||||
|
{
|
||||||
|
NSArray *logComponents = [inLine componentsSeparatedByString: @" "];
|
||||||
|
NSString *sandboxPath = [logComponents lastObject];
|
||||||
|
|
||||||
|
if (sandboxPath != nil) {
|
||||||
|
NSInteger bundleIDIndex = [logComponents count] - 5;
|
||||||
|
|
||||||
|
if (bundleIDIndex >= 0) {
|
||||||
|
NSString *bundleID = [logComponents objectAtIndex: bundleIDIndex];
|
||||||
|
QSSimAppInfo *appInfo = [self appInfoWithBundleID: bundleID];
|
||||||
|
|
||||||
|
if (appInfo != nil) {
|
||||||
|
appInfo.sandBoxPath = sandboxPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void) cleanupAndRefineAppList
|
- (void) cleanupAndRefineAppList
|
||||||
{
|
{
|
||||||
NSMutableArray *mysteryApps = [NSMutableArray array];
|
NSMutableArray *mysteryApps = [NSMutableArray array];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue