Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Hack the SDKSymbolExtractor into the obfuscation flow to stop Cocoa s…
Browse files Browse the repository at this point in the history
…ymbols from being obfuscated
  • Loading branch information
medmonds authored and Matt Edmonds committed Oct 12, 2015
1 parent 00047f2 commit 20cf87b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Source/CDSymbolsGeneratorVisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
@property (nonatomic, readonly) NSString *resultString;
@property (nonatomic, readonly) NSDictionary *symbols;
@property(nonatomic, copy) NSString *symbolsFilePath;

- (void)addSymbolsPadding;
- (void)addSymbolsToBlacklist:(NSArray *)symbols;
@end
11 changes: 10 additions & 1 deletion Source/CDSymbolsGeneratorVisitor.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ - (void)addForbiddenSymbols {
]];
}

- (void)addSymbolsToBlacklist:(NSArray *)symbols {
if (!_forbiddenNames) {
_forbiddenNames = [NSMutableSet new];
}
[_forbiddenNames addObjectsFromArray:symbols];
}

- (void)willBeginVisiting {
_protocolNames = [NSMutableSet new];
_classNames = [NSMutableSet new];
Expand All @@ -87,7 +94,9 @@ - (void)willBeginVisiting {
_ivarNames = [NSMutableSet new];
_symbols = [NSMutableDictionary new];
_uniqueSymbols = [NSMutableSet new];
_forbiddenNames = [NSMutableSet new];
if (!_forbiddenNames) {
_forbiddenNames = [NSMutableSet new];
}
_symbolLength = 3;
_external = NO;
_ignored = NO;
Expand Down
11 changes: 10 additions & 1 deletion class-dump.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import "CDSymbolMapper.h"
#import "CDSystemProtocolsProcessor.h"
#import "CDdSYMProcessor.h"
#import "SDKSymbolExtractor.h"

NSString *defaultSymbolMappingPath = @"symbols.json";

Expand Down Expand Up @@ -411,12 +412,20 @@ int main(int argc, char *argv[])
print_usage();
exit(3);
}


SDKSymbolExtractor *extractor = [[SDKSymbolExtractor alloc] init];
extractor.searchPathState.executablePath = [executablePath stringByDeletingLastPathComponent];
extractor.sdkRoot = classDump.sdkRoot;
extractor.targetArch = targetArch;
[extractor loadFile:file error:&error depth:0];
[extractor collectSymbols];

CDSymbolsGeneratorVisitor *visitor = [CDSymbolsGeneratorVisitor new];
visitor.classDump = classDump;
visitor.classFilter = classFilter;
visitor.ignoreSymbols = ignoreSymbols;
visitor.symbolsFilePath = symbolsPath;
[visitor addSymbolsToBlacklist:extractor.symbols.allObjects];
[classDump recursivelyVisit:visitor];

CDXibStoryBoardProcessor *processor = [[CDXibStoryBoardProcessor alloc] init];
Expand Down

0 comments on commit 20cf87b

Please sign in to comment.