-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed
installdrozer
/drozer
in favor of drozercfg
- Loading branch information
Showing
4 changed files
with
143 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
#!/usr/bin/env bash | ||
# DTF Core Content | ||
# Copyright 2013-2015 Jake Valletta (@jake_valletta) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
#@About: Drozer client manager. | ||
#@Author: Jake Valletta (jakev) | ||
#@Health: stable | ||
#@Version: 1.0 | ||
|
||
. $DTF_CORE | ||
. $DTF_LOG | ||
|
||
drozer_apk=${DTF_PACKAGES}/Drozer/drozer-agent-2.3.2.apk | ||
drozer_package=com.mwr.dz | ||
|
||
usage() | ||
{ | ||
echo "Drozer Client Manager " | ||
echo "" | ||
echo "Submodules:" | ||
echo " install [-r] Install Drozer on device." | ||
echo " build Build a local Drozer instance." | ||
echo "" | ||
|
||
} | ||
|
||
do_install() | ||
{ | ||
log_i "Waiting for connected device..." | ||
adb wait-for-device | ||
|
||
# First find out if Drozer is installed | ||
installed=$(adb shell pm list packages ${drozer_package}) | ||
|
||
if [ "$2" = "-r" ]; then | ||
|
||
if [ -z "$installed" ]; then | ||
log_e "Drozer is not installed, exiting!" | ||
return 1 | ||
fi | ||
|
||
if [ ! -z "$3" ]; then | ||
drozer_apk=$3 | ||
fi | ||
|
||
log_i "Reinstalling Drozer..." | ||
adb uninstall ${drozer_package} | ||
install_drozer ${drozer_apk} | ||
exit 0 | ||
fi | ||
|
||
if [ ! -z "$installed" ]; then | ||
log_e "Drozer is already installed, exiting!" | ||
return 2 | ||
fi | ||
|
||
if [ ! -z "$2" ]; then | ||
drozer_apk=$2 | ||
fi | ||
|
||
install_drozer ${drozer_apk} | ||
return 0 | ||
} | ||
|
||
do_build() | ||
{ | ||
ADB=adb | ||
APKTOOL=dtf_apktool | ||
AUTOSIGN="dtf autosign" | ||
DROZER_DIR=$TOP/.drozer | ||
DIST_DIR=$DROZER_DIR/dist | ||
PROJECT_NAME=com.mwr.dz | ||
APK_NAME=drozer-agent-2.3.2.apk | ||
APK_NAME_SIGNED=drozer-agent-2.3.2-signed.apk | ||
|
||
# Clean | ||
log_i "Cleaning old Drozer build..." | ||
rm ${DIST_DIR}/${APK_NAME} 2> /dev/null | ||
rm ${DIST_DIR}/${APK_NAME_SIGNED} 2> /dev/null | ||
|
||
# Build APK | ||
log_i "Building new APK..." | ||
${APKTOOL} build ${DROZER_DIR} | ||
|
||
log_i "Signing APK..." | ||
${AUTOSIGN} ${DIST_DIR}/${APK_NAME} ${DIST_DIR}/${APK_NAME_SIGNED} | ||
|
||
# Uninstall old, install new. | ||
log_i "Removing and installing new version..." | ||
${ADB} wait-for-device | ||
${ADB} uninstall ${PROJECT_NAME} | ||
${ADB} install ${DIST_DIR}/${APK_NAME_SIGNED} | ||
} | ||
|
||
install_drozer() | ||
{ | ||
log_i "Installing Drozer..." | ||
|
||
# See if .drozer already exists | ||
if [ ! -d .drozer ]; then | ||
log_i "Installing drozer files to '.drozer'..." | ||
mkdir .drozer 2>/dev/null | ||
dtf_apktool d "${drozer_apk}" -f -o .drozer/ > /dev/null 2>&1 | ||
else | ||
log_w "The directory '.drozer' already exists, skipping copy" | ||
fi | ||
|
||
adb install ${drozer_apk} | ||
|
||
log_i "Setting up forwarding..." | ||
adb forward tcp:31415 tcp:31415 | ||
|
||
log_i "Drozer installed." | ||
} | ||
|
||
# Main | ||
if [ "$1" = "-h" -o -z "$1" ]; then | ||
usage | ||
exit 0 | ||
|
||
elif [ "$1" = "install" ]; then | ||
do_install "$@" | ||
|
||
elif [ "$1" = "build" ]; then | ||
do_build "$@" | ||
|
||
fi |
This file was deleted.
Oops, something went wrong.