Skip to content

Commit 22a1d94

Browse files
committed
improved UI and JSON output
1 parent c1dcd1b commit 22a1d94

File tree

10 files changed

+196
-55
lines changed

10 files changed

+196
-55
lines changed

AppDelegate.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616

1717
/* GLOBALS */
1818

19+
//scan ID
1920
NSString* scanID = nil;
2021

22+
//query VT
23+
extern BOOL queryVT;
24+
2125
@implementation AppDelegate
2226

2327
@synthesize plugins;
@@ -420,12 +424,9 @@ -(void)startScan
420424
}
421425

422426
//thread function
423-
// ->runs in the background to execute each plugin
427+
// runs in the background to execute each plugin
424428
-(void)scan
425429
{
426-
//query VT?
427-
BOOL queryVT = NO;
428-
429430
//set scan flag
430431
self.isConnected = isNetworkConnected();
431432

KnockKnock.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@
11351135
CODE_SIGN_IDENTITY = "Developer ID Application";
11361136
CODE_SIGN_STYLE = Manual;
11371137
COMBINE_HIDPI_IMAGES = YES;
1138-
CURRENT_PROJECT_VERSION = 4.0.0;
1138+
CURRENT_PROJECT_VERSION = 4.0.1;
11391139
DEVELOPMENT_TEAM = VBG97UB4TA;
11401140
ENABLE_HARDENED_RUNTIME = YES;
11411141
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -1150,7 +1150,7 @@
11501150
"$(PROJECT_DIR)/Libraries/BTM",
11511151
);
11521152
MACOSX_DEPLOYMENT_TARGET = 10.15;
1153-
MARKETING_VERSION = 4.0.0;
1153+
MARKETING_VERSION = 4.0.1;
11541154
ONLY_ACTIVE_ARCH = NO;
11551155
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.${PRODUCT_NAME:rfc1034identifier}";
11561156
PRODUCT_NAME = KnockKnock;
@@ -1167,7 +1167,7 @@
11671167
CODE_SIGN_IDENTITY = "Developer ID Application";
11681168
CODE_SIGN_STYLE = Manual;
11691169
COMBINE_HIDPI_IMAGES = YES;
1170-
CURRENT_PROJECT_VERSION = 4.0.0;
1170+
CURRENT_PROJECT_VERSION = 4.0.1;
11711171
DEVELOPMENT_TEAM = VBG97UB4TA;
11721172
ENABLE_HARDENED_RUNTIME = YES;
11731173
GCC_PRECOMPILE_PREFIX_HEADER = YES;
@@ -1182,7 +1182,7 @@
11821182
"$(PROJECT_DIR)/Libraries/BTM",
11831183
);
11841184
MACOSX_DEPLOYMENT_TARGET = 10.15;
1185-
MARKETING_VERSION = 4.0.0;
1185+
MARKETING_VERSION = 4.0.1;
11861186
ONLY_ACTIVE_ARCH = NO;
11871187
PRODUCT_BUNDLE_IDENTIFIER = "com.objective-see.${PRODUCT_NAME:rfc1034identifier}";
11881188
PRODUCT_NAME = KnockKnock;

PrefsWindowController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363

6464
//link (how to get a VT key)
6565
@property (weak) IBOutlet HyperlinkTextField* getAPILink;
66+
@property (weak) IBOutlet HyperlinkTextField* getAPILinkPopover;
6667

6768
/* METHODS */
6869

PrefsWindowController.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ -(void)windowDidLoad
8080
self.apiTextField.stringValue = self.vtAPIKey;
8181
}
8282

83+
//make url a hyperlink
84+
makeTextViewHyperlink(self.getAPILink, [NSURL URLWithString:@"https://docs.virustotal.com/docs/please-give-me-an-api-key"]);
85+
8386

8487
return;
8588
}
@@ -229,7 +232,7 @@ - (IBAction)showAPIHelp:(id)sender {
229232
viewController.view = self.getAPIHelp;
230233

231234
//make url a hyperlink
232-
makeTextViewHyperlink(self.getAPILink, [NSURL URLWithString:@"https://docs.virustotal.com/docs/please-give-me-an-api-key"]);
235+
makeTextViewHyperlink(self.getAPILinkPopover, [NSURL URLWithString:@"https://docs.virustotal.com/docs/please-give-me-an-api-key"]);
233236

234237
//init
235238
popover.contentViewController = viewController;

Results/File.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#import "utilities.h"
1515
#import "AppDelegate.h"
1616

17+
/* GLOBALS */
18+
19+
//cmdline scab
20+
extern BOOL queryVT;
21+
1722
@implementation File
1823

1924
@synthesize path;
@@ -308,12 +313,11 @@ -(NSString*)toJSON
308313
dict[@"signature(s)"] = self.signingInfo ?: @"unknown";
309314

310315
//include VT?
311-
if( [NSProcessInfo.processInfo.arguments containsObject:@"-key"] &&
312-
![NSProcessInfo.processInfo.arguments containsObject:@"-skipVT"] )
313-
{
316+
if(queryVT) {
317+
314318
dict[@"VT detection"] = [NSString stringWithFormat:@"%lu/%lu",
315-
(unsigned long)[self.vtInfo[VT_RESULTS_POSITIVES] unsignedIntegerValue],
316-
(unsigned long)[self.vtInfo[VT_RESULTS_TOTAL] unsignedIntegerValue]];
319+
(unsigned long)[self.vtInfo[VT_RESULTS_POSITIVES] unsignedIntegerValue],
320+
(unsigned long)[self.vtInfo[VT_RESULTS_TOTAL] unsignedIntegerValue]];
317321
}
318322

319323
//serialize

UI/Base.lproj/PrefsWindow.xib

Lines changed: 94 additions & 33 deletions
Large diffs are not rendered by default.

UI/mul.lproj/PrefsWindow.xcstrings

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{
22
"sourceLanguage" : "en",
33
"strings" : {
4+
"2gz-Tn-4EA.title" : {
5+
"comment" : "Class = \"NSTextFieldCell\"; title = \"Enable this option to show persistent macOS and Apple-installed components.\"; ObjectID = \"2gz-Tn-4EA\";",
6+
"extractionState" : "extracted_with_value",
7+
"localizations" : {
8+
"en" : {
9+
"stringUnit" : {
10+
"state" : "new",
11+
"value" : "Enable this option to show persistent macOS and Apple-installed components."
12+
}
13+
}
14+
}
15+
},
416
"7e0-cR-939.title" : {
517
"comment" : "Class = \"NSButtonCell\"; title = \"Start at login (+perform scan).\"; ObjectID = \"7e0-cR-939\";",
618
"extractionState" : "extracted_with_value",
@@ -13,6 +25,18 @@
1325
}
1426
}
1527
},
28+
"9UV-0a-N9m.title" : {
29+
"comment" : "Class = \"NSTextFieldCell\"; title = \"Enable this option so KnockKnock launches and scans at each login.\\n\"; ObjectID = \"9UV-0a-N9m\";",
30+
"extractionState" : "extracted_with_value",
31+
"localizations" : {
32+
"en" : {
33+
"stringUnit" : {
34+
"state" : "new",
35+
"value" : "Enable this option so KnockKnock launches and scans at each login.\n"
36+
}
37+
}
38+
}
39+
},
1640
"CMD-Kc-WiI.title" : {
1741
"comment" : "Class = \"NSTextFieldCell\"; title = \"API Key:\"; ObjectID = \"CMD-Kc-WiI\";",
1842
"extractionState" : "extracted_with_value",
@@ -37,6 +61,18 @@
3761
}
3862
}
3963
},
64+
"EbR-vz-kge.title" : {
65+
"comment" : "Class = \"NSTextFieldCell\"; title = \"Obtain a key (for free!):\"; ObjectID = \"EbR-vz-kge\";",
66+
"extractionState" : "extracted_with_value",
67+
"localizations" : {
68+
"en" : {
69+
"stringUnit" : {
70+
"state" : "new",
71+
"value" : "Obtain a key (for free!):"
72+
}
73+
}
74+
}
75+
},
4076
"F0z-JX-Cv5.title" : {
4177
"comment" : "Class = \"NSWindow\"; title = \"KnockKnock Settings\"; ObjectID = \"F0z-JX-Cv5\";",
4278
"extractionState" : "extracted_with_value",
@@ -73,6 +109,18 @@
73109
}
74110
}
75111
},
112+
"iA8-I3-D7j.title" : {
113+
"comment" : "Class = \"NSTextFieldCell\"; title = \"Enable this option to prevent the app from querying VirusTotal for known malware.\"; ObjectID = \"iA8-I3-D7j\";",
114+
"extractionState" : "extracted_with_value",
115+
"localizations" : {
116+
"en" : {
117+
"stringUnit" : {
118+
"state" : "new",
119+
"value" : "Enable this option to prevent the app from querying VirusTotal for known malware."
120+
}
121+
}
122+
}
123+
},
76124
"idJ-pd-k6U.title" : {
77125
"comment" : "Class = \"NSButtonCell\"; title = \"Disable automatic update check.\"; ObjectID = \"idJ-pd-k6U\";",
78126
"extractionState" : "extracted_with_value",
@@ -109,6 +157,18 @@
109157
}
110158
}
111159
},
160+
"k8E-oV-fEv.title" : {
161+
"comment" : "Class = \"NSTextFieldCell\"; title = \"https://docs.virustotal.com/docs/please-give-me-an-api-key\"; ObjectID = \"k8E-oV-fEv\";",
162+
"extractionState" : "extracted_with_value",
163+
"localizations" : {
164+
"en" : {
165+
"stringUnit" : {
166+
"state" : "new",
167+
"value" : "https://docs.virustotal.com/docs/please-give-me-an-api-key"
168+
}
169+
}
170+
}
171+
},
112172
"Nua-Eb-VTm.title" : {
113173
"comment" : "Class = \"NSTextFieldCell\"; title = \"Enter your personal VirusTotal API key. \\nYou can learn more about getting such a key (for free!) here:\"; ObjectID = \"Nua-Eb-VTm\";",
114174
"extractionState" : "extracted_with_value",
@@ -121,6 +181,18 @@
121181
}
122182
}
123183
},
184+
"OWQ-k5-mAX.title" : {
185+
"comment" : "Class = \"NSTextFieldCell\"; title = \"Enable this option to prevent the app from checking for updates automatically.\"; ObjectID = \"OWQ-k5-mAX\";",
186+
"extractionState" : "extracted_with_value",
187+
"localizations" : {
188+
"en" : {
189+
"stringUnit" : {
190+
"state" : "new",
191+
"value" : "Enable this option to prevent the app from checking for updates automatically."
192+
}
193+
}
194+
}
195+
},
124196
"rp9-45-S3R.placeholderString" : {
125197
"comment" : "Class = \"NSTextFieldCell\"; placeholderString = \"Your API Key\"; ObjectID = \"rp9-45-S3R\";",
126198
"extractionState" : "extracted_with_value",
@@ -145,14 +217,14 @@
145217
}
146218
}
147219
},
148-
"Uce-KH-7DH.title" : {
149-
"comment" : "Class = \"NSTextFieldCell\"; title = \"General:\"; ObjectID = \"Uce-KH-7DH\";",
220+
"tJm-La-oyS.title" : {
221+
"comment" : "Class = \"NSTextFieldCell\"; title = \"With an API key, checks items against VirusTotal for known malware. \"; ObjectID = \"tJm-La-oyS\";",
150222
"extractionState" : "extracted_with_value",
151223
"localizations" : {
152224
"en" : {
153225
"stringUnit" : {
154226
"state" : "new",
155-
"value" : "General:"
227+
"value" : "With an API key, checks items against VirusTotal for known malware. "
156228
}
157229
}
158230
}

VirusTotal.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
/* GLOBALS */
1717

1818
//cmdline flag
19-
extern BOOL cmdlineMode;
20-
2119
extern NSString* scanID;
2220

2321
@implementation VirusTotal

main.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ BOOL cmdlineMode = NO;
3232
//cmdline flag
3333
BOOL isVerbose = NO;
3434

35+
//query VT?
36+
BOOL queryVT = NO;
37+
3538
//(VT) API key for cmdline scan
3639
NSString* vtAPIKey = nil;
3740

41+
3842
/* FUNCTIONS */
3943

4044
//print usage

main.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ void cmdlineScan(NSArray* args)
173173
//flag
174174
BOOL prettyPrint = NO;
175175

176-
//flag
177-
BOOL queryVT = NO;
178-
179176
//displayed items
180177
// e.g. ignore apple/trusted if `-apple` not specified
181178
NSUInteger displayedItems = 0;

0 commit comments

Comments
 (0)