Skip to content

Commit

Permalink
3.150
Browse files Browse the repository at this point in the history
  • Loading branch information
rev1si0n committed Apr 1, 2023
1 parent a210bf1 commit 8f97acb
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 25 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
3.150
* 修改定时任务重载时的逻辑
* 修复 scapy 路由的问题
* 兼容部分小米设备
* 修复安卓11接口兼容性问题(感谢 Kate Swan)
* 支持连接 WIFI 的情况下使用 4G 作为代理
* 新增部分界面控件

3.138
* 修复 gRPC 依赖的问题
* 获取系统最后一个 toast


3.135
* 修复远程桌面加载中的问题
* 彻底修复协议中的竞争条件问题
Expand All @@ -13,7 +20,6 @@
* 远程桌面响应式布局
* 预发 next 版本


3.123
* 修复获取最近活动不全的问题

Expand Down Expand Up @@ -116,4 +122,4 @@
-----------------------
* 提高内置 ADB 性能
* openvpn 服务支持 auth 参数 (默认为 SHA1)
* 通过内置 ADB 使用 scrcpy 异常的问题
* 通过内置 ADB 使用 scrcpy 异常的问题
23 changes: 14 additions & 9 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ Directly through code point and click, it can replace most manual operations.

## Interface layout review

You can instantly review the interface layout of your Android app for writing automation code from your remote desktop, by pressing `CTRL + I` from your remote desktop to enter the mode.
Press `CTRL + R` to refresh the layout and `CTRL + I` again to exit.
You can instantly review the interface layout of your Android application for writing automation code from the remote desktop. You can enter the mode by clicking on the eye icon in the top right corner of the remote desktop.
Press `CTRL + R` to refresh the layout and click the eye icon again to exit.

![Interface layout view](image/inspect.gif)

Expand Down Expand Up @@ -533,14 +533,20 @@ curl -x http://192.168.0.2:65000 https://httpbin.org/ip
```

Custom Proxy Configuration
If you want to use a mobile network (4G/5G) as a proxy outlet, it should be noted that rmnet mobile data may not be enabled when you are connected to a WIFI network, and that WIFI is usually not enabled when you are connected to mobile data. This means that when you are connected to WIFI, the default is to go out through WIFI, and when you are disconnected from WIFI, the default is to go out through data traffic, and there is a certain mutual exclusivity between them (which may vary between system versions). So configuring the iface parameter becomes an optional option and is only provided as an additional possibility, unless you make both the rmnet and wlan NICs active yourself. The following example only changes the login user information for the default agent.
If you wish to use a mobile network (4G/5G) as a proxy outlet, it should be noted that native rmnet mobile data does not co-exist with WIFI.
LAMDA requires your Android >= 9.0 in order to use 4G mobile data as a proxy outlet while connected to WIFI.

```ini
# Append to properties.local configuration file
tunnel2.login=lamda
tunnel2.password=mypassword
# It is not recommended to configure the iface parameter unless you know what you are doing
# tunnel2.iface=wlan0
#
# There are two configurable values for iface, i.e. wlan, rmnet, when the iface value is wlan
# will automatically detect the available wlan interfaces and select any one to make the request, when iface is rmnet
# will try to enable mobile data (even if WIFI is enabled) and send the request from the mobile network interface.
# When configured as rmnet/wlan but its interface has no network, the proxy will fail.
# When not configured, requests are made using the default network.
#tunnel2.iface=rmnet
```

If you want to be able to use the device as a proxy from any location, see the `Making LAMDA connectable from any location` section.
Expand Down Expand Up @@ -881,7 +887,7 @@ Now, open the web console or a ssh/adb shell connected to your device and execut
> Some example rules
```
@reboot echo Executed when the framework is started/reloaded (reloaded)
@reboot echo Executed when the framework is started
0 */1 * * * echo Execute every hour
* * * * * echo Execute every minute
0 8 * * * echo Execute at eight o'clock every day
Expand Down Expand Up @@ -1468,9 +1474,8 @@ d.get_last_toast()

> Selector

