adb shell加载termux环境

Let adb shell use termux command

通常我们调试应用的时候喜欢使用debug版rom不仅拥有root权限而且附带许多调试工具如curl、sqlite等,但是某些情况下我们可能不得不选择release版rom来调试由于该版本的特性会缺少很多调试工具使得用起来十分不顺手,因此本文介绍一下如何通过Magisk和termux来增强adb shell的使用体验。

1. Unlock root/解锁Root权限

本篇文章以Magisk Root为例,但该部分不是本文重点请自行搜索对应机型的安装方法。

另外提一下其他root软件没有经过测试也许有用。

2. Install termux terminal/安装Termux终端

https://f-droid.org/en/packages/com.termux/

3. Let’s work/adb shell加载termux环境

1
2
3
adb shell
su -c "sed -i 's/\\(com\\.termux [0-9][0-9]* \\)0/\\11/' /data/system/packages.list"
run-as com.termux files/usr/bin/bash -c 'export PATH=/data/data/com.termux/files/usr/bin:$PATH; export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so; bash -i'

image-20240206144911168

4. Let’s be lazy/再懒一些使用tsh脚本

tsh脚本push到/data/local/tmp目录,进入到adb shell中执行/data/local/tmp/tsh脚本,在进入termux terminal终端的同时会将tsh命令符号链接到/system/bin目录这样直到设备重启前输入tsh即可使用。

Reference|引用资料

1.https://gist.github.com/rewida17/f8564bee5a196a8f51b98cd2e53813e4

2.https://android.stackexchange.com/questions/225260/termux-running-termux-via-adb-without-any-direct-interaction-with-the-device

3.https://github.com/termux/termux-app/issues/77

Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2015-2024 Kaisar
  • Visitors: | Views:

请我喝杯咖啡吧~

支付宝
微信