// 这里以 __TEXT,__cstring 字符串段为例,来查找是否存在制定的字符串 NSLog(@"www.chinapyg.com"); unsigned long size; uint8_t *ptr = getsectiondata(&_mh_execute_header, "__TEXT", "__cstring", &size); NSData *data = [NSData dataWithBytesNoCopy:ptr length:size freeWhenDone:NO]; NSString *nsDataStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSRange range = [nsDataStr rangeOfString:@"www.chinapyg.com"]; if (range.location != NSNotFound) { NSString *scheme = [nsDataStr substringWithRange:NSMakeRange(range.location, range.length)]; NSLog(@"scheme = %@", scheme); }
发表评论