文章目录
adb shell能够做什么mksh其他shell android基础指令集toyboxbusybox_toybox加强指令集android版windows版 常用指令set1:set2 toybox&busybox指令集(二进制程序)所在目录设置无操作后息屏时间adb shell能够做什么
mksh
和指令集不同,shell可以调用不同的指令集但是shell作为用户命令行解释器,本身又是一个可执行文件 比如bash/zsh/ksh/mksh adb shell所用的shell一般指mksh(android12试验)1|xaga:/system/xbin $ sh -v# Copyright (c) , , , # Thorsten Glaser <tg@># This file is provided under the same terms as mksh.#-# Minimal /system/etc/mkshrc for Android## Support: /mkshset +o nohupif (( USER_ID )); then PS1='$'; else PS1='#'; fiPS4='[$EPOCHREALTIME] '; PS1='${|local e=$?(( e )) && REPLY+="$e|"return $e}$HOSTNAME:${PWD:-?} '"$PS1 "
其他shell
在android(ARM)架构,有zsh for arm可以选用,您可以使用magisk刷入
localhost# zsh -hlocalhost# zsh -v# /etc/zsh/zshenv: system-wide .zshenv file for zsh(1).## This file is sourced on all invocations of the shell.# If the -f flag is present or if the NO_RCS option is# set within this file, all other initialization files# are skipped.## This file should contain commands to set the command# search path, plus other important environment variables.# This file should not contain commands that produce# output or assume the shell is attached to a tty.## Global Order: zshenv, zprofile, zshrc, zloginexport USER=$([[ "$(print -P "%#")" == '#' ]] && print 'root' || print 'system')export HOME=/data/local/${USER}export ANDROID_ROOT=/system
android基础指令集
toybox
toybox --help
xaga:/data/adb/busybox # toybox --helpToybox 0.8.4-android multicall binary: /toybox (see toybox --help)usage: toybox [--long | --help | --version | [COMMAND] [ARGUMENTS...]]With no arguments, "toybox" shows available COMMAND names. Add --longto include suggested install path for each command, see/toybox/faq.html#install for details.First argument is name of a COMMAND to run, followed by any ARGUMENTSto that command. Most toybox commands also understand:--helpShow command help (only)--version Show toybox version (only)The filename "-" means stdin/stdout, and "--" stops argument parsing.Numerical arguments accept a single letter suffix forkilo, mega, giga, tera, peta, and exabytes, plus an additional"d" to indicate decimal 1000's instead of 1024.Durations can be decimal fractions and accept minute ("m"), hour ("h"),or day ("d") suffixes (so 0.1m = 6s).xaga:/data/adb/busybox #
130|xaga:/system/bin $ ls -al|nl|tail -n 20440 -rwxr-xr-x 1 root shell33 -01-01 08:00 wm441 lrwxrwxrwx 1 root root 6 -10-08 15:33 xargs -> toybox442 -rwxr-xr-x 1 root shell128 -01-01 08:00 xml2abx443 lrwxrwxrwx 1 root root 6 -10-08 15:33 xxd -> toybox444 lrwxrwxrwx 1 root root 6 -10-08 15:33 yes -> toybox445 lrwxrwxrwx 1 root root 6 -10-08 15:33 zcat -> toybox446 -rwxr-xr-x 1 root shell 65720 -01-01 08:00 zip_utils447 lrwxrwxrwx 1 root root 7 -10-08 15:33 zipinfo -> ziptool448 -rwxr-xr-x 1 root shell 28712 -01-01 08:00 ziptool
大概有400+多命令的二进制文件
比如大名鼎鼎的svc,可以用来调试NFC/蓝牙等外围设备
xaga:/system/bin $ svc -hAvailable commands:help Show information about the subcommandspower Control the power managerusb Control Usb statenfc Control NFC functionsbluetooth Control Bluetooth servicesystem-server System server process related commandxaga:/system/bin $ svc nfc -hControl NFC functionsusage: svc nfc [enable|disable]Turn NFC on or off.
busybox_toybox加强指令集
BusyBox官网android版
高版本android可以通过magisk 刷入busybox模块(需要一定时间几十秒到1分钟左右甚至更长时间)查看busybox BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as.1|xaga:/data/adb/busybox # ls -al /system/xbin/busybox-rwxrwxrwx 1 root root 2087000 -10-08 15:30 /system/xbin/busybox
127|xaga:/data/adb/busybox # busybox --helpBusyBox v1.34.1-osm0sis (-10-02 04:33:49 ADT) multi-call binary.BusyBox is copyrighted by many authors between 1998-.Licensed under GPLv2. See source distribution for detailedcopyright notices.Usage: busybox [function [arguments]...]or: busybox --list[-full]or: busybox --show SCRIPTor: busybox --install [-s] [DIR]or: function [arguments]...BusyBox is a multi-call binary that combines many common Unixutilities into a single executable. Most people will create alink to busybox for each function they wish to use and BusyBoxwill act like whatever it was invoked as.Currently defined functions:[, [[, acpid, adjtimex, ar, arch, arp, arping, ascii, ash, awk, base32, base64, basename, bbconfig,beep, blkdiscard, blkid, blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, chat, chattr, chcon,chgrp, chmod, chown, chroot, chrt, chvt, cksum, clear, cmp, comm, conspy, cp, cpio, crc32, crond,...............................................tc, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute,traceroute6, true, truncate, ts, tty, ttysize, tunctl, tune2fs, ubiattach, ubidetach, ubimkvol,ubirename, ubirmvol, ubirsvol, ubiupdatevol, udhcpc, udhcpc6, udhcpd, udpsvd, uevent, umount, uname,uncompress, unexpand, uniq, unix2dos, unlink, unlzma, unlzop, unshare, unxz, unzip, uptime, usleep,uudecode, uuencode, vconfig, vi, volname, watch, watchdog, wc, wget, which, whoami, whois, xargs,xxd, xz, xzcat, yes, zcat, zcip
windows版
可以通过scoop来安装,也可以直接使用官网的二进制文件PS D:\repos\blogs\neep> busybox.exeBusyBox v1.36.0-FRP-4621-gf3c5e8bc3 (-02-28 07:17:58 GMT)(mingw64-gcc 11.2.1-3.fc35; mingw64-crt 9.0.0-2.fc35; glob)BusyBox is copyrighted by many authors between 1998-.Licensed under GPLv2. See source distribution for detailedcopyright notices.Usage: busybox [function [arguments]...]or: busybox --list[-full]or: busybox --install [-s] [-u|DIR]or: busybox --uninstall [-n] fileor: function [arguments]...
常用指令
set1:
ADB Shell - Android ADB Commands Manualset2
发出 adb 命令 调用 activity 管理器 (am
)调用软件包管理器 (pm)调用设备政策管理器 (dpm)截取屏幕截图录制视频读取应用的 ART 配置文件重置测试设备sqlite 将命令发送至特定设备安装应用设置端口转发将文件复制到设备/从设备复制文件停止 adb 服务器toybox&busybox指令集(二进制程序)所在目录
xaga:/data/adb/busybox # type busyboxbusybox is /system/xbin/busybox
xaga:/data/adb/busybox # type toyboxtoybox is /system/bin/toybox
设置无操作后息屏时间
adb shell settings put system screen_off_timeout 600000
60 ∗ 10 ∗ 1000 m s = 600 s = 10 m i n 60*10*1000ms=600s=10min 60∗10∗1000ms=600s=10min有效值应该在5000(ms)以上否则无效