首页 > 编程 > Python > 正文

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

2020-02-22 23:04:03
字体:
来源:转载
供稿:网友

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/deviceadb devicesIn response, return serial number and statee4b25377    deviceemulator-5554 device

(2)    adb shell screencap截屏

taking a screenshot of a device display.adb shell screencap <filename>adb shell screencap /sdcard/screen.pngdownload 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)             
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表