-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathKexts.m
More file actions
executable file
·97 lines (75 loc) · 2.23 KB
/
Kexts.m
File metadata and controls
executable file
·97 lines (75 loc) · 2.23 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
// Kexts.m
// KnockKnock
//
#import "File.h"
#import "Kexts.h"
#import "utilities.h"
//plugin name
#define PLUGIN_NAME @"Kernel Extensions"
//plugin description
#define PLUGIN_DESCRIPTION NSLocalizedString(@"installed kexts, likely kernel loaded", @"installed kexts, likely kernel loaded")
//plugin icon
#define PLUGIN_ICON @"kernelIcon"
//plugin search directories
NSString * const KEXT_SEARCH_DIRECTORIES[] = {@"/System/Library/Extensions/", @"/Library/Extensions/"};
@implementation Kexts
//init
// ->set name, description, etc
-(id)init
{
//super
self = [super init];
if(self)
{
//set name
self.name = PLUGIN_NAME;
//set description
self.description = PLUGIN_DESCRIPTION;
//set icon
self.icon = PLUGIN_ICON;
}
return self;
}
//scan for kexts
-(void)scan
{
//all kexts
NSArray* allKexts = nil;
//number of search directories
NSUInteger directoryCount = 0;
//full path to kext
NSString* kextPath = nil;
//detected kext
File* fileObj = nil;
//dbg msg
//NSLog(@"%@: scanning", PLUGIN_NAME);
//get number of search directories
directoryCount = sizeof(KEXT_SEARCH_DIRECTORIES)/sizeof(KEXT_SEARCH_DIRECTORIES[0]);
//iterate over all kext search directories
// ->get all kexts and process 'em
for(NSUInteger i=0; i < directoryCount; i++)
{
//get all kexts
allKexts = directoryContents(KEXT_SEARCH_DIRECTORIES[i], @"self ENDSWITH '.kext'");
//process a kext
// ->create File objects and report to UI
for(NSString* kext in allKexts)
{
//build full path to kext
kextPath = [NSString stringWithFormat:@"%@%@", KEXT_SEARCH_DIRECTORIES[i], kext];
//create File object for kext
// ->skip those that err out for any reason
if(nil == (fileObj = [[File alloc] initWithParams:@{KEY_RESULT_PLUGIN:self, KEY_RESULT_PATH:kextPath}]))
{
//skip
continue;
}
//process item
// ->save and report to UI
[super processItem:fileObj];
}
}
return;
}
@end