Skip to content

Instantly share code, notes, and snippets.

@amro
Created August 8, 2012 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amro/3294999 to your computer and use it in GitHub Desktop.
Save amro/3294999 to your computer and use it in GitHub Desktop.
Rudimentary Android Keystore Password Recovery Script
#!/usr/bin/env ruby
# USE AT YOUR OWN RISK
# This script stops when it hits the correct
# password (you'll see keytool's "New Password:" prompt)
# If it makes it through all permutations without a match,
# then tweak your input. Oh, and it's not particularly fast.
# Note the empty strings at the end of each array to
# try leaving out those parts
prefix = ['your', 'possible', 'prefixes', '']
mid = ['some','possible','mid', '']
mid_two = ['other', 'possible', 'mid parts', '']
suffix = ['suffixes', 'go', 'here', '']
prefix.each do |pre|
mid.each do |mid|
mid_two.each do |mid_t|
suffix.each do |suf|
pw_to_test = pre + mid + mid_t + suf
puts "trying password #{pw_to_test}"
# Set change "YOUR_ANDROID_KEYSTORE" to the name of your key store file
command = "keytool -storepasswd -keystore YOUR_ANDROID_KEYSTORE.key -storepass '" + pw_to_test + "'"
f = IO::popen(command)
r = f.readlines
f.close
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment