mercoledì 3 settembre 2014

Show the Android app version and permissions

Here there are some helpful commands to check an Android app using the setup file (APK):

# application version
aapt d badging file.apk | head -n 1

# application permissions
aapt d permissions file.apk

Identity of an Android app creator

To show or verify the identity of the Android app creator, you need the Android application setup (APK file).
Each Android app (file .apk) are digitally signed with a certificate.
This certificate identifies the author of an app.

You can choose one of the following commands:

# Direct with standard Java tools
jarsigner -verify -certs -verbose file.apk

# Indirect with standard Java tools
unzip -p file.apk  META-INF/CERT.RSA \
| keytool -printcert

# Indirect with OpenSSL
unzip -p file.apk  META-INF/CERT.RSA \
| openssl pkcs7 -inform DER -print_certs -text

# Indirect with OpenSSL
unzip -p file.apk  META-INF/CERT.RSA \
| openssl pkcs7 -inform DER -print_certs -text


With OpenSSL you can retrieve more information:
# extract the certificate in PKCS#7 format
unzip -p file.apk META-INF/CERT.RSA > /tmp/cert.pkcs7
# extract the certificate in PEM format
openssl pkcs7 -inform DER -in /tmp/cert.pkcs7 -print_certs \
| tail -n +3 > /tmp/cert.pem
# dump the certificate
openssl x509 -inform PEM -in /tmp/cert.pem -text