|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
REPORT_FILE="${CWD}/NanoDroid_Report_${VERSION}"
|
|
|
|
|
|
|
|
create_report_real () {
|
|
|
|
|
|
|
|
case ${VERSION} in
|
|
|
|
*99999999* ) ND_TYPE="Beta Release" ;;
|
|
|
|
* ) ND_TYPE="Stable Release" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
rm -f "${REPORT_FILE}"*
|
|
|
|
|
|
|
|
echo "creating NanoDroid report:
|
|
|
|
|
|
|
|
| NanoDroid Version: ${VERSION}
|
|
|
|
| NanoDroid Type: ${ND_TYPE}
|
|
|
|
| NanoDroid Report: $(basename ${REPORT_FILE})
|
|
|
|
"
|
|
|
|
|
|
|
|
echo "NanoDroid ${VERSION} package report [$(date +%Y%m%d-%H.%M.%S)]
|
|
|
|
==========================================================
|
|
|
|
" > ${REPORT_FILE}
|
|
|
|
|
|
|
|
for file in $(find ${CWD} -type f | sort); do
|
|
|
|
case ${file} in
|
|
|
|
*.apk.gz ) get_apk_info ${file} ;;
|
|
|
|
*.so* ) get_lib_info ${file} ;;
|
|
|
|
*xbin* ) get_bin_info ${file} ;;
|
|
|
|
*tools* ) get_bin_info ${file} ;;
|
|
|
|
*etc* ) get_etc_info ${file} ;;
|
|
|
|
*.dex* ) get_dex_info ${file} ;;
|
|
|
|
* ) get_msc_info ${file} ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
sum_sign_package "${REPORT_FILE}"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
create_report () {
|
|
|
|
create_report_real &
|
|
|
|
progress $!
|
|
|
|
}
|
|
|
|
|
|
|
|
get_apk_info () {
|
|
|
|
|
|
|
|
APK=${CWD}/_report.apk
|
|
|
|
|
|
|
|
gzip -dc ${1} > ${APK}
|
|
|
|
|
|
|
|
APK_FILE=$(basename ${1})
|
|
|
|
APK_PATH=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
|
|
|
|
APK_NAME=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^package: name/{print $2}')
|
|
|
|
APK_VERSION=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^package: name/{print $6}')
|
|
|
|
APK_CODE=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^package: name/{print $4}')
|
|
|
|
APK_PERM=$(aapt dump badging ${APK} 2>/dev/null | gawk -F \' '/^uses-permission:/{print $2}' | sort)
|
|
|
|
APK_SHA=$(sha256sum ${APK} | gawk '{print $1}')
|
|
|
|
GZIP_SHA=$(sha256sum ${1} | gawk '{print $1}')
|
|
|
|
|
|
|
|
case ${1} in
|
|
|
|
*gsync/K* ) APK_TYPE="Google Sync Adapters [KitKat]" ;;
|
|
|
|
*gsync/L* ) APK_TYPE="Google Sync Adapters [Lolipop]" ;;
|
|
|
|
*gsync/M* ) APK_TYPE="Google Sync Adapters [Marshmallow]" ;;
|
|
|
|
*gsync/N* ) APK_TYPE="Google Sync Adapters [Nougat]" ;;
|
|
|
|
*gsync/O* ) APK_TYPE="Google Sync Adapters [Oreo]" ;;
|
|
|
|
*gsync/P* ) APK_TYPE="Google Sync Adapters [Pie]" ;;
|
|
|
|
*gsync/common*) APK_TYPE="Google Sync Adatpers [Generic]" ;;
|
|
|
|
*priv-app*) APK_TYPE="Privileged Application" ;;
|
|
|
|
*app* ) APK_TYPE="Generic Application" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo "Android Package: ${APK_NAME}
|
|
|
|
| Filename: ${APK_FILE}
|
|
|
|
| Origin: ${APK_PATH}
|
|
|
|
| Type: ${APK_TYPE}
|
|
|
|
| Version: ${APK_VERSION}
|
|
|
|
| VersionCode: ${APK_CODE}
|
|
|
|
| SHA256 APK: ${APK_SHA}
|
|
|
|
| SHA256 GZip: ${GZIP_SHA}" >> ${REPORT_FILE}
|
|
|
|
|
|
|
|
if [ -z "${APK_PERM}" ]; then
|
|
|
|
echo -e " | Permissions: none requested\n" >> ${REPORT_FILE}
|
|
|
|
else echo -e " | Permissions:\n$(printf "\t|- %s\n" ${APK_PERM})\n" >> ${REPORT_FILE}
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f ${APK}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
get_lib_info () {
|
|
|
|
|
|
|
|
LIB_FILE=$(basename ${1})
|
|
|
|
LIB_PATH=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
|
|
|
|
|
|
|
|
case ${LIB_FILE} in
|
|
|
|
*libjni_latinimegoogle* ) LIB_NAME="Latin IME Google" ;;
|
|
|
|
*libjni_keyboarddecoder*) LIB_NAME="Keyboard Decoder" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${1} in
|
|
|
|
*19* ) LIB_CODE="19 [KitKat]" ;;
|
|
|
|
*21* ) LIB_CODE="21 [Lollipop]" ;;
|
|
|
|
*22* ) LIB_CODE="22 [Lollipop]" ;;
|
|
|
|
*23* ) LIB_CODE="23 [Marshmallow]" ;;
|
|
|
|
*24* ) LIB_CODE="23 [Nougat] {24}" ;;
|
|
|
|
*25* ) LIB_CODE="23 [Nougat] {25}" ;;
|
|
|
|
*26* ) LIB_CODE="26 [Oreo] {26}" ;;
|
|
|
|
*27* ) LIB_CODE="27 [Oreo]" ;;
|
|
|
|
*28* ) LIB_CODE="28 [Pie]" ;;
|
|
|
|
* ) LIB_CODE="Generic" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
LIB_ARCH=$(file -b ${1} | gawk -F, '{print $2 " [ " $1 " ] [" $3 " ]"}')
|
|
|
|
LIB_SPECS=$(file -b ${1} | gawk -F, '{print $4 " [" $5 " ]"}')
|
|
|
|
|
|
|
|
LIB_SHA=$(sha256sum ${1} | gawk '{print $1}')
|
|
|
|
|
|
|
|
echo "Android Library: ${LIB_NAME}
|
|
|
|
| Filename: ${LIB_FILE}
|
|
|
|
| Origin: ${LIB_PATH}
|
|
|
|
| SDK Code: ${LIB_CODE}
|
|
|
|
| Arch: ${LIB_ARCH}
|
|
|
|
| Specifics: ${LIB_SPECS}
|
|
|
|
| SHA256: ${LIB_SHA}
|
|
|
|
" >> ${REPORT_FILE}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
get_bin_info () {
|
|
|
|
|
|
|
|
BIN_FILE=$(basename ${1})
|
|
|
|
BIN_NAME=$(basename ${1} | sed -e 's/\..*//')
|
|
|
|
BIN_PATH=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
|
|
|
|
|
|
|
|
case ${BIN_PATH} in
|
|
|
|
*xbin* ) BIN_TYPE="Android User Utility" ;;
|
|
|
|
*tools*) BIN_TYPE="Android Installer Utility" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
BIN_ARCH=$(file -b ${1} | gawk -F, '{print $2 " [ " $1 " ] [" $3 " ]"}')
|
|
|
|
BIN_SPECS=$(file -b ${1} | gawk -F, '{print $4 " [" $7 " ] [" $6 " ]"}')
|
|
|
|
|
|
|
|
BIN_SHA=$(sha256sum ${1} | gawk '{print $1}')
|
|
|
|
|
|
|
|
echo "${BIN_TYPE}: ${BIN_NAME}
|
|
|
|
| Filename: ${BIN_FILE}
|
|
|
|
| Origin: ${BIN_PATH}
|
|
|
|
| Arch: ${BIN_ARCH}
|
|
|
|
| Specifics: ${BIN_SPECS}
|
|
|
|
| SHA256: ${BIN_SHA}
|
|
|
|
" >> ${REPORT_FILE}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
get_etc_info () {
|
|
|
|
|
|
|
|
ETC_FILE=$(basename ${1})
|
|
|
|
ETC_PATH=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
|
|
|
|
|
|
|
|
ETC_PKGS=""
|
|
|
|
|
|
|
|
case ${ETC_PATH} in
|
|
|
|
*gsync*default-permissions* ) ETC_TYPE="Google Sync Adapaters Permissions"
|
|
|
|
ETC_PKGS="$(gawk -F\" '/package=/{print $2}' ${1})" ;;
|
|
|
|
*etc/permissions* ) ETC_TYPE="Application Permissions"
|
|
|
|
ETC_PKGS="$(gawk -F\" '/package=/{print $2}' ${1})" ;;
|
|
|
|
*etc/default-permissions* ) ETC_TYPE="Application Permissions"
|
|
|
|
ETC_PKGS="$(gawk -F\" '/package=/{print $2}' ${1})" ;;
|
|
|
|
*etc/terminfo* ) ETC_TYPE="GNU Nano Terminfo" ;;
|
|
|
|
*etc/init.d* ) ETC_TYPE="NanoDroid init Script" ;;
|
|
|
|
*etc/sysconfig* ) ETC_TYPE="Linux sysconfig Settings" ;;
|
|
|
|
*etc/bash* ) ETC_TYPE="GNU Bash Configuration" ;;
|
|
|
|
*etc/org.fdroid.fdroid* ) ETC_TYPE="F-Droid Configuration" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
ETC_SHA=$(sha256sum ${1} | gawk '{print $1}')
|
|
|
|
|
|
|
|
echo "${ETC_TYPE}: ${ETC_FILE}
|
|
|
|
| Filename: ${ETC_FILE}
|
|
|
|
| Origin: ${ETC_PATH}
|
|
|
|
| SHA256: ${ETC_SHA}" >> ${REPORT_FILE}
|
|
|
|
|
|
|
|
if [ ! -z "${ETC_PKGS}" ]; then
|
|
|
|
echo -e " | Packages:\n$(printf "\t|- %s\n" ${ETC_PKGS})\n" >> ${REPORT_FILE}
|
|
|
|
else echo "" >> ${REPORT_FILE}
|
|
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
get_dex_info () {
|
|
|
|
|
|
|
|
DEX_FILE=$(basename ${1})
|
|
|
|
DEX_PATH=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
|
|
|
|
|
|
|
|
case ${DEX_FILE} in
|
|
|
|
*services* ) DEX_TYPE="Android DEX Patch File"
|
|
|
|
DEX_NAME=$(basename ${1} .jar.dex) ;;
|
|
|
|
* ) DEX_TYPE="Android Dalvik Executable"
|
|
|
|
DEX_NAME=$(basename ${1} .dex) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${DEX_FILE} in
|
|
|
|
*services* ) DEX_SDK=$(gawk -F\_ '{print $2}' <(echo ${DEX_FILE})) ;;
|
|
|
|
*smali* ) DEX_SDK=$(sed 's/.*_\(.*\)\..*/\1/' <(echo ${DEX_FILE})) ;;
|
|
|
|
* ) DEX_SDK="universal" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
DEX_VER=$(file -b ${1} | gawk '{print $5}')
|
|
|
|
DEX_SHA=$(sha256sum ${1} | gawk '{print $1}')
|
|
|
|
|
|
|
|
echo "${DEX_TYPE}: ${DEX_NAME}
|
|
|
|
| Filename: ${DEX_FILE}
|
|
|
|
| Origin: ${DEX_PATH}
|
|
|
|
| DEX Version: ${DEX_VER}
|
|
|
|
| DEX SDK: ${DEX_SDK}
|
|
|
|
| SHA256: ${DEX_SHA}
|
|
|
|
" >> ${REPORT_FILE}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
get_msc_info () {
|
|
|
|
|
|
|
|
case ${1} in
|
|
|
|
*CommonAddon* ) MSC_TYPE="NanoDroid universal addon.d" ;;
|
|
|
|
*CommonInstaller* ) MSC_TYPE="NanoDroid universal Installer" ;;
|
|
|
|
|
|
|
|
*service.sh* ) MSC_TYPE="NanoDroid universal Magisk Module services.sh" ;;
|
|
|
|
|
|
|
|
*CommonPatcher* ) MSC_TYPE="NanoDroid Framework Patcher" ;;
|
|
|
|
*70-nanodroidpatcher.sh* ) MSC_TYPE="NanoDroid Framework Patcher addon.d" ;;
|
|
|
|
*org.spoofing.apk*) MSC_TYPE="NanoDroid Framework Patcher spoofing info provider" ;;
|
|
|
|
*patcher*update* ) MSC_TYPE="NanoDroid Framework Patcher TWRP invoker" ;;
|
|
|
|
|
|
|
|
*SysTest* ) MSC_TYPE="NanoDroid System Tester" ;;
|
|
|
|
*systest*update* ) MSC_TYPE="NanoDroid System Tester TWRP invoker" ;;
|
|
|
|
|
|
|
|
*Bromite*update* ) MSC_TYPE="NanoDroid BromiteWebView Package TWRP invoker" ;;
|
|
|
|
*Bromite*.prop* ) MSC_TYPE="NanoDroid BromiteWebView Package Module Module properties" ;;
|
|
|
|
|
|
|
|
*FDroid*update* ) MSC_TYPE="NanoDroid F-Droid Package TWRP invoker" ;;
|
|
|
|
*FDroid*.prop* ) MSC_TYPE="NanoDroid F-Droid Package Module Module properties" ;;
|
|
|
|
|
|
|
|
*Full*update* ) MSC_TYPE="NanoDroid Full Package TWRP invoker" ;;
|
|
|
|
*Full*.prop* ) MSC_TYPE="NanoDroid Full Package Module Module properties" ;;
|
|
|
|
|
|
|
|
*microG*update* ) MSC_TYPE="NanoDroid microG Package TWRP invoker" ;;
|
|
|
|
*microG*.prop* ) MSC_TYPE="NanoDroid microG Package Module Module properties" ;;
|
|
|
|
|
|
|
|
*OsmAnd*update* ) MSC_TYPE="NanoDroid OsmAnd Package TWRP invoker" ;;
|
|
|
|
*OsmAnd*.prop* ) MSC_TYPE="NanoDroid OsmAnd Package Module Module properties" ;;
|
|
|
|
|
|
|
|
*SetupWizard*update*) MSC_TYPE="NanoDroid SetupWizard AROMA invoker" ;;
|
|
|
|
*SetupWizard*aroma*) MSC_TYPE="NanoDroid SetupWizard AROMA configuration" ;;
|
|
|
|
*SetupWizard/nano*) MSC_TYPE="NanoDroid SetupWizard Worker" ;;
|
|
|
|
|
|
|
|
*uninstaller*binary*) MSC_TYPE="NanoDroid Uninstaller" ;;
|
|
|
|
*uninstaller*update*) MSC_TYPE="NanoDroid Uninstaller TWRP invoker" ;;
|
|
|
|
|
|
|
|
*ChangeLog.md* ) MSC_TYPE="NanoDroid ChangeLog" ;;
|
|
|
|
*README.md* ) MSC_TYPE="NanoDroid README" ;;
|
|
|
|
|
|
|
|
*.nanodroid-apps* ) MSC_TYPE="NanoDroid default app installation configuration" ;;
|
|
|
|
*.nanodroid-setup*) MSC_TYPE="NanoDroid default installation configuration" ;;
|
|
|
|
*.nanodroid-overlay*) MSC_TYPE="NanoDroid default overlay configuration" ;;
|
|
|
|
|
|
|
|
*.maps.jar* ) MSC_TYPE="microG Maps v1 support" ;;
|
|
|
|
|
|
|
|
*noti*.ogg* ) MSC_TYPE="The Legend of Zelda: Notification" ;;
|
|
|
|
*ring*.ogg* ) MSC_TYPE="The Legend of Zelda: Ringtone" ;;
|
|
|
|
*ui*.ogg* ) MSC_TYPE="The Legend of Zelda: UI Sound" ;;
|
|
|
|
*noti*.mp3* ) MSC_TYPE="The Legend of Zelda: Notification" ;;
|
|
|
|
*ring*.mp3* ) MSC_TYPE="The Legend of Zelda: Ringtone" ;;
|
|
|
|
*ui*.mp3* ) MSC_TYPE="The Legend of Zelda: UI Sound" ;;
|
|
|
|
*.ttf* ) MSC_TYPE="Nintendo UI Font" ;;
|
|
|
|
|
|
|
|
*LICENSE* ) MSC_TYPE="exclude" ;;
|
|
|
|
*doc* ) MSC_TYPE="exclude" ;;
|
|
|
|
*build-package* ) MSC_TYPE="exclude" ;;
|
|
|
|
*.json* ) MSC_TYPE="exclude" ;;
|
|
|
|
*.git* ) MSC_TYPE="exclude" ;;
|
|
|
|
*NanoDroid_Report*) MSC_TYPE="exclude" ;;
|
|
|
|
*NanoDroid/dist* ) MSC_TYPE="exclude" ;;
|
|
|
|
|
|
|
|
* ) MSC_TYPE="unknown" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case ${MSC_TYPE} in
|
|
|
|
exclude ) return 0 ;;
|
|
|
|
unknown ) echo "No report template for file: ${1}" ;;
|
|
|
|
* ) MSC_FILE=$(basename ${1})
|
|
|
|
MSC_NAME=$(basename ${1} | sed -e 's/\..*//')
|
|
|
|
MSC_PATH=$(dirname ${1} | sed -e 's/.*NanoDroid/NanoDroid/')
|
|
|
|
MSC_SHA=$(sha256sum ${1} | gawk '{print $1}')
|
|
|
|
|
|
|
|
echo "${MSC_TYPE}: ${MSC_NAME}
|
|
|
|
| Filename: ${MSC_FILE}
|
|
|
|
| Origin: ${MSC_PATH}
|
|
|
|
| SHA256: ${MSC_SHA}
|
|
|
|
" >> ${REPORT_FILE}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
}
|