|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
REPORT_FILE="${CWD}/NanoDroid_Report_${VERSION}"
|
|
|
|
|
|
|
|
create_report () {
|
|
|
|
|
|
|
|
CURDATE=$(date +%Y%m%d-%H.%M.%S)
|
|
|
|
|
|
|
|
echo "NanoDroid ${VERSION} package report [${CURDATE}]
|
|
|
|
==========================================================
|
|
|
|
" > ${REPORT_FILE}
|
|
|
|
|
|
|
|
for file in $(find ${CWD} -type f); do
|
|
|
|
case ${file} in
|
|
|
|
*.apk.gz ) get_apk_info ${file} ;;
|
|
|
|
*.so* ) get_swipe_info ${file} ;;
|
|
|
|
*xbin* ) get_bin_info ${file} ;;
|
|
|
|
*tools* ) get_bin_info ${file} ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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 "$(printf "\t|- %s\n" ${APK_PERM})\n" >> ${REPORT_FILE}
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f ${APK}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
get_swipe_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}
|
|
|
|
|
|
|
|
}
|