吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2200|回复: 31
收起左侧

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

  [复制链接]
yuupuu 发表于 2025-3-12 15:56
本帖最后由 yuupuu 于 2025-3-12 16:01 编辑

技术原理

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

[Python] 纯文本查看 复制代码
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
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
<?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


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

免费评分

参与人数 9吾爱币 +16 热心值 +7 收起 理由
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!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

sdieedu 发表于 2025-3-12 16:41
厉害啊 发财了
 楼主| yuupuu 发表于 2025-3-12 18:36
深爱成瘾 发表于 2025-3-12 16:59
我有这位老板的微信,我给大家问问赞赏码源码什么价?

一百多元而已
xiaoshuimian 发表于 2025-3-12 16:44
深爱成瘾 发表于 2025-3-12 16:59
我有这位老板的微信,我给大家问问赞赏码源码什么价?
Marken888 发表于 2025-3-12 17:00
感谢分享源代码!
9152pojie 发表于 2025-3-12 17:05
可以放在github上了
piazini 发表于 2025-3-12 17:06
打印LOGO用这个函数,
text = "liKeYunKeji"
    ascii_art = text2art(text)
    print(ascii_art)
ashirogimuto 发表于 2025-3-12 17:22
谢谢大佬
xiaoshuimian 发表于 2025-3-12 17:31
深爱成瘾 发表于 2025-3-12 16:59
我有这位老板的微信,我给大家问问赞赏码源码什么价?

我也有啊,之前还有群呢
jimoguying2020 发表于 2025-3-12 17:42
膜拜大佬呀,回传数据是比对金额吗?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-4-10 03:06

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表