If no GNU equivalents exist, busybox applets are normally installed as symlink, e.g. /usr/bin/beep => /bin/busybox.
If GNU equivalents exist, busybox symlinked applets may still exist but with a -BB-NOTUSED suffix, making it impossible to invoke the busybox applet by just using its original name.
A few applets have equivalents in bash shell builtins or keywords (e.g. the echo command). Bash will always use its builtin utilities instead of using busybox or GNU applets (unless builtins are deactivated, but there is hardly a good reason to do that). Still busybox links are usually provided as well (e.g. /bin/echo => /bin/busybox) and the user *can* use them if he really needs to.
Above 3 possibilities should account for all applets compiled into busybox and the command "type -a appletname" should find at least one executable location for each applet. If not - and this is the reason why I created the script - the applet can not be invoked merely by its name. The command "which appletname" will produce no result and it appears as if the applet is not installed. I experienced this with the very useful strings utility. Only when checking the busybox list of all included applets I realized that it's there.
I wanted to know if more such "stealth utilities" exist.
The script lists all busybox applet names in the 2nd column and indicates in the 1st column if installed as
builtin bash builtin
keyword bash keyword
bb symlink to busybox
gnu GNU utility
script script, usually a wrapper for either bb or gnu
BBNU symlink to busybox with -BB-NOTUSED suffix
FULL GNU utility or symlink to GNU utility with -FULL suffix
----- "stealth" applet which can't be invoked merely by its name
Script execution takes a few second and outputs to leafpad. Be patient
Code: Select all
#!/bin/bash
LANG=C LF=$'\n' TB=$'\t' IFS=$LF SEP=..............
OUT="Type${TB}Applets in current $(/bin/busybox | grep -om1 '^[^(]*')
------------------------------------------"
gxmessage -fn 'bold 14' -bg forestgreen -fg white -bu '' -bo -c $'\n Please wait ... ' &
for applet in $(busybox --list); do
locations=$(type -a ${applet} ${applet}-FULL ${applet}-BB-NOTUSED 2>&1)
for item in $locations; do
unset category hint mime real path
case $item in
*[DL]:*) continue ;; #ex: "bash: type: echo-FULL: not found"
*$applet:*) category=---- #ex: "bash: type: strings: not found"
hint="${SEP:${#applet}}( \"$applet\" not in \$PATH )" ;;
*'is /'*) path=/${item#*/} #ex: "echo is /bin/echo"
real=$(realpath "$path")
mime=$(file "$real")
case $path$mime in
*-FULL* ) category=FULL ;;
*-NOTUSED*) category=BBNU ;;
*busybox* ) category=bb ;;
*script* ) category=script ;;
* ) category=gnu ;;
esac
[[ $real = $path ]] && hint=$path || hint="$path => $real"
hint="${SEP:${#applet}}$hint" ;;
*'is a'*) category=${item##* } ;; #ex: "echo is a shell builtin"
*) continue ;;
esac
OUT="${OUT}${LF}$category${TB}$applet $hint"
done
done
busybox pkill -n gxmessage
echo "$OUT" |awk 'NR<=3{v=$2;print;next} v!=$2{print ""} v=$2{print}' | leafpad &
$(busybox --list)
with
$(busybox | sed '1,/:$/d' | tr -s ' \t,' '\n')
[Update 2019-2-28]: Now also lists scripts with same name as applet, GNU utilities renamed as appletname-FULL and busybox symlinks named appletname-BB-NOTUSED. Adds "Wait" message and blank lines for better readability. Outputs to leafpad to allow search.