惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - 你看起来真的很好吃

linux系统时间管理 安装历史docker版本 OCR文本提取+NER命名实体识别 测试 深度学习-激活函数 go——make和new的区别 go——GC垃圾回收机制 go——标识符的命名规范 go语言——数据类型 go语言——转义符 go开发环境安装 git使用 项目文档目录总结 windows使用YOLOV5训练模型——搭建编译环境 高匿名动态IP代理获取 logging模块进行格式化输出 笔记 Django admin 添加操作记录 facenet + fiass 实现人脸识别
鼠标连点器——python版
你看起来真的很好吃 · 2023-12-21 · via 博客园 - 你看起来真的很好吃
# This is a sample Python script.
from pynput import mouse
from pynput import keyboard
import threading
import time
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.

class MouseClick:
keyboard = ""
start_multi_click = False
# 鼠标对象
mouse = mouse.Controller()
# 键盘监控
keyboard_listener = None
mouse_listener = None
# 运行
running = True
# 鼠标信息
x, y, button = 0, 0, None

def __init__(self):
self.keyboard_listener = keyboard.Listener(on_release=self.on_release, on_press=self.on_press)
self.keyboard_listener.start()

self.mouse_listener = mouse.Listener(on_click=self.on_click)
self.mouse_listener.start()

def on_press(self, key):
"""释放按键"""
self.keyboard = key.name if hasattr(key, "name") else str(key)

def on_release(self, key):
"""释放按键"""
self.keyboard = ""

if hasattr(key, "name") and key.name == "esc":
self.running = False

def on_click(self, x, y, button, pressed):
"""获取鼠标信息"""
if pressed:
self.x = x
self.y = y
self.button = button
print(self.x, self.y, self.button)

def run(self):
"""循环监控鼠标和键盘"""
while True:
# 退出连点器
if not self.running:
break

# shift + button 执行连点, 执行连点后恢复鼠标信息
if self.keyboard == "shift" and self.x and self.y and self.button:
print(self.x, self.y, self.button)
# 连点9次加上触发的1次总共为10次
self.mouse.click(self.button, 9)
self.x = 0
self.y = 0
self.button = None

# 监控频率
time.sleep(0.1)

# 释放资源
self.keyboard_listener.stop()
self.mouse_listener.stop()

def new_thread_start():
mouse = MouseClick()
mouse.run()

# Press the green button in the gutter to run the script.
if __name__ == '__main__':
mouse1 = mouse.Controller()
mouse1.click(mouse.Button.left, 9)
mouse_t = threading.Thread(target=new_thread_start, args=())
mouse_t.start()