Sebelumnya ada yang pernah meng-install Android Terminal Emulator? jika sudah, pastinya kita sudah tau bahwa Android Terminal ini adalah aplikasi yang digunakan untuk menggunakan Android shell script, seperti command prompt pada Windows & terminal pada linux... sebelumnya Android device harus di-root & sudah ter-install busybox, karena script yang akan saya posting disini hampir kebanyakan menggunakan busybox & membutuhkan akses root.
Berikut adalah beberapa perintah untuk Android terminal emulator:
- Menghitung Aplikasi yang ter-install:
#!/system/bin/sh
TOTAL=` pm list packages | busybox wc -l `
DOWNLOADED=` pm list packages -f | busybox grep -v /system/ | busybox wc -l `
SYSTEM=$(($TOTAL - $DOWNLOADED))
echo "Total Aplikasi yang ter-install: ${TOTAL}"
echo "System Apps: ${SYSTEM}"
echo "Downloaded Apps: ${DOWNLOADED}"
- Mengecek /sdcard:
#!/system/bin/sh
if busybox [ -z "$( busybox mount | busybox grep /sdcard )" ]; then echo "sdcard sedang dipakai oleh PC." else echo "sdcard tersedia" fi
- Menonaktifkan Boot-Animation:
#!/system/bin/sh
if busybox [ -e /system/customize/resource/bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/bootanimation.zip
elif busybox [ -e /system/customize/resource/bootanimation.zip ]; then
BOOT_ANI=/system/customize/resource/VZW_bootanimation.zip
elif busybox [ -e /data/local/bootanimation.zip ]; then
BOOT_ANI=/data/local/bootanimation.zip
else
echo "Gagal untuk menemukan bootanimation.zip"
exit 1
fi
NEW_LOCATION=${BOOT_ANI%.*}.bak
busybox mount -o remount,rw /system
busybox mv -f $BOOT_ANI $NEW_LOCATION
busybox mount -o remount,ro /system
echo "Boot-Animation telah dimatikan"
- Mengaktifkan Boot-Animation:
#!/system/bin/sh
if busybox [ -e /system/customize/resource/bootanimation.bak ]; then
BOOT_ANI=/system/customize/resource/bootanimation.bak
elif busybox [ -e /system/customize/resource/bootanimation.bak ]; then
BOOT_ANI=/system/customize/resource/VZW_bootanimation.bak
elif busybox [ -e /data/local/bootanimation.bak ]; then
BOOT_ANI=/data/local/bootanimation.bak
else
echo "Gagal untuk menemukan bootanimation.zip"
exit 1
fi
NEW_LOCATION=${BOOT_ANI%.*}.zip
busybox mount -o remount,rw /system
busybox mv -f $BOOT_ANI $NEW_LOCATION
busybox mount -o remount,ro /system
echo "Boot-Animation telah diaktifkan"
- Menonaktifkan suara kamera:
#!/system/bin/sh
CAMERA_CLICK=/system/media/audio/ui/camera_click.ogg
VIDEO_RECORD=/system/media/audio/ui/VideoRecord.ogg
busybox mount -o remount,rw /system
busybox find $CAMERA_CLICK $VIDEO_RECORD -exec busybox mv -f {} {}.bak ';'
echo "Disabled camera sounds"
busybox mount -o remount,ro /system
- Mengaktifkan kembali suara kamera:
#!/system/bin/sh
CAMERA_CLICK=/system/media/audio/ui/camera_click.ogg.bak
VIDEO_RECORD=/system/media/audio/ui/VideoRecord.ogg.bak
if busybox [ -e $CAMERA_CLICK ]; then
busybox mv $CAMERA_CLICK ${CAMERA_CLICK%.*}
fi
if busybox [ -e $VIDEO_RECORD ]; then
busybox mv $VIDEO_RECORD ${VIDEO_RECORD%.*}
fi
echo "Suara kamera telah diaktifkan kembali"
- Mematikan Compcache
#!/system/bin/sh
DEV=/dev/block/ramzswap0
MODULE=/system/lib/modules/ramzswap.ko
if busybox [ ! -e $MODULE -o -z "$( busybox which rzscontrol )" ]; then
echo "Your system does not support compcache."
exit
fi
busybox swapoff $DEV >/dev/null 2>&1
busybox rmmod ramzswap.ko >/dev/null 2>&1
echo "Compressed cache talah dimatikan"
- Mengaktifkan Compcache:
#!/system/bin/sh
DEV=/dev/block/ramzswap0
MODULE=/system/lib/modules/ramzswap.ko
if busybox [ ! -e $MODULE -o -z "$( busybox which rzscontrol )" ]; then
echo "Your system does not support compcache."
exit
fi
busybox echo 3 > /proc/sys/vm/drop_caches
busybox insmod $MODULES_DIR/$MODULE
rzscontrol $DEV --init
busybox swapon $DEV
echo "Compressed cache telah diaktifkan"
- Mempercepat file system:
#!/system/bin/sh
busybox mount -o remount,noatime,barrier=0,nobh /system
busybox mount -o remount,noatime,barrier=0,nobh /data
busybox mount -o remount,noatime,barrier=0,nobh /cache
- Fix Permission:
#!/system/bin/sh
START=` busybox date +%s `
PKGLINES=`LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/lib pm list packages -f | busybox cut -d ':' -f2 `
TOTAL=` echo $PKGLINES | busybox wc -w `
CURRENT=0
echo
echo "Fixing permissions..."
echo
busybox mount -o remount,rw /system
for pkgline in ${PKGLINES}; do
PKGNAME=` echo $pkgline | busybox cut -d '=' -f2 `
CODEPATH=` echo $pkgline | busybox cut -d '=' -f1 `
DATAPATH=/data/data/$PKGNAME
PKGUID=` busybox grep $CODEPATH /data/system/packages.xml |
busybox sed 's%.*serId="\(.*\)".*%\1%' |
busybox cut -d '"' -f1 `
CURRENT=$(($CURRENT+1))
echo "(${CURRENT} of ${TOTAL}) ${PKGNAME}..."
if busybox [ -e $CODEPATH ]; then
APPDIR=` busybox dirname $CODEPATH `
if busybox [ $APPDIR = /system/app ]; then
busybox chown 0 $CODEPATH
busybox chown :0 $CODEPATH
busybox chmod 644 $CODEPATH
elif busybox [ $APPDIR = /data/app ]; then
busybox chown 1000 $CODEPATH
busybox chown :1000 $CODEPATH
busybox chmod 644 $CODEPATH
elif busybox [ $APPDIR = /data/app-private ]; then
busybox chown 1000 $CODEPATH
busybox chown :$PKGUID $CODEPATH
busybox chmod 640 $CODEPATH
fi
if busybox [ -d $DATAPATH ]; then
busybox chmod 755 $DATAPATH
busybox chown $PKGUID $DATAPATH
busybox chown :$PKGUID $DATAPATH
DIRS=` busybox find $DATAPATH -mindepth 1 -type d `
for file in $DIRS; do
PERM=755
NEWUID=$PKGUID
NEWGID=$PKGUID
FNAME=` busybox basename $file `
case $FNAME in
lib)
busybox chmod 755 $file
NEWUID=1000
NEWGID=1000
PERM=755
;;
shared_prefs)
busybox chmod 771 $file
PERM=660 ;;
databases)
busybox chmod 771 $file
PERM=660
;;
cache)
busybox chmod 771 $file
PERM=600
;;
*)
busybox chmod 771 $file
PERM=771
;;
esac
busybox chown $NEWUID $file
busybox chown :$NEWGID $file
busybox find $file -type f -maxdepth 1 ! -perm $PERM -exec busybox chmod $PERM {} ';'
busybox find $file -type f -maxdepth 1 ! -user $NEWUID -exec busybox chown $NEWUID {} ';'
busybox find $file -type f -maxdepth 1 ! -group $NEWGID -exec busybox chown :$NEWGID {} ';'
done
fi
fi
done
busybox mount -o remount,ro /system
sync
STOP=` busybox date +%s `
RUNTIME=` busybox expr $STOP - $START`
HOURS=` busybox expr $RUNTIME / 3600`
REMAINDER=` busybox expr $RUNTIME % 3600`
MINS=` busybox expr $REMAINDER / 60`
SECS=` busybox expr $REMAINDER % 60`
RUNTIME=`busybox printf "%02d:%02d:%02d\n" "$HOURS" "$MINS" "$SECS"`
echo
echo
echo "Fix permissions complete! Runtime: ${RUNTIME}"
echo
- Mount /system:
#!/system/bin/sh
WHAT_MOUNT=` mount | busybox grep system | busybox awk '{print $4}' | busybox cut -d ',' -f1 `
if busybox [ "${WHAT_MOUNT}" = "rw" ]; then
echo "System is mounted read/write"
elif busybox [ "${WHAT_MOUNT}" = "ro" ]; then
echo "System is mounted read-only"
else
echo "Error getting info"
fi
- Hot Reboot:
#!/system/bin/sh
busybox killall system_server
- Melihat Informasi CPU:
- Wipe Battery Stats:
#!/system/bin/sh
busybox rm /data/system/batterystats.bin
echo "Battery Stats dibersihkan"
- Menghapus Data Cache:
#!/system/bin/sh
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
- Zipalign Apks:
#!/system/bin/sh
if busybox [ -z "$( busybox which zipalign )" ]; then
echo "Error: zipalign binary tidak ditemukan"
exit 1
fi
START=` busybox date +%s `
CODEPATHS=` pm list packages -f | busybox cut -d ':' -f2 | busybox cut -d '=' -f1 `
TOTAL=` echo $CODEPATHS | busybox wc -w `
CURRENT=0
echo
echo "Zipaligning..."
echo
busybox mount -o remount,rw /system
for codepath in ${CODEPATHS}; do
CURRENT=$(($CURRENT+1))
echo -n "(${CURRENT} of ${TOTAL}) "
if busybox [ -e $codepath ]; then
zipalign -c 4 $codepath
ZIP_CHECK=$?
case $ZIP_CHECK in
1)
if zipalign -f 4 $codepath /data/local/pkg.apk; then
busybox cp -f /data/local/pkg.apk $codepath
busybox rm -f /data/local/pkg.apk
echo "[!] zipaligned ${codepath}"
fi
;;
*)
echo "[X] $codepath sudah zipaligned"
;;
esac
fi
done
busybox mount -o remount,ro /system
sync
STOP=` busybox date +%s `
RUNTIME=` busybox expr $STOP - $START`
HOURS=` busybox expr $RUNTIME / 3600`
REMAINDER=` busybox expr $RUNTIME % 3600`
MINS=` busybox expr $REMAINDER / 60`
SECS=` busybox expr $REMAINDER % 60`
RUNTIME=` busybox printf "%02d:%02d:%02d\n" "$HOURS" "$MINS" "$SECS" `
echo
echo "Zipalign selesai! Runtime: ${RUNTIME}"
echo
Itulah daftar perintah yang sudah saya test, Pastikan sebelum mengeksekusi perintah pastikan jalankan perintah su terlebih dahulu.
Sekian & Terima Kasih
0 komentar:
Posting Komentar