通过Python+Pynput库进行代码与键鼠的交互,实现微信消息轰炸
简介
通过 Python + Pynput 库进行代码与电脑硬件(键盘鼠标)的交互,实现微信信息自动发送。
QQ、钉钉等聊天软件也可以实现相同效果。
工具
- Python3
- Pynput 库——pip命令安装即可
源码
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
| from pynput.keyboard import Key, Controller as key_cl from pynput.mouse import Button, Controller as mou_cl import time
def keyboard_input(string): keyboard = key_cl() keyboard.type(string)
def mouse_click(): mouse = mou_cl() mouse.press(Button.left) mouse.release(Button.left)
def send_message(number,string): print("程序在五秒钟之后开始执行") time.sleep(5) keyboard = key_cl()
for i in range(number): keyboard_input(string) mouse_click() time.sleep(0.3) keyboard.press(Key.enter) keyboard.release(Key.enter)
if __name__ == '__main__': send_message(200,"????????")
|