Python编写了一款微信支付收款监听脚本,可做免签支付的监听软件,搭配赞赏码yyds

文章正文
发布时间:2025-07-29 04:44

本帖最后由 yuupuu 于 2025-3-12 16:01 编辑

技术原理

使用Python对微信电脑版界面的收款信息进行实时解析(类似于js获取dom节点一样)即可获取到收款信息。

[Python] 纯文本查看 复制代码

import re import time import uiautomation as automation import requests import hashlib from art import text2art last_matched_info = None # SecretKey(与Notify.php的安全校验SecretKey一致) #----------------------------- SecretKey = '自己设置,例如:52pojie' #------------------------------ # 电脑端回调地址(支付配置里面复制过来) #------------------------------ server_url = 'https://域名/路径/Notify.php' #------------------------------ #------------------ # 以下代码无需修改 # # 以下代码无需修改 # # 以下代码无需修改 # # 以下代码无需修改 # # 以下代码无需修改 # #------------------ def explore_control(control, depth, target_depth): global last_matched_info try: name = control.Name if name: if depth == target_depth: # 匹配收款金额信息 match = re.search(r'收款金额¥([\d.]+)', name) if match: global amount amount = match.group(1) last_matched_info = f"收款金额: ¥{amount}, " # 匹配来自、到账时间信息 match = re.search(r'来自(.+?)到账时间(.+?)备注', name) if match: global sender sender = match.group(1) global timestamp timestamp = match.group(2) last_matched_info += f"来自: {sender}, 到账时间: {timestamp}" return # 递归处理子控件 for child in control.GetChildren(): explore_control(child, depth + 4, target_depth) except Exception as e: print(f"发生错误: {str(e)}") def process_wechat_window(wechat_window, prev_info): global last_matched_info if wechat_window.Exists(0): explore_control(wechat_window, 0, 60) if last_matched_info and last_matched_info != prev_info: print(last_matched_info) print("-------------------------------------------------------") print("持续监控中...") print("-------------------------------------------------------") prev_info = last_matched_info # 向服务器发送请求 send_http_request(last_matched_info,amount,sender,timestamp) else: print("无法获取到窗口,请保持微信支付窗口显示...") return prev_info def send_http_request(info, amount, sender, timestamp): # 计算 signature timestamp_forsign = int(time.mktime(time.strptime(timestamp, "%Y-%m-%d %H:%M:%S"))) sign_str = f"{SecretKey}{amount}{timestamp_forsign}" signature = hashlib.md5(sign_str.encode('utf-8')).hexdigest() try: # 将金额、来自、到账时间、签名 POST 给服务器 response = requests.post(server_url, data={ 'amount': amount, 'sender': sender, 'timestamp': timestamp, 'signature': signature }) print("回调成功!持续监控中...") print("-------------------------------------------------------") except Exception as e: print(f"回调失败: {str(e)}") def main(): global last_matched_info prev_info = None try: # 获取微信窗口 wechat_window = automation.WindowControl(searchDepth=1, ClassName='ChatWnd') prev_info = process_wechat_window(wechat_window, prev_info) except Exception as e: print(f"发生错误: {str(e)}") try: while True: try: # 持续监听微信窗口 wechat_window = automation.WindowControl(searchDepth=1, ClassName='ChatWnd') prev_info = process_wechat_window(wechat_window, prev_info) except Exception as e: print(f"发生错误: {str(e)}") # 轮询间隔秒数(默认2秒) time.sleep(2) except KeyboardInterrupt: print("\n收款监控服务已关闭!") if __name__ == "__main__": text = "liKeYunKeji" ascii_art = text2art(text) print(ascii_art) print("-------------------------------------------------------") print("欢迎使用liKeYun微信赞赏码支付插件PC监控端") print("-------------------------------------------------------") main()




Notify.php

[PHP] 纯文本查看 复制代码

<?php /** * 程序说明:电脑版监控回调 */ // 编码 header("Content-type:application/json"); // 收款金额 $amount = trim($_POST['amount']); // 微信昵称 $sender = trim($_POST['sender']); // 到账时间 $timestamp = trim($_POST['timestamp']); // 监听到的原文 $orderMsg = $amount . $sender . $timestamp; // 签名 $signature = trim($_POST['signature']); // 验证签名 // 签名算法:MD5($SecretKey+$amount+$timestamp(接收到的XXXX-XX-XX XX:XX:XX要转换为时间戳)) if ($signature == md5($SecretKey . $amount . strtotime($timestamp))) { // 签名正确 // 这里连接数据库做回调更新即可 } else { // 签名错误 } ?>



image.png



我自己做了一套收款系统,使用微信赞赏码进行收款,还是非常的稳。(系统自用,不分享收款源码~)

image.png




亲测这个脚本是非常的快,非常的稳!
 

免费评分 参与人数 10吾爱币 +16 热心值 +8 理由

smile1110
    + 1   宇宙无敌  

weidechan
  + 1     感谢发布原创作品,吾爱破解论坛因你更精彩!  

苏紫方璇
  + 7   + 1   欢迎分析讨论交流,吾爱破解论坛有你更精彩!  

bingbing2025
    + 1   我很赞同!  

yingzi89
  + 1     谢谢@Thanks!  

xiaoxia0316
  + 1   + 1   用心讨论,共获提升!  

yuweb
  + 1   + 1   老大真是太牛逼了  

Monitor
  + 3   + 1   感谢发布原创作品,吾爱破解论坛因你更精彩!  

woyucheng
  + 1   + 1   谢谢@Thanks!  

gunxsword
  + 1   + 1   谢谢@Thanks!  

查看全部评分

首页
评论
分享
Top