-
Notifications
You must be signed in to change notification settings - Fork 28
/
CDLCSegment.h
50 lines (35 loc) · 1.57 KB
/
CDLCSegment.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// -*- mode: ObjC -*-
// This file is part of class-dump, a utility for examining the Objective-C segment of Mach-O files.
// Copyright (C) 1997-2019 Steve Nygard.
#import "CDLoadCommand.h"
@class CDSection;
#define CDSegmentProtectedMagic_None 0
#define CDSegmentProtectedMagic_AES 0xc2286295
#define CDSegmentProtectedMagic_Blowfish 0x2e69cf40
typedef enum : NSUInteger {
CDSegmentEncryptionType_None = 0,
CDSegmentEncryptionType_AES = 1, // 10.5 and earlier (AES)
CDSegmentEncryptionType_Blowfish = 2, // 10.6 (Blowfish)
CDSegmentEncryptionType_Unknown
} CDSegmentEncryptionType;
extern NSString *CDSegmentEncryptionTypeName(CDSegmentEncryptionType type);
@interface CDLCSegment : CDLoadCommand
@property (strong) NSString *name;
@property (strong) NSArray *sections;
@property (nonatomic, readonly) NSUInteger vmaddr;
@property (nonatomic, readonly) NSUInteger fileoff;
@property (nonatomic, readonly) NSUInteger filesize;
@property (nonatomic, readonly) vm_prot_t initprot;
@property (nonatomic, readonly) uint32_t flags;
@property (nonatomic, readonly) BOOL isProtected;
@property (nonatomic, readonly) CDSegmentEncryptionType encryptionType;
@property (nonatomic, readonly) BOOL canDecrypt;
- (NSString *)flagDescription;
- (BOOL)containsAddress:(NSUInteger)address;
- (CDSection *)sectionContainingAddress:(NSUInteger)address;
- (CDSection *)sectionWithName:(NSString *)name;
- (NSUInteger)fileOffsetForAddress:(NSUInteger)address;
- (NSUInteger)segmentOffsetForAddress:(NSUInteger)address;
- (void)writeSectionData;
- (NSData *)decryptedData;
@end