Skip to content

Commit

Permalink
Removed installdrozer/drozer in favor of drozercfg
Browse files Browse the repository at this point in the history
  • Loading branch information
jakev committed Nov 9, 2015
1 parent e56266d commit c9a2275
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 178 deletions.
17 changes: 4 additions & 13 deletions manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@
localName="modules/devdiff" />

<Item type="module"
name="drozer"
name="drozercfg"
majorVersion="1"
minorVersion="1"
minorVersion="0"
health="stable"
author="Jake Valletta (jakev)"
about="Starts a drozer session on the device (requires Drozer install)."
localName="modules/drozer" />
about="Drozer client manager."
localName="modules/drozercfg" />

<Item type="module"
name="findimp"
Expand Down Expand Up @@ -144,15 +144,6 @@
about="Get app system libraries off the device."
localName="modules/getsyslibs" />

<Item type="module"
name="installdrozer"
majorVersion="1"
minorVersion="0"
health="stable"
author="Jake Valletta (jakev)"
about="Installs Drozer APK on the test device."
localName="modules/installdrozer" />

<Item type="module"
name="intentsender"
majorVersion="1"
Expand Down
70 changes: 0 additions & 70 deletions modules/drozer

This file was deleted.

139 changes: 139 additions & 0 deletions modules/drozercfg
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
95 changes: 0 additions & 95 deletions modules/installdrozer

This file was deleted.

0 comments on commit c9a2275

Please sign in to comment.