Skip to content

Commit b21daa7

Browse files
author
Brent Cook
committed
Land rapid7#7263, Automatically generate keystore for android apk signing
2 parents 90f0eec + 9ebe18d commit b21daa7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/msf/core/payload/apk.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,17 @@ def backdoor_payload(apkfile, raw_payload)
141141
raise RuntimeError, "apktool version #{apk_v} not supported, please download at least version 2.0.1."
142142
end
143143

144+
unless File.readable?(File.expand_path("~/.android/debug.keystore"))
145+
android_dir = File.expand_path("~/.android/")
146+
unless File.directory?(android_dir)
147+
FileUtils::mkdir_p android_dir
148+
end
149+
print_status "Creating android debug keystore...\n"
150+
run_cmd("keytool -genkey -v -keystore ~/.android/debug.keystore \
151+
-alias androiddebugkey -storepass android -keypass android -keyalg RSA \
152+
-keysize 2048 -validity 10000 -dname 'CN=Android Debug,O=Android,C=US'")
153+
end
154+
144155
#Create temporary directory where work will be done
145156
tempdir = Dir.mktmpdir
146157

0 commit comments

Comments
 (0)