使用Python制作微信跳一跳辅助

作者:Pleiades 时间:2022-09-21 12:10:37 

1.  前言

微信的跳一跳相信大家都很熟悉了,而且现在各种 * 、辅助也是满天飞,反正本人的好友排行榜中已经是八九百都不足为奇了。某宝上一搜一堆结果,最低的居然只要3块多,想刷多少分就刷多少分,真是离谱。

作为一枚程序猿,我决心也自己搞一下,不为别的,一来为了磨练一下自己的解决问题的能力,而来也为了娱乐一下。像这种任务,最适合的当然是Python,丰富的第三方库,而且具有胶水语言的特点。

本程序的主要设计思路就是,PC端adb连接手机→截屏→在PC端展示→用户鼠标选取起点和终点→计算距离、时长→adb发送指令模拟按压→截屏循环。

2.  ADB

adb,Android Debug Bridge,即安卓调试桥,包含如下几个部分:
•Client端, 运行在开发机器中,即你的开发PC机,用来发送adb命令
•Deamon守护进程,运行在调试设备中,即的调试手机或模拟器
•Server端,作为一个后台进程运行在开发机器中,即你的开发PC机,用来管理PC中的Client端和手机的Deamon之间的通信

我们通常用的adb命令指的就是Client端程序。Server端实际上在本机侦听端口5037,将指令通过usb线/wifi转发给移动设备的Deamon进程。

adb命令读者可以去官方网站查看文档(http://adbshell.com/commands),这里只介绍用到的几个命令。

(1)    adb devices列出所有连接的模拟器/设备


Prints a list of all attached emulator/device

adb devices

In response, return serial number and state

e4b25377    device

emulator-5554 device

(2)    adb shell screencap截屏


taking a screenshot of a device display.

adb shell screencap <filename>

adb shell screencap /sdcard/screen.png

download the file from the device将文件从设备下载到本机。

adb pull /sdcard/screen.png

(3)    adb shell input swipe模拟滑动操作(长按)


adb shell input swipe 100 100 100 100 500模拟长按坐标(100, 100)时长500ms

C:\Documents and Settings\Administrator>adb shell
 root@NX403A:/ # input
 input
 Usage: input [<source>] <command> [<arg>...]

The sources are:
    trackball
    joystick
    touchnavigation
    mouse
    keyboard
    gamepad
    touchpad
    dpad
    stylus
    touchscreen

The commands and default sources are:
    text <string> (Default: touchscreen)
    keyevent [--longpress] <key code number or name> ... (Default: keyboard)
    tap <x> <y> (Default: touchscreen)
    swipe <x1> <y1> <x2> <y2> [duration(ms)] (Default: touchscreen)
    press (Default: trackball)
    roll <dx> <dy> (Default: trackball)

好了,以上是本次所需adb的知识点。

3.  Python

(1)     调用命令行

Python调用命令行有多种方式,比较常用的是os.system(cmd)和os.popen(cmd),以及commands.getoutput(cmd),这三者主要区别在返回值的获取方面,第一个无法获得返回值,第二、三个则可以获取。这里用哪个都可以,因为不需要获得返回值。

(2)     OpenCV

主要用OpenCV做一些图片缩放等操作,用PIL也是可以的。

(3)     Tkinter

主要用到了Button、PhotoImage这两个Widget。不多说了。

程序的实现是很简单的,这里处于某些原因就不公开代码了,主要就是一个细调参数的过程。

程序截图:

使用Python制作微信跳一跳辅助

下一步的目标是,结合OpenCV和神经网络实现自动识别、计算距离。

郑重声明,本文仅供学习、娱乐只用,请勿随意传播。

来源:http://www.cnblogs.com/pleiades/p/8387934.html

标签:Python,跳一跳辅助
0
投稿

猜你喜欢

  • python双向链表原理与实现方法详解

    2021-03-06 05:29:39
  • JS实现点击li标签弹出对应的索引功能【案例】

    2024-04-17 10:24:23
  • 前淘宝前端开发工程师阿当的PPT中有JS技术理念问题

    2024-05-25 15:17:53
  • asp如何对一个文件夹进行创建和删除?

    2009-11-20 18:42:00
  • python教程网络爬虫及数据可视化原理解析

    2021-07-13 11:36:11
  • python递归&迭代方法实现链表反转

    2021-05-04 20:42:04
  • Python视频编辑库MoviePy的使用

    2022-12-22 21:07:07
  • Python数据模型与Python对象模型的相关总结

    2021-05-15 02:21:43
  • 利用Python将txt文件录入Excel表格的全过程

    2021-09-05 10:02:59
  • 磁盘垃圾文件清理器python代码实现

    2023-08-24 23:20:41
  • Python实现合成多张图片到PDF格式

    2023-02-26 04:57:25
  • python3模拟百度登录并实现百度贴吧签到示例分享(百度贴吧自动签到)

    2023-07-08 23:15:23
  • python groupby 函数 as_index详解

    2023-09-13 21:04:07
  • 对python中两种列表元素去重函数性能的比较方法

    2021-04-01 13:37:59
  • 对python列表里的字典元素去重方法详解

    2023-09-20 13:45:47
  • windows下Python安装、使用教程和Notepad++的使用教程

    2023-04-21 09:31:39
  • 详解DeBug Python神级工具PySnooper

    2022-12-14 15:44:31
  • python追加元素到列表的方法

    2023-07-08 14:29:47
  • Python3调用微信企业号API发送文本消息代码示例

    2023-05-03 16:23:41
  • Vue3 组件库的环境配置搭建过程

    2024-04-30 10:19:58
  • asp之家 网络编程 m.aspxhome.com