keystore密碼忘記了,准備給自己的應用發布一個新版本,在apk打包時,發現之前的用的keystore密碼忘了。
如果換一個keystore,則之前已經安裝應用的用戶就必須手工卸載原應用才能安裝,非常麻煩,所以必須找回密碼。
下邊分享一下經驗:
【軟件】:Android Keystore Password Recovery
【網址】:https://code.google.com/p/android-keystore-password-recover/
【運行環境】:JDK7
下載jar包:https://drive.google.com/file/d/0B_Rw7kNjv3BATldrLXMwcVRud2c/edit?usp=sharing,試了多次,證明已經被天朝河蟹掉了,只能翻牆下載。下載下來:AndroidKeystoreBrute_v1.05.jar
官方提供3中方法來破解密碼:
[mw_shl_code=java,true]There are 3 Methods to recover your keystore password:
- Simply Bruteforce (簡單的暴力破解)
- Dictionary Attack (字典破解)
- Smart Wordlist Attack (智能單詞列表破解) 英文不好,直譯的![/mw_shl_code]
用法:
[mw_shl_code=java,true]execute with
java -jar AndroidKeystoreBrute.jar <args>
possible args
-m <1..3> Method
-k <path> path to your keystore
-d <path> dictionary (for method 2 and 3)
-p use common replacements like '@' for 'a'(for method 3) WARNING - very slow!!
-start <String> sets the start String for the password (for brute force)
-w writes a new keystore with same password than the key
-h prints helpscreen
example for brute-force attack
java -jar AndroidKeystoreBrute_v1.05.jar -m 1 -k <...keystore> -start AAAAAA
example for dictionary attack
java -jar AndroidKeystoreBrute_v1.05.jar -m 2 -k "C:\\mykeystore.keystore" -d "wordlist.txt"
example for smart wordlist attack (recommend)
java -jar AndroidKeystoreBrute_v1.05.jar -m 3 -k "C:\\mykeystore.keystore" -d "wordlist.txt" [/mw_shl_code]
開始我用的是方法一,跑了一宿,也沒跑完。默認的字母組合的密碼太多了,用這種方法破解出密碼太渺茫了。
后來我嘗試使用方法三,其實我沒注意,官方推薦就使用方法三:
先創建一個txt,比如passlib.txt: 在文本文檔里輸入自己常用的設置密碼的短語,或者你隱約記得當初創建時可能用到的單詞,反正能想到的統統寫下來:
[mw_shl_code=java,true]helloworld
ILoveYou
java
android
com.ldxx.firstapp[/mw_shl_code]
然后執行:
[mw_shl_code=java,true] java -jar AndroidKeystoreBrute_v1.05.jar -m 3 -k "C:\\mykeystore.keystore" -d "passlib.txt" [/mw_shl_code]
若要是你創建的passlib.txt中的短語確實在你的keystore密碼中出現過,那找回密碼是瞬間的事:
我的執行結果:
[mw_shl_code=java,true] Got Password in 0 seconds
Password is: android521 for alias ldxxfirstapp[/mw_shl_code]
注:命令行執行java -jar 命令時,根目錄一定是 AndroidKeystoreBrute_v1.05.jar所在的目錄,比如 AndroidKeystoreBrute_v1.05.jar放在
C:\key\ AndroidKeystoreBrute_v1.05.jar下,先得cd C:\key 然后在執行,否則會報錯的。