For the interface layout review, first you need to open the device's web remote desktop. Afterwards, mouse click on the left screen to ensure that the focus falls on the cast screen (otherwise the focus may be captured by the terminal on the right).
Then press the shortcut `CTRL+I` (to start the layout view), you will no longer be able to swipe the left screen, you can click on the dotted box on the screen to see the information about the corresponding element, you can use some of its properties as parameters for the Selector.
Pressing `CTRL+I` again will close the layout view, which will not be refreshed as the page changes, it will always be the layout of the screen at the moment you press the shortcut key, if you need to refresh the layout press `CTRL+R` manually.
To view the layout of the interface, first you need to open the web remote desktop of the device. You can then click on the eye icon in the top right hand corner of the remote desktop to access it, you will no longer be able to swipe the left hand side of the screen, you can click on the dotted box on the screen to view information about the corresponding element, you can use some of these properties as parameters for the Selector.
Clicking on the eye icon again will close the layout view. The layout view will not be refreshed as the page changes, it will always be the layout of the screen at the moment you press the shortcut key, if you need to refresh the layout please press the shortcut key `CTRL+R` manually.

Normally we would only use `resourceId`, `clickable`, `text`, `description` as parameters.
If the element has a normal resourceId, it will be used as Selector in preference, i.e.: `Selector(resourceId="com.android.systemui:id/mobile_signal_single"`.
Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ MOMO (vvb2060) 是我们认为目前最强的ROOT特征检测软件,如 MOMO

## 界面布局检视

可在远程桌面即时检视安卓应用的界面布局用以编写自动化代码,在远程桌面按下 `CTRL + I` 即可进入模式
按下 `CTRL + R` 刷新布局,再次按下 `CTRL + I` 退出
可在远程桌面即时检视安卓应用的界面布局用以编写自动化代码,点击远程桌面右上角的眼睛图标即可进入模式
按下 `CTRL + R` 刷新布局,再次点击眼睛图标退出

![界面布局检视](image/inspect.gif)

Expand Down Expand Up @@ -542,15 +542,22 @@ curl -x http://192.168.0.2:65000 https://httpbin.org/ip
```

自定义代理配置
如果你想使用移动网络(4G/5G)作为代理出口,需要说明的是,在已连接 WIFI 网络的情况下,rmnet 移动数据可能并不会启用,而在连接移动数据后,WIFI 通常又不会开启。也就是说,当你连接了 WIFI,默认就是通过WIFI出网,而当你断开了 WIFI,默认就是从数据流量出网,它们之间存在一定的互斥关系(不同系统版本可能表现也不一样)。所以配置 iface 参数就变成了一个可有可无的选项,提供此配置只是为了多一种可能,除非你自行让 rmnet 以及 wlan 网卡均处于活动状态此选项才变得符合本意。以下示例仅更改了默认代理的登录用户信息。
如果你想使用移动网络(4G/5G)作为代理出口,需要说明的是,原生 rmnet 移动数据 与 WIFI 无法共存。
LAMDA 需要你的安卓 >= 9.0的才能在连接WIFI的情况下使用4G移动数据作为代理出口。

```ini
# 追加到 properties.local 配置文件
tunnel2.login=lamda
tunnel2.password=mypassword
# 不建议配置 iface 参数除非你知道自己在做什么
#tunnel2.iface=wlan0
#
# iface 存在两个可配置值,即 wlan、rmnet,当 iface 值为 wlan 时,
# 将自动检测可用 wlan 接口并选择任意一个发出请求,当 iface 为 rmnet 时
# 将尝试启用移动数据(即使 WIFI 已开启),并将请求从移动网络接口发出。
# 当配置为 rmnet/wlan 但其接口无网络时,代理将失效。
# 当未配置时,使用默认网络发出请求。
#tunnel2.iface=rmnet
```

如果希望从任何地点都可使用设备作为代理,请查看 `使 LAMDA 可被任意地点连接` 章节。

## 连接设备
Expand Down Expand Up @@ -889,7 +896,7 @@ print (res.status_code, res.json()["result"])
> 一些规则示例
```
@reboot echo 框架启动/重载(reload)时执行
@reboot echo 框架启动时执行
0 */1 * * * echo 每一小时执行
* * * * * echo 每一分钟执行
0 8 * * * echo 每天八点执行
Expand Down Expand Up @@ -1477,9 +1484,8 @@ d.get_last_toast()

