云手机渗透专题-云手机套件介绍与环境搭建
简介
云手机作为测试常用的一种套件,被非常多的移动测试的同学喜欢。其中比较知名的组件位uiautomator2、Appium等等。该套件主要帮助移动测试的同学自动化测试APP,常见于公司内网环境,有时候互联网中可能也存在一些入口。一些知名企业也会基于这类套件二次开发自己自动化测试应用。
了解云手机相关套件
云手机套件按照不同功能分类,主要分为4类,UI自动化测试、APP稳定性测试、APP性能测试、APP抓包工具。我在渗透云手机时最关注UI自动化测试,因为UI自动化测试工具可能会有RCE,能够作为跳板机使用或者收集到更多有用信息。UI自动化测试相关工具如下:
UI自动化测试
环境搭建
我搭建一套测试环境为了方便之后的漏洞演示与分析。如果你没有安卓测试机,也可以使用安卓模拟器一起搭建环境。搭建环境需要准备的应用如下:
- Win10操作系统的笔记本电脑
- genymotion-3.3.3-vbox.exe
- Oracle VM VirtualBox(安装Win10系统)[靶机]
- Git-2.40.0-64-bit.exe
- Anaconda3-2023.03-Windows-x86_64.exe
- tabby-1.0.196-setup-x64.exe
- platform-tools_r34.0.1-windows(ADB)
- Oracle VM VirtualBox(安装kali系统)[靶机]
请注意在使用"genymotion-3.3.3-vbox"时会安装"Oracle VM VirtualBox",需要卸载Win内所有虚拟机(vmware\Hyper-V)等。
先不细讲软件的安装过程了,安装完成后如下图:

Win10搭建WEditor+uiautomator2
uiautomator2作为常见套件。我临时使用WEditor+uiautomator2搭建测试环境,先将安卓模拟机链接上adb,ip是我安卓模拟器的地址。
C:\Users\user\Desktop>adb.exe connect 192.168.47.102
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 192.168.47.102:5555
然后在执行安装uiautomator2。
C:\Users\user\Desktop>python -m pip install -U uiautomator2
Defaulting to user installation because normal site-packages is not writeable
Collecting uiautomator2
...
Successfully installed Deprecated-1.2.13 adbutils-1.2.9 apkutils2-1.0.0 cached-property-1.5.2 cigam-0.0.3 deprecation-2.1.0 logzero-1.7.0 packaging-20.9 progress-1.6 pyelftools-0.29 retry-0.9.2 uiautomator2-2.16.23 whichcraft-0.6.1 xmltodict-0.13.0
紧接着,执行初始化操作。
C:\Users\user\Desktop>python -m uiautomator2 init
[I 230423 21:24:53 init:156] uiautomator2 version: 2.16.23
[I 230423 21:24:53 init:373] Install minicap, minitouch
...
Successfully init AdbDevice(serial=192.168.47.102:5555)
切换到安卓模拟器发现多了atx图标则安装uiautomator2成功。

我需要安装WEditor,用来通过WebUI能够访问到调试工具。
C:\Users\user\Desktop\web-editor>python -m pip install -U weditor
Collecting weditor
...
Successfully installed facebook-wda-1.4.6 weditor-0.6.8
C:\Users\user\Desktop\web-editor>python -m weditor --shortcut
Shortcut created. C:\Users\user\Desktop\WEditor.lnk
打开WEditor.lnk,会弹出浏览器,到此咱们Win系统移动测试环境搭建好了。

使用WEditor连接上手机,咱们已经具备测试环境。
