Skip to content

Instantly share code, notes, and snippets.

@LiLejia
Created March 13, 2019 07:32
Show Gist options
  • Save LiLejia/823111de22f97ff1d3b5464d4a83fe80 to your computer and use it in GitHub Desktop.
Save LiLejia/823111de22f97ff1d3b5464d4a83fe80 to your computer and use it in GitHub Desktop.
Download an APK file and print the package and signature.
#!/bin/sh
# package_name_and_sign.sh https://xxx.com/xxx.apk
rm -rf tmp
mkdir tmp
cd tmp/
wget --no-check-certificate $1 -O tmp.rar
echo "Package Name:"
$ANDROID_HOME/build-tools/28.0.2/aapt dump badging tmp.rar | grep package:\ name # Find Package Name
unzip -qq tmp.rar
result="$(/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/keytool -printcert -file META-INF/*.RSA)"
empty=""
result="${result//[:]/$empty}" # Remove ':'
echo "Signature:"
echo "${result}" | tr '[:upper:]' '[:lower:]' | grep md5 #find md5 signature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment