-
-
Save davidnunez/1404789 to your computer and use it in GitHub Desktop.
pm list packages -f |
@AndroidDeveloperLB
i was able to make the old script work.
The first thing you need to do is to get the aapt binary from this repo
note aapt2 is the newer version of appt, but it is slower in parsing the data from apk files only use aapt2 when you get errors with aapt
the repo will find android 9 and android 11 choose the closest one to the version of your android device
copy aapt to /data/local/tmp
if you plan to use adb shell
or
copy appt to data/data/com.termux/files/home
if you use termux
then
chmod -R 770 *
for termux you need to give it a special permission using adb
adb shell pm grant com.termux android.permission.DUMP
and lastly there will be three versions of the script
the first will be aapt list all apps names
the second appt list app based on permission usage
the third will be appt2 list all apps
Remember to change appt or appt2 to the path of your files (it is the second line in the script)
aapt list all apps names
#!/system/bin/sh
aapt=/data/local/tmp/aapt/aapt
pm list packages | sed 's/^package://g' | while read line; do
path=$(pm path $line | sed 's/^package://g');
label=$($aapt d badging $path | grep 'application: label=' | cut -d "'" -f2);
printf "app $label having package name $line\n";
printf "\n";
done
appt list app based on permission usage
#!/system/bin/sh
aapt=/data/local/tmp/aapt/aapt
pm list packages | sed 's/^package://g' | while read line; do [[ `dumpsys package $line | grep 'android.permission.INTERNET'` ]] && echo "$line"; done | while read line; do
path=$(pm path $line | sed 's/^package://g');
label=$($aapt d badging $path | grep 'application: label=' | cut -d "'" -f2);
printf "app $label having package name $line\n";
printf "\n";
done
appt2 list all apps
#!/system/bin/sh
aapt2=/data/local/tmp/aapt2/aapt2
pm list packages | sed 's/^package://g' | while read line; do
path=$(pm path $line | sed 's/^package://g');
label=$($aapt2 dump $path | grep -A 1 string/app_name | grep -o -m 1 '".*"' | cut -d '"' -f2);
printf "app $label having package name $line\n";
printf "\n";
done
adb shell 'pm list packages' | sed 's/.*://g'
thx worked well
What is the command that shows the list of user-installed applications on the Android Phone?
What is the command that shows the list of user-installed applications on the Android Phone?
pm list packages -3
(as in 3-rd party)
That fortunately requires root to work
(as in 3-rd party)
That fortunately requires root to work
@Anubioz Thank you for your reply. However, my phone is not rooted. I will look for an alternative solution and let you know if I find anything.
@AndroidDeveloperLB
Yes, you can run it inside termux or adb shell,
but you need to find a version of aapt compiled for arm64
the appt in my link are compiled for x86
and if you managed to run appt on android
there is even a script in the case that you want to run aapt on android provided that you have arm64 aapt. and you can filter based on permission usage
(you can remove the busybox part from the script above because they are not needed)
I found this repo that has aapt compiled for arm64