查看apk的sha1值以及apk信息

1 查看apk的sha1值

有时,,希望查看到对应签名了的apk文件的sha1值。使用下面脚本,脚本文件为showInfo.sh :

#!/bin/bash get_signature() {path=`jar tf "$1" | grep RSA`jar xf $1 $pathkeytool -printcert -file $pathrm -r $path }mypath=`pwd` filepath="" if [ -d .temp_for_certificate ] thenecho ".temp_for_certificate is exist,remove it first!"exit fimkdir .temp_for_certificate cd .temp_for_certificate count=0 while [ -n "$1" ]doif [ `expr substr "$1" 1 1` = "/" ] #绝对路径thenfilepath="$1"else #相对路径filepath="$mypath/$1"fiif [ -d $filepath ]thenall_apk=`find $filepath -name "*.apk"`for apk_path in $all_apkdocount=$[$count+1]echo "(#$count) "`basename "$apk_path"`":"filepath=$apk_pathget_signature "$filepath"echo "———————————————————–"doneelsecount=$[$count+1]echo "(#$count) "`basename "$1"`":"get_signature "$filepath"echo "———————————————————–"fishift donecd .. rm -r .temp_for_certificate echo "done!" 调用方式:

sh showInfo.sh <file-name apk>

e.g.

sh showInfo.sh eletricpower.apk

(#1) electricpower.apk:Owner: CN=Android Debug, O=Android, C=USIssuer: CN=Android Debug, O=Android, C=USSerial number: 744df450Valid from: Sat Apr 18 22:57:14 EDT 2015 until: Mon Apr 10 22:57:14 EDT 2045Certificate fingerprints:MD5: 01:F8:68:23:7D:52:31:E3:56:0D:9E:81:7E:29:18:66SHA1: 84:D1:75:85:8E:C7:5B:75:65:87:F8:CB:DF:06:E3:BE:ED:4E:58:B7Signature algorithm name: SHA256withRSAVersion: 3Extensions: #1: ObjectId: 2.5.29.14 Criticality=falseSubjectKeyIdentifier [KeyIdentifier [0000: EE D2 F9 FB 27 F2 F4 AD 48 F0 64 F9 DC B3 CE 7C ….'…H.d…..0010: C2 6A 17 E4.j..]]2 显示apk信息jarsigner -verify -verbose -certs electricpower.apk

我只愿,在你的理想和希望里能为你增加一点鼓励,

查看apk的sha1值以及apk信息

相关文章:

你感兴趣的文章:

标签云: