-
Notifications
You must be signed in to change notification settings - Fork 14
/
AppDelegate.h
executable file
·238 lines (167 loc) · 6.08 KB
/
AppDelegate.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
//
// AppDelegate.h
// TaskExplorer
//
// Created by Patrick Wardle
// Copyright (c) 2015 Objective-See. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "Task.h"
#import "Filter.h"
#import "Binary.h"
#import "ItemBase.h"
#import "VirusTotal.h"
#import "TaskEnumerator.h"
#import "CustomTextField.h"
#import "TaskTableController.h"
#import "AboutWindowController.h"
#import "PrefsWindowController.h"
#import "SearchWindowController.h"
#import "UpdateWindowController.h"
#import "ResultsWindowController.h"
#import "FlaggedItemWindowController.h"
#import "RequestRootWindowController.h"
/* GLOBALS */
//shared enumerator
extern TaskEnumerator* taskEnumerator;
//shared virustotal object
extern VirusTotal* virusTotal;
//network connected flag
extern BOOL isConnected;
@interface AppDelegate : NSObject <NSApplicationDelegate, NSWindowDelegate, NSTableViewDataSource, NSTableViewDelegate, NSMenuDelegate>
{
}
//friends
@property (weak) IBOutlet NSWindow *friends;
//'filter task' search box
// ->top pane
@property (weak) IBOutlet NSSearchField *filterTasksBox;
//(current) bottom view controller
@property(nonatomic, retain)TaskTableController *bottomViewController;
//top view/pane
@property (weak) IBOutlet NSView *topPane;
//task table controller object
@property (nonatomic, retain)TaskTableController *taskTableController;
//current task view format
// ->flat or tree
@property NSUInteger taskViewFormat;
//drop-down view selector
@property (weak) IBOutlet NSPopUpButton *viewSelector;
//segmented button for button pane
// ->select to view dylib, files, network, etc
@property (weak) IBOutlet NSSegmentedControl *bottomPaneBtn;
//action when segmented button is clicked
-(IBAction)selectBottomPaneContent:(id)sender;
//bottom pane view
@property (weak) IBOutlet NSView *bottomPane;
//'filter items' search box (bottom pane)
@property (weak) IBOutlet NSSearchField *filterItemsBox;
//(main) window
@property (assign) IBOutlet NSWindow *window;
//logo button
@property (weak) IBOutlet NSButton *logoButton;
//spinner
@property (weak) IBOutlet NSProgressIndicator *progressIndicator;
//filter object
@property(nonatomic, retain)Filter* filterObj;
//array for all virus total threads
@property(nonatomic, retain)NSMutableArray* vtThreads;
//request root window controller
@property(nonatomic, retain)RequestRootWindowController* requestRootWindowController;
//preferences window controller
@property(nonatomic, retain)PrefsWindowController* prefsWindowController;
//about window controller
@property(nonatomic, retain)AboutWindowController* aboutWindowController;
//search window controller
@property(nonatomic, retain)SearchWindowController* searchWindowController;
//results window controller
@property(nonatomic, retain)ResultsWindowController* resultsWindowController;
//flagged items window controller
@property(nonatomic, retain)FlaggedItems* flagItemsWindowController;
//currently selected task
@property(nonatomic, retain)Task* currentTask;
//activity indicator for bottom pane
@property (weak) IBOutlet NSProgressIndicator *bottomPaneSpinner;
//'no items' found label for bottom pane
@property (weak) IBOutlet NSTextField *noItemsLabel;
//refresh button
@property (weak) IBOutlet NSButton *refreshButton;
//search button
@property (weak) IBOutlet NSButton *searchButton;
//save button
@property (weak) IBOutlet NSButton *saveButton;
//flagged items button
@property (weak) IBOutlet NSButton *flaggedButton;
//top constraint
@property(nonatomic, retain)NSLayoutConstraint* topConstraint;
//bottom constraint
@property(nonatomic, retain)NSLayoutConstraint* bottomConstraint;
//top constraint
@property(nonatomic, retain)NSLayoutConstraint* leadingConstraint;
//top constraint
@property(nonatomic, retain)NSLayoutConstraint* trailingConstraint;
//flag for filter field (autocomplete)
@property BOOL completePosting;
//flag for filter field (autocomplete)
@property BOOL commandHandling;
//custom search field for tasks
@property(nonatomic, retain)CustomTextField* customTasksFilter;
//custom search field for items
@property(nonatomic, retain)CustomTextField* customItemsFilter;
//overlay view for filter
@property (weak) IBOutlet NSView *filteringOverlay;
//activity indicator for filtering
@property (weak) IBOutlet NSProgressIndicator *filteringIndicator;
//message for filtering
@property (weak) IBOutlet NSTextField *filteringMessage;
//update window controller
@property(nonatomic, retain)UpdateWindowController* updateWindowController;
/* METHODS */
//complete a few inits
// ->then invoke helper method to start enum'ing task (in bg thread)
-(void)go;
//switch between flat/tree view
-(IBAction)switchView:(id)sender;
//init tracking areas for buttons
// ->provide mouse over effects
-(void)initTrackingAreas;
//action for 'refresh' button
// ->query OS to refresh/reload all tasks
-(IBAction)refreshTasks:(id)sender;
//button handler for logo
-(IBAction)logoButtonHandler:(id)sender;
//action for 'about' in menu/logo in UI
-(IBAction)about:(id)sender;
//reload (to re-draw) a specific row in table
-(void)reloadRow:(id)item;
//reload task table
-(void)reloadTaskTable;
//smartly, reload bottom pane
// ->checks if task & item type (e.g. files) are both selected
-(void)reloadBottomPane:(Task*)task itemView:(NSUInteger)itemView;
//begin task enumeration
-(void)exploreTasks;
//sort tasks
// ->either name (flat view) or pid (tree view)
-(void)sortTasksForView:(OrderedDictionary*)tasks;
//VT callback to reload a binary
-(void)reloadBinary:(Binary*)binary;
//save button handler
-(IBAction)saveResults:(id)sender;
//search button handler
-(IBAction)search:(id)sender;
//constrain subview to parent view
-(void)constrainView:(NSView*)containerView subView:(NSView*)subView;
//display (in separate popup) all flagged items
-(IBAction)showFlaggedItems:(id)sender;
//callback for custom search fields
// ->handle auto-complete filterings
-(void)filterAutoComplete:(NSTextView*)textField;
//show the filter overlay, etc
-(void)prepUIForFiltering:(NSUInteger)pane;
//hide overlay, etc
-(void)unprepUIForFiltering;
//code to complete filtering/search
// ->reload table/scroll to top etc
-(void)finalizeFiltration:(NSUInteger)pane;
@end