> Selector

界面布局检视,首先你需要打开设备的 web 远程桌面。随后,鼠标点击左侧屏幕确保焦点落在投屏上(否则焦点可能会被右侧的终端捕获),
然后按下快捷键 `CTRL+I`(启动布局检视),此时你将不能再滑动左侧屏幕,你可以点击屏幕上的虚线框来查看对应元素的信息,你可以将其中的部分属性作为 Selector 的参数。
再次按下 `CTRL+I` 将关闭布局检视,布局检视并不会随着页面的改变而刷新,它始终是你按下快捷键那一刻的屏幕布局,如果需要刷新布局请手动按下快捷键 `CTRL+R`
界面布局检视,首先你需要打开设备的 web 远程桌面。随后,点击远程桌面右上角的眼睛图标进入,此时你将不能再滑动左侧屏幕,你可以点击屏幕上的虚线框来查看对应元素的信息,你可以将其中的部分属性作为 Selector 的参数。
再次点击眼睛图标将关闭布局检视,布局检视并不会随着页面的改变而刷新,它始终是你按下快捷键那一刻的屏幕布局,如果需要刷新布局请手动按下快捷键 `CTRL+R`

正常情况下,我们只会使用 `resourceId`, `clickable`, `text`, `description` 作为参数。
如果元素存在正常的 resourceId,优先使用其作为 Selector,即:`Selector(resourceId="com.android.systemui:id/mobile_signal_single")`
Expand Down
2 changes: 1 addition & 1 deletion lamda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#
# Distributed under MIT license.
# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
__version__ = "3.138"
__version__ = "3.150"
19 changes: 16 additions & 3 deletions lamda/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def load_proto(name):


def to_dict(prot):
""" 将 proto 返回值转换为字典 """
r = MessageToJson(prot, preserving_proto_field_name=True)
return json.loads(r)

Expand Down Expand Up @@ -1008,7 +1009,7 @@ def get_last_activities(self, count=3):
return list(map(to_dict, r))
def start_activity(self, **activity):
"""
启动 activity(任意, always return true
启动 activity(总是返回 True
"""
activity.setdefault("extras", {})
extras = activity.pop("extras")
Expand Down Expand Up @@ -1148,7 +1149,7 @@ def is_ida64_running(self):
return r.value
def start_android_debug_bridge(self):
"""
启动 adbd (默认随框架启动)
启动内置 adbd (默认随框架启动)
"""
r = self.stub.startAndroidDebugBridge(protos.Empty())
return r.value
Expand All @@ -1170,7 +1171,7 @@ def start_ida64(self, port=23964, **env):
return r.value
def stop_android_debug_bridge(self):
"""
停止 adb daemon (有可能无效)
停止内置 adb daemon
"""
r = self.stub.stopAndroidDebugBridge(protos.Empty())
return r.value
Expand Down Expand Up @@ -1438,22 +1439,34 @@ def _fd_streaming_recv(self, fd, iterator):
for chunk in iterator:
fd.write(chunk.payload)
def download_fd(self, fpath, fd):
"""
从设备下载文件到文件描述符
"""
req = protos.FileRequest(path=fpath)
iterator = self.stub.downloadFile(req)
self._fd_streaming_recv(fd, iterator)
st = self.file_stat(fpath)
return st
def upload_fd(self, fd, dest):
"""
上传文件描述符至设备
"""
chunksize = 1024*1024*1
streaming = self._fd_streaming_send(fd, dest,
chunksize)
self.stub.uploadFile(streaming)
st = self.file_stat(dest)
return st
def download_file(self, fpath, dest):
"""
从设备下载文件到本地
"""
with io.open(dest, mode="wb") as fd:
return self.download_fd(fpath, fd)
def upload_file(self, fpath, dest):
"""
上传本地文件至设备
"""
with io.open(fpath, mode="rb") as fd:
return self.upload_fd(fd, dest)
def delete_file(self, fpath):
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
classifiers = [
"Environment :: Console",
"Intended Audience :: Developers",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
Expand Down

0 comments on commit 8f97acb

Please sign in to comment.