CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/tools/exploit/install_msf_apk.sh
Views: 1904
1
#!/usr/bin/env bash
2
3
# This script allows you install your msf payload apk to your Android emulator.
4
# Make sure you have Java and Android SDK.
5
6
apk_path=$1
7
8
9
if ! [ -x "$(command -v adb)" ]
10
then
11
echo "Android SDK platform-tools not included in \$PATH."
12
exit
13
fi
14
15
if ! [ -x "$(command -v jarsigner)" ]
16
then
17
echo "jarsigner is missing."
18
exit
19
fi
20
21
if ! [ -e "$HOME/.android/debug.keystore" ]
22
then
23
echo "Missing ~/.android/debug.keystore"
24
exit
25
fi
26
27
if [ -z "$apk_path" ]
28
then
29
echo "APK path is required."
30
exit
31
fi
32
33
if ! [ -a "$apk_path" ]
34
then
35
echo "APK not found."
36
exit
37
fi
38
39
jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android -digestalg SHA1 -sigalg MD5withRSA $apk_path androiddebugkey
40
adb uninstall com.metasploit.stage
41
adb install -r $apk_path
42
adb shell am start -a android.intent.action.MAIN -n com.metasploit.stage/.MainActivity
43