python 信息轰炸

bboyzqh

共 734字,需浏览 2分钟

 ·

2023-05-08 08:40

代码:

# -*- codeing = utf-8 -*-
# @author:pcy
# @Time:2021/8/18 15:15
# @File:QQ消息轰炸.py
# @software:PyCharm
'''
思路: 1、通过鼠标左键点击实现定位 2、通过键盘设置发送的内容 3、通过按下回车键发送信息 4、通过循环发送实现批量发送'''
# 导入鼠标控制器
from pynput.mouse import Button, Controller as mouse_use
# 导入键盘控制器
from pynput.keyboard import Key, Controller as Key_use
# 时间库
import time

# 函数定义
def send(string):
# 1模拟鼠标左键点击实现定位
mouse = mouse_use() # 获取鼠标控制权限
mouse.press(Button.left) # 模拟鼠标左键点击,press是点击
mouse.release(Button.left) # 模拟鼠标左键释放
# 4通过循环发送实现批量发送
for i in range(100):
# 2模拟通过键盘设置发送的内容
Key = Key_use() # 获取键盘控制权限
Key.type(string)

# 3模拟按下回车键操作, 发送信息
Key.press(Key.enter)
Key.release(Key.enter) # 模拟键盘键的回车释放
# 主函数入口
if __name__ == '__main__':
time.sleep(3)
# 函数调用
send("你好美!")



浏览 33
点赞
评论
收藏
分享

手机扫一扫分享

举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

举报