python qq轰炸机脚本

用pynput模块进行控制键盘和鼠标
思路:键盘输入字符->鼠标点击–>鼠标释放
写好后在虚拟环境下运行,登录qq,找到想要轰炸的好友,鼠标放在发送按键上,就可以了

#!/usr/bin/python
****# -*- coding:utf8 -*-****
import time
from pynput.keyboard import Controller as key_cl
from pynput.mouse import Button,Controller

#定义键盘输入函数
def keyboard_input(string):
    keyboard=key_cl()
    keyboard.type(string)

#鼠标点击
def mouse_click():
    mouse=Controller()
    mouse.press(Button.left)
    mouse.release(Button.left)

#主函数
def main(number,string):
    time.sleep(7)
    for i in range(number):
        keyboard_input(string)
        mouse_click()
        time.sleep(0.2)

if __name__ ==" main ":
    main(20,'你好')

你可能感兴趣的:(python)