├── .gitignore ├── LICENSE ├── README.md └── red_helper.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # PyInstaller 26 | # Usually these files are written by a python script from a template 27 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 28 | *.manifest 29 | *.spec 30 | 31 | # Installer logs 32 | pip-log.txt 33 | pip-delete-this-directory.txt 34 | 35 | # Unit test / coverage reports 36 | htmlcov/ 37 | .tox/ 38 | .coverage 39 | .cache 40 | nosetests.xml 41 | coverage.xml 42 | 43 | # Translations 44 | *.mo 45 | *.pot 46 | 47 | # Django stuff: 48 | *.log 49 | 50 | # Sphinx documentation 51 | docs/_build/ 52 | 53 | # PyBuilder 54 | target/ 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 曹小华 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # alipay_red_helper 2 | 3 | 支付宝抢红包助手 4 | 5 | ### 演示环境 6 | 7 | * archlinux 8 | * xfce desktop 9 | 10 | ### 开发依赖 11 | 12 | * openjdk or oracle jdk 13 | * Android SDK 14 | 15 | ### 项目简介 16 | 17 | * 基于 android monkeyrunner 实现,非直接修改数据包,所以不能称为外挂,只能称为助手. 18 | 19 | ### 步骤 20 | 21 | * 首先简单的搭建 android 的相关环境,主要是安装android sdk. 下载地址 http://developer.android.com/sdk/index.html#Other 22 | * 下载 Android Platform Tool 23 | * 开启手机的调试,像linux一般还需要添加udev文件,就像windows下一般需要安装驱动一样. arch 可以直接安装包即可, https://wiki.archlinux.org/index.php/Android#Connecting_to_a_real_device_-_Android_Debug_Bridge_.28ADB.29 24 | * adb shell, 测试是否可以连接上手机 25 | * 运行脚本,记得路径改成你自己的 ./monkeyrunner ~/workspace/alipay_red_helper/red_helper.py 26 | 27 | ### 测试 28 | 29 | * 安装 Dev Tools 这个apk,下载地址 http://forum.xda-developers.com/showthread.php?t=872949 30 | * 运行后选择 Pointer Localtion, 这样可以看到脚本点到哪里了 31 | 32 | 33 | ### 结尾 34 | 35 | 支付宝 cutdeer@vip.qq.com 36 | -------------------------------------------------------------------------------- /red_helper.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | # Imports the monkeyrunner modules used by this program 3 | import time 4 | from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice 5 | 6 | # Connects to the current device, returning a MonkeyDevice object 7 | device = MonkeyRunner.waitForConnection() 8 | 9 | w = 720 10 | h = 1280 11 | 12 | #raw_input("按 Enter后再按 Ctrl+D 后开始乱点") 13 | print('go') 14 | 15 | while True: 16 | # 抢 17 | for i in xrange(0, 9): 18 | device.touch(362, 692, MonkeyDevice.DOWN_AND_UP) 19 | time.sleep(0.5) 20 | 21 | # 领 22 | for i in xrange(0, 2): 23 | device.touch(384, 978, MonkeyDevice.DOWN_AND_UP) 24 | time.sleep(0.5) 25 | 26 | # 关 27 | for i in xrange(0, 2): 28 | device.touch(120, 332, MonkeyDevice.DOWN_AND_UP) 29 | time.sleep(0.5) 30 | 31 | # Takes a screenshot 32 | #result = device.takeSnapshot() 33 | # Writes the screenshot to a file 34 | #result.writeToFile('/tmp/shot1.png','png') 35 | --------------------------------------------------------------------------------