There are two issues with message collection in jailBrokenMessage on iOS:
checkDylibsMessage overwrites the message with imagePath.
- (NSString *)checkDylibsMessage
{
NSString *imagePath;
for (int i=0; i < _dyld_image_count(); i++) {
imagePath = [NSString stringWithUTF8String:_dyld_get_image_name(i)]; <-- Here
for (NSString *dylibPath in [self dylibsToCheck]) {
if([imagePath localizedCaseInsensitiveContainsString:dylibPath]) {
imagePath = [NSString stringWithFormat:@"%@,%@", imagePath, dylibPath];
}
}
}
return imagePath;
}
It's needed to separate imagePath and dylibsMessage:
- (NSString *)checkDylibsMessage
{
NSString *dylibsMessage = @"";
NSString *imagePath;
for (int i=0; i < _dyld_image_count(); i++) {
imagePath = [NSString stringWithUTF8String:_dyld_get_image_name(i)];
for (NSString *dylibPath in [self dylibsToCheck]) {
if([imagePath localizedCaseInsensitiveContainsString:dylibPath]) {
dylibsMessage = [NSString stringWithFormat:@"%@,%@", dylibsMessage, dylibPath];
}
}
}
return dylibsMessage;
}
checkPathsMessage and checkSchemesMessage logs only the first path found, since the cycle is terminated:
- (NSString *)checkSchemesMessage
{
NSString *schemeMessage = @"";
for (NSString *scheme in [self schemesToCheck]) {
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]){
schemeMessage = [NSString stringWithFormat:@"%@,%@", schemeMessage, scheme];
break; <-- Here
}
}
return schemeMessage;
}
- (NSString *)checkPathsMessage
{
NSString *existsPath = @"";
for (NSString *path in [self pathsToCheck]) {
if ([[NSFileManager defaultManager] fileExistsAtPath:path]){
existsPath = [NSString stringWithFormat:@"%@,%@", existsPath, path];
break; <-- Here
}
}
return existsPath;
}
It's needed to log all found files and schemes:
- (NSString *)checkSchemesMessage
{
NSString *schemeMessage = @"";
for (NSString *scheme in [self schemesToCheck]) {
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]){
schemeMessage = [NSString stringWithFormat:@"%@,%@", schemeMessage, scheme];
}
}
return schemeMessage;
}
- (NSString *)checkPathsMessage
{
NSString *existsPath = @"";
for (NSString *path in [self pathsToCheck]) {
if ([[NSFileManager defaultManager] fileExistsAtPath:path]){
existsPath = [NSString stringWithFormat:@"%@,%@", existsPath, path];
}
}
return existsPath;
}
There are two issues with message collection in
jailBrokenMessageon iOS:checkDylibsMessageoverwrites the message withimagePath.It's needed to separate
imagePathanddylibsMessage:checkPathsMessageandcheckSchemesMessagelogs only the first path found, since the cycle is terminated:It's needed to log all found files and schemes: