Skip to content

Commit

Permalink
Merge pull request #307 from mwrlabs/develop
Browse files Browse the repository at this point in the history
Release 2.4.4
  • Loading branch information
amarekano committed Nov 8, 2017
2 parents b4c8d18 + c92d740 commit 9a5a0bc
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 17 deletions.
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This licence does not apply to the following components:

- apktool located at /src/drozer/lib/apktool.jar, released under an Apache2
License and available to download from: https://code.google.com/p/android-apktool/
- BusyBox located at /src/drozer/modules/tools/setup/busybox
License and is available at: https://github.com/iBotPeaches/Apktool
- BusyBox located at /src/drozer/modules/tools/setup/
Released under a GPLv2 License, and available to download from: http://www.busybox.net/
- BouncyCastle, located at /src/drozer/ssl/bcprov-ext-jdk15on-1.46.jar
Released under a modified MIT X11 License, and available to download
from: http://www.bouncycastle.org/
- The Google Protocol Buffers support library for Java, located at:
/src/drozer/lib/protobuf-java-2.4.1.jar. Owned by Google and available to
/src/drozer/lib/protobuf-java-2.6.1.jar. Owned by Google and available to
download from: https://developers.google.com/protocol-buffers/
- Parts of the Android SDK located at:
/src/drozer/lib/aapt
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ debian/DEBIAN/control:
$(CP) scripts/deb/prerm debian/DEBIAN/prerm
# overwrite the Installed-size: field with the correct size
$(SED) -i s/\<FILE_SIZE\>/${shell du -s debian --exclude=DEBIAN debian |cut -f 1}/g debian/DEBIAN/control
$(SED) -i s/\<VERSION\>/${VERSION}/g debian/DEBIAN/control

debian/DEBIAN/md5sums:
$(CD) debian && $(MD5) `$(FIND) . -type f |$(GREP) -v '^[.]/DEBIAN/'` > DEBIAN/md5sums
Expand Down
2 changes: 1 addition & 1 deletion scripts/deb/control.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Homepage: https://labs.mwrinfosecurity.com
Package: drozer
Architecture: all
Installed-Size: <FILE_SIZE>
Version: 2.3.4
Version: <VERSION>
Maintainer: MWR Infosecurity
Depends: bash (>= 2.05a-11), python2.7 (>= 2.7.3), python-dev (>= 2.7.3), python-protobuf (>= 2.4.1), python-openssl (>= 0.12-1), python-twisted (>= 10.0.2)
Description: The Leading Security Testing Framework for Android.
Expand Down
6 changes: 5 additions & 1 deletion src/drozer/agent/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def do_build(self, arguments):

# add extra permissions to the Manifest file
m = manifest.Manifest(packager.manifest_path())
yaml_doc = yaml.load(file(packager.apktool_yml_path()).read())

# Apktool v2.2.4 generates a malformed YAML file when unpacking apks
# See https://github.com/iBotPeaches/Apktool/issues/1610
# This workaround generates a valid YAML document and prevents agent building from failing
yaml_doc = yaml.load(file(packager.apktool_yml_path()).read().replace('!!brut.androlib.meta.MetaInfo',''))
m_ver = yaml_doc['versionInfo']['versionName']
#m_ver = m.version()
c_ver = meta.version.__str__()
Expand Down
Binary file modified src/drozer/lib/apktool.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions src/drozer/modules/common/file_system.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import binascii
import os
import base64

from mwr.common.list import chunk

Expand Down Expand Up @@ -152,10 +153,10 @@ def readFile(self, source, block_size=65536):
data = ""

while True:
block = ByteStreamReader.read(file_stream, 0, block_size)
block = ByteStreamReader.read(file_stream, 0, block_size).base64_encode()

if len(block) > 0:
data += str(block)
data += base64.decodestring(block)
else:
return data
else:
Expand Down
14 changes: 9 additions & 5 deletions src/drozer/modules/common/intent_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ def from_attributes(cls, attrs):
scheme = 'scheme' in attrs and attrs['scheme']
host = 'host' in attrs and attrs['host']
port = 'port' in attrs and attrs['port']
path = 'path' in attrs and attrs['path']
mimetype = 'mimeType' in attrs and attrs['mimeType']
path = 'path' in attrs and attrs['path']
path_prefix = 'pathPrefix' in attrs and attrs['pathPrefix']
path_pattern = 'pathPattern' in attrs and attrs['pathPattern']

return cls(scheme, host, port, path, mimetype)
paths = filter(None, [path, path_prefix, path_pattern])
datas = map(lambda x: cls(scheme, host, port, x, mimetype), paths or [None])

return datas

def __str__(self):
return "%s://%s:%s%s (type: %s)" % (self.scheme or "*", self.host or "*", self.port or "*", self.path or "*", self.mimetype or "*")
Expand All @@ -71,6 +76,5 @@ def add_action(self, action):
def add_category(self, category):
self.categories.append(category)

def add_data(self, data):
self.datas.append(data)

def add_data(self, datas):
self.datas.extend(datas)
5 changes: 5 additions & 0 deletions src/pydiesel/reflection/types/reflected_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

class ReflectedBinary(ReflectedString):

def __init__(self, native, *args, **kwargs):
ReflectedType.__init__(self, *args, **kwargs)

self._native = native

def base64_encode(self):
"""
Get a Base64-encoded representation of the underlying Binary data.
Expand Down
14 changes: 9 additions & 5 deletions src/pydiesel/reflection/utils/class_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import glob
import hashlib
import os
import subprocess

from sys import platform
from mwr.common import fs, system

class ClassBuilder(object):
Expand Down Expand Up @@ -33,13 +35,13 @@ def build(self):
# switch our working directory to the source directory
os.chdir(os.path.dirname(self.path))
# compile the java sources (%.java => %.class)
if not self.__execute(self.javac , "-cp", self.sdk_path, os.path.basename(self.path)):
if self.__execute(self.javac , "-cp", self.sdk_path, os.path.basename(self.path)):
raise RuntimeError("Error whilst compiling the Java sources.")

# collect any sub-classes that we generated
sources = map(lambda p: os.path.basename(p), glob.glob(self.path.replace(".java", "$*.class")))
# package the compiled bytecode into an apk file (%.class => %.apk)
if not self.__execute(self.dx , "--dex", "--output", os.path.basename(apk_path), *([os.path.basename(self.path).replace(".java", ".class")] + sources)):
if self.__execute(self.dx , "--dex", "--output", os.path.basename(apk_path), *([os.path.basename(self.path).replace(".java", ".class")] + sources)):
raise RuntimeError("Error whilst building APK bundle.")

# read the generated source file
Expand All @@ -63,9 +65,11 @@ def __execute(self, *argv):
"""

print " ".join(argv)

# TODO: do we need to use subprocess in some situations? retr = subprocess.call(args)
return os.spawnve(os.P_WAIT, argv[0], argv, os.environ) == 0

if platform == 'win32':
subprocess.call(argv,shell=True,cwd=os.getcwd())
else:
subprocess.call(' '.join(argv),shell=True, cwd=os.getcwd())

def __get_generated_apk_name(self):
"""
Expand Down

0 comments on commit 9a5a0bc

Please sign in to comment.