Last active
July 3, 2022 17:12
-
-
Save Fire7ly/c2f363a391f70bebadbdd0fe6ad75800 to your computer and use it in GitHub Desktop.
A Package Manager Script, To find system, 3rd Party, Enable, Disable Packages With Their Installed Directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
# A Package Finder Script Made By @fire7ly With The Help Of Google Adb Binary Tool, Part Of Android Sdk Tools And The Help Of Inbuild Android Package Manager | |
# System Which Allow Us to Know Package Name And Directory Where Is App Installed On It, Also Tell Us About Enable Packages, Disable Packages, Third Party Packages | |
# And Directory Of All Of Them So, This Is Script Made For Automation Of Those Task In Simple Way Without Hassale Of Commands, | |
# Just Pass An Argument With It And It Will Do That Work For You As Well As Save That Output In A Text File For Future Usage, If You Like To Check Them Later, See Yaa!! | |
#Env Ver | |
ver=V1.0 | |
app=findpkg | |
ldir=$PWD/$app | |
# Clear My Screen | |
clear | |
# Banner | |
echo "|--------------------------------------------------|" | |
echo "| Packages Name Finder $ver Script |" | |
echo "| Made With ❤️ By @Fire7ly |" | |
echo "|--------------------------------------------------|\n" | |
#Display usage if no argument passed by user | |
echoUsage () { | |
echo ".^-^.\n\n$app : You can pass arguments with it =>\n | |
[AP] : Check for all Packages | |
[SP] : Check For All System Packages | |
[TP] : Check For 3rd Party Packages | |
[DP] : Check For All Disable Packages | |
[EP] : Check For All Enable Packages | |
[SE] : Check For All System Enable Packages | |
[SD] : Check For All System Disable Packages | |
[TE] : Check For 3rd Party Enable Packages | |
[TD] : Check For 3rd Party Disable Packages | |
[APD] : Check For All Packages With Installed Directory | |
[SPD] : Check For All system Packages With Installed Directory | |
[TPD] : Check For All 3rd Party Packages With Installed Directory | |
[DPD] : Check For All Disable Packages With Installed Directory | |
[EPD] : Check For All Enable Packages With Installed Directory | |
[SED] : Check For All System Enable Packages With Installed Directory | |
[SDD] : Check For All System Disable Packages With Installed Directory | |
[TED] : Check For 3rd Party Enable Packages With Installed Directory | |
[TDD] : Check For 3rd Party Disable Packages With Installed Directory | |
" | |
exit 1 | |
} | |
# If user Pass 2 Arguments | |
pkg () { | |
echo "===============================================================================" | |
echo "$statement" | |
echo "===============================================================================\n" | |
adb shell pm list packages $arg1 $arg2 $arg3 | cut -f 2 -d ":" | |
} | |
# find adb present or not | |
fadb () { | |
if which adb 2>&1 >/dev/null ; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
} | |
# Check adb state | |
adb_check () { | |
state=$(adb devices | awk '{ print $2 }' | grep device ) | |
if [ "$state" = device ]; then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
# If log Directory not present then make log directory | |
if ( adb_check ); then | |
if [ -d $ldir ]; then | |
echo "🔥 : ARE YOU SURE YOUR DEVICE IS CONNECTED\n" | |
#rm -rf $ldir && mkdir -p $ldir | |
else | |
mkdir -p $ldir | |
fi | |
fi | |
#Switch Case To Find Arguments | |
input () { | |
if [ ! -z $@ ]; then | |
for arg in "$@"; do | |
case $arg in | |
"AP") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all packages from your device:") | |
pkg | |
;; | |
"SP") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all system packages from your device:") | |
arg1="-s" | |
pkg | |
;; | |
"TP") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all 3rd party packages from your device:") | |
arg1="-3" | |
pkg | |
;; | |
"DP") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all disabled packages from your device:") | |
arg1="-d" | |
pkg | |
;; | |
"EP") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all enable packages from your device:") | |
arg1="-e" | |
pkg | |
;; | |
"APD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all packages with installed directory from your device:") | |
arg1="-f" | |
pkg | |
;; | |
"SPD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all system packages with installed directory from your device:") | |
arg1="-s" | |
arg2="-f" | |
pkg | |
;; | |
"TPD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all 3rd party packages with installed directory from your device:") | |
arg1="-3" | |
arg2="-f" | |
pkg | |
;; | |
"DPD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all disabled packages with installed directory from your device:") | |
arg1="-d" | |
arg2="-f" | |
pkg | |
;; | |
"EPD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all enable packages with installed directory from your device:") | |
arg1="-e" | |
arg2="-f" | |
pkg | |
;; | |
"SED") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all system enable packages with installed directory from your device:") | |
arg1="-e" | |
arg2="-f" | |
arg3="-s" | |
pkg | |
;; | |
"SDD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all system disable packages with installed directory from your device:") | |
arg1="-d" | |
arg2="-f" | |
arg3="-s" | |
pkg | |
;; | |
"TED") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all 3rd party enable packages with installed directory from your device:") | |
arg1="-e" | |
arg2="-f" | |
arg3="-3" | |
pkg | |
;; | |
"TDD") | |
echo "$app: Custom argument detected:" $arg "\n" | |
statement=$(echo "$app: Fetching all 3rd party disable packages with installed directory from your device:") | |
arg1="-d" | |
arg2="-f" | |
arg3="-3" | |
pkg | |
;; | |
*) | |
Usage | |
;; | |
esac | |
done | |
else | |
echoUsage | |
fi | |
} | |
#Main function to run this script. | |
mainProc () { | |
if ( fadb ); then | |
if ( adb_check ); then | |
echo "$app: Initiating procedure...\n" | |
input $1 | tee $ldir/$1.txt #I know tee have ability to overwriting file untill you define "-a" to append on last created file. | |
else | |
echo "🔥 : ARE YOU SURE YOUR DEVICE IS CONNECTED\n" | |
echoUsage | |
fi | |
else | |
echo "Please install adb and try again\n" | |
exit | |
fi | |
# Tell About Log Directory | |
echo "\nLogs Are Saved Here : $ldir/log.txt\n" | |
} | |
mainProc $